summaryrefslogtreecommitdiff
path: root/create.rb
diff options
context:
space:
mode:
authorpdp8 <pdp8@pdp8.info>2023-07-30 01:27:51 +0200
committerpdp8 <pdp8@pdp8.info>2023-07-30 01:27:51 +0200
commit25bdc789215c728e6fac04404adcf1f8e4bcdd78 (patch)
treefabf21feea41ef2cedcca5f69480ee39c652b114 /create.rb
parentc50f749a2685a3e7608cec8730f5fe79de4676ac (diff)
html links for outbox notes
Diffstat (limited to 'create.rb')
-rw-r--r--create.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/create.rb b/create.rb
index d986812..301417f 100644
--- a/create.rb
+++ b/create.rb
@@ -40,6 +40,9 @@ post '/create' do # TODO
}
end
break
+ elsif line.match(url_regexp)
+ # single quotes in html invalidate digest, reason unknown
+ content << line.gsub(Regexp.last_match(0), "<a href=\"#{Regexp.last_match(0)}\">#{Regexp.last_match(0)}</a>")
else
tags = line.split(/\s+/).grep(hashtag_regexp)
tags.each do |name|
@@ -49,6 +52,8 @@ post '/create' do # TODO
'href' => tag_url,
'name' => name
}
+ # single quotes in html invalidate digest, reason unknown
+ line.gsub!(name, "<a href=\"#{tag_url}\">#{name}</a>")
end
mentions = line.split(/\s+/).grep(mention_regexp)
mentions.each do |mention|
@@ -58,6 +63,8 @@ post '/create' do # TODO
'href' => actor,
'name' => mention
}
+ # single quotes in html invalidate digest, reason unknown
+ line.gsub!(mention, "<a href=\"#{actor}\">#{mention}</a>")
end
content << line
end