Skip to content

Commit

Permalink
🥔✨ Journal: Entry links to their Terms
Browse files Browse the repository at this point in the history
  • Loading branch information
zspencer committed Jul 10, 2023
1 parent 632529a commit b934994
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/furniture/journal/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def autolink(link, link_type)
def postprocess(doc)
doc
.gsub(/@([a-zA-Z\d]*)@(.*\.[a-zA-Z]*)/, '<a href="https://\2/@\1">@\1@\2</a>')
# .gsub(/#(\w+)/, '<a href="../terms/\1">#\1</a>')
.gsub(/#(\w+)/, '<a href="../terms/\1">#\1</a>')
end
end
end
5 changes: 3 additions & 2 deletions spec/furniture/journal/entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
describe "#to_html" do
subject(:to_html) { entry.to_html }

context "when #body is 'https://www.google.com @[email protected]'" do
let(:entry) { build(:journal_entry, body: "https://www.google.com @[email protected]") }
context "when #body is 'https://www.google.com @[email protected] #GoodTimes'" do
let(:entry) { build(:journal_entry, body: "https://www.google.com @[email protected] #GoodTimes") }

it { is_expected.to include('<a href="https://www.google.com">https://www.google.com</a>') }
it { is_expected.to include('<a href="../terms/GoodTimes">#GoodTimes</a>') }
end
end

Expand Down

0 comments on commit b934994

Please sign in to comment.