forked from AkkomaGang/akkoma
added data attrs for user and tag
This commit is contained in:
parent
5f0c2372bc
commit
3ccfe226c0
2 changed files with 8 additions and 4 deletions
|
@ -114,7 +114,7 @@ def add_user_links({subs, text}, mentions) do
|
||||||
|
|
||||||
subs =
|
subs =
|
||||||
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 =
|
ap_id =
|
||||||
if is_binary(info.source_data["url"]) do
|
if is_binary(info.source_data["url"]) do
|
||||||
info.source_data["url"]
|
info.source_data["url"]
|
||||||
|
@ -125,7 +125,7 @@ def add_user_links({subs, text}, mentions) do
|
||||||
short_match = String.split(match, "@") |> tl() |> hd()
|
short_match = String.split(match, "@") |> tl() |> hd()
|
||||||
|
|
||||||
{uuid,
|
{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)
|
end)
|
||||||
|
|
||||||
{subs, uuid_text}
|
{subs, uuid_text}
|
||||||
|
@ -147,7 +147,11 @@ def add_hashtag_links({subs, text}, tags) do
|
||||||
subs =
|
subs =
|
||||||
subs ++
|
subs ++
|
||||||
Enum.map(tags, fn {tag_text, tag, uuid} ->
|
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}
|
{uuid, url}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ defmodule Pleroma.HTML.Scrubber.Default do
|
||||||
Meta.remove_cdata_sections_before_scrub()
|
Meta.remove_cdata_sections_before_scrub()
|
||||||
Meta.strip_comments()
|
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("a", ["name", "title"])
|
||||||
|
|
||||||
Meta.allow_tag_with_these_attributes("abbr", ["title"])
|
Meta.allow_tag_with_these_attributes("abbr", ["title"])
|
||||||
|
|
Loading…
Reference in a new issue