logo

auto_linker

AutoLinker-shim, based on https://git.pleroma.social/pleroma/auto_linker git clone https://hacktivis.me/git/auto_linker.git
commit: 6242cebdf9979d5fc912fc30d8dfec79994bc418
parent f081e6b5537ea39c3f2aba80db04b070c9b8b73d
Author: Egor Kislitsyn <egor@kislitsyn.com>
Date:   Fri, 21 Jun 2019 17:24:30 +0700

Use double quotes in HTML attributes

Diffstat:

Mtest/auto_linker_test.exs8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/auto_linker_test.exs b/test/auto_linker_test.exs @@ -13,8 +13,8 @@ defmodule AutoLinkerTest do end test "does on link existing links" do - assert AutoLinker.link("<a href='http://google.com'>google.com</a>") == - "<a href='http://google.com'>google.com</a>" + text = ~s(<a href="http://google.com">google.com</a>) + assert AutoLinker.link(text) == text end test "all kinds of links" do @@ -123,11 +123,11 @@ defmodule AutoLinkerTest do "Hello again, @user.&lt;script&gt;&lt;/script&gt;\nThis is on another :moominmamma: line. #2hu #epic #phantasmagoric" handler = fn "@" <> user = mention, _, _, _ -> - ~s(<span class='h-card'><a href='#/user/#{user}'>@<span>#{mention}</span></a></span>) + ~s(<span class="h-card"><a href="#/user/#{user}">@<span>#{mention}</span></a></span>) end expected = - "Hello again, <span class='h-card'><a href='#/user/user'>@<span>@user</span></a></span>.&lt;script&gt;&lt;/script&gt;\nThis is on another :moominmamma: line. <a href=\"/tag/2hu\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">#2hu</a> <a href=\"/tag/epic\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">#epic</a> <a href=\"/tag/phantasmagoric\" class=\"auto-linker\" target=\"_blank\" rel=\"noopener noreferrer\">#phantasmagoric</a>" + ~s(Hello again, <span class="h-card"><a href="#/user/user">@<span>@user</span></a></span>.&lt;script&gt;&lt;/script&gt;\nThis is on another :moominmamma: line. <a href="/tag/2hu" class="auto-linker" target="_blank" rel="noopener noreferrer">#2hu</a> <a href="/tag/epic" class="auto-linker" target="_blank" rel="noopener noreferrer">#epic</a> <a href="/tag/phantasmagoric" class="auto-linker" target="_blank" rel="noopener noreferrer">#phantasmagoric</a>) assert AutoLinker.link(text, mention: true,