logo

auto_linker

AutoLinker-shim, based on https://git.pleroma.social/pleroma/auto_linker
commit: 49e9150bdcbad5ab8066763b685c88120b291063
parent: 1a2629f36537b46b9ed9a69d9b1a8920e1d2e1c2
Author: Egor Kislitsyn <egor@kislitsyn.com>
Date:   Fri,  8 Feb 2019 16:14:39 +0700

better naming

Diffstat:

Mtest/auto_linker_test.exs10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/auto_linker_test.exs b/test/auto_linker_test.exs @@ -56,12 +56,12 @@ defmodule AutoLinkerTest do text = "hello @user, @valid_user and @invalid_user" valid_users = ["user", "valid_user"] - handler = fn "@" <> user = mention, buffer, _opts, parsed -> + handler = fn "@" <> user = mention, buffer, _opts, acc -> if Enum.member?(valid_users, user) do link = ~s(<a href="https://example.com/user/#{user}" data-user="#{user}">#{mention}</a>) - {link, %{parsed | mentions: MapSet.put(parsed.mentions, {mention, user})}} + {link, %{acc | mentions: MapSet.put(acc.mentions, {mention, user})}} else - {buffer, parsed} + {buffer, acc} end end @@ -80,9 +80,9 @@ defmodule AutoLinkerTest do test "hashtags handler" do text = "#hello #world" - handler = fn hashtag, buffer, opts, parsed -> + handler = fn hashtag, buffer, opts, acc -> link = AutoLinker.Builder.create_hashtag_link(hashtag, buffer, opts) - {link, %{parsed | tags: MapSet.put(parsed.tags, hashtag)}} + {link, %{acc | tags: MapSet.put(acc.tags, hashtag)}} end {result_text, %{tags: tags}} =