diff options
author | Vald <maghtpol@gmail.com> | 2018-12-06 01:05:41 +0530 |
---|---|---|
committer | Vald <maghtpol@gmail.com> | 2018-12-06 01:05:41 +0530 |
commit | 3ccfe226c0e7710c2321b19643a43fcc6458a1e9 (patch) | |
tree | d0335eb544aa29052799f1d50b26f4871124d1cb /lib | |
parent | 5f0c2372bc8be3763b649b13ee142c273583329e (diff) | |
download | pleroma-3ccfe226c0e7710c2321b19643a43fcc6458a1e9.tar.gz |
added data attrs for user and tag
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/formatter.ex | 10 | ||||
-rw-r--r-- | lib/pleroma/html.ex | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 1a5c07c8a..5b03e9aeb 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -114,7 +114,7 @@ defmodule Pleroma.Formatter do subs = subs ++ - Enum.map(mentions, fn {match, %User{ap_id: ap_id, info: info}, uuid} -> + Enum.map(mentions, fn {match, %User{id: id, ap_id: ap_id, info: info}, uuid} -> ap_id = if is_binary(info.source_data["url"]) do info.source_data["url"] @@ -125,7 +125,7 @@ defmodule Pleroma.Formatter do short_match = String.split(match, "@") |> tl() |> hd() {uuid, - "<span><a class='mention' href='#{ap_id}'>@<span>#{short_match}</span></a></span>"} + "<span><a data-user='#{id}' class='mention' href='#{ap_id}'>@<span>#{short_match}</span></a></span>"} end) {subs, uuid_text} @@ -147,7 +147,11 @@ defmodule Pleroma.Formatter do subs = subs ++ Enum.map(tags, fn {tag_text, tag, uuid} -> - url = "<a href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{tag_text}</a>" + url = + "<a data-tag='#{tag}' href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{ + tag_text + }</a>" + {uuid, url} end) diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index 1b920d7fd..271a48b57 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -86,7 +86,7 @@ defmodule Pleroma.HTML.Scrubber.Default do Meta.remove_cdata_sections_before_scrub() Meta.strip_comments() - Meta.allow_tag_with_uri_attributes("a", ["href"], @valid_schemes) + Meta.allow_tag_with_uri_attributes("a", ["href", "data-user", "data-tag"], @valid_schemes) Meta.allow_tag_with_these_attributes("a", ["name", "title"]) Meta.allow_tag_with_these_attributes("abbr", ["title"]) |