diff options
author | kaniini <nenolod@gmail.com> | 2018-12-05 20:47:44 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2018-12-05 20:47:44 +0000 |
commit | 6ab58fdfa1ce2a4afbedb8c018b2ec617348e640 (patch) | |
tree | c3c92fca2974539ca0f63d5e13c71b88dfc83b51 /lib | |
parent | 5f0c2372bc8be3763b649b13ee142c273583329e (diff) | |
parent | 194869c7db1d31b139254d3a0c6a449cee0068fe (diff) | |
download | pleroma-6ab58fdfa1ce2a4afbedb8c018b2ec617348e640.tar.gz |
Merge branch 'dev_vald_fe/data_tag' into 'develop'
added data-user and data-tag attributes
Closes #410
See merge request pleroma/pleroma!504
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/formatter.ex | 10 | ||||
-rw-r--r-- | lib/pleroma/html.ex | 4 |
2 files changed, 9 insertions, 5 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..5daaa5e69 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -45,7 +45,7 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do Meta.strip_comments() # links - 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"]) # paragraphs and linebreaks @@ -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"]) |