summaryrefslogtreecommitdiff
path: root/create.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-09-14 14:02:15 +0200
committerpdp8 <pdp8@pdp8.info>2023-09-14 14:02:15 +0200
commiteea88e8022d3fd3c46401e1a297ebd7318c3c7b1 (patch)
tree72a6ea1a1f07cbe13abd3eca2ece7b19a248a610 /create.rb
parentd635057cb576c5570c5ceba5945cc5339b0f41ab (diff)
send/digest fixed
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