summaryrefslogtreecommitdiff
path: root/create.rb
diff options
context:
space:
mode:
Diffstat (limited to 'create.rb')
-rw-r--r--create.rb15
1 files changed, 3 insertions, 12 deletions
diff --git a/create.rb b/create.rb
index 9241d2b..8e221c8 100644
--- a/create.rb
+++ b/create.rb
@@ -38,16 +38,10 @@ post '/create' do
'mediaType' => media_type(url),
'url' => url
}
- when ''
- content << '<p>'
else # create links
# single quotes in html invalidate digest, reason unknown
- content << line.split(/\s+/).collect do |word|
+ line.split(/\s+/).each do |word|
case word
- when URL_REGEXP
- "<a href=\"#{word}\">#{word}</a>"
- when URI::MailTo::EMAIL_REGEXP
- "<a href=\"mailto:#{word}\">#{word}</a>"
when HASHTAG_REGEXP
tag_url = File.join('https://social.pdp8.info', 'tags', word.sub('#', ''))
tag << {
@@ -55,19 +49,16 @@ post '/create' do
'href' => tag_url,
'name' => word
}
- "<a href=\"#{tag_url}\">#{word}</a>"
- when MENTION_REGEXP
+ when MENTION_REGEXP
actor = actor(word)
tag << {
'type' => 'Mention',
'href' => actor,
'name' => word
}
- "<a href=\"#{actor}\">#{word}</a>"
- else
- word
end
end
+ content << line
end
end