summaryrefslogtreecommitdiff
path: root/create.rb
diff options
context:
space:
mode:
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