Created
December 8, 2020 16:10
-
-
Save nawada/d666c72532a0ad2baf13a85157ec7270 to your computer and use it in GitHub Desktop.
Textareaの改行コードを確認するやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
set :bind, '0.0.0.0' | |
get '/' do | |
erb :index | |
end | |
post '/s' do | |
text = params['textarea'] | |
# text.gsub!(/\n/, '<br>') | |
ret_text = "<pre>#{text}</pre>" | |
p ret_text | |
ret_text | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'sinatra', '~> 2.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 本来のパスは views/index.erb --> | |
<form action="/s" method="post"> | |
<label for="textarea"> | |
<textarea name="textarea" id="textarea" cols="30" rows="10"></textarea> | |
<button type="submit">submit</button> | |
</label> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment