diff options
author | lambda <pleromagit@rogerbraun.net> | 2019-01-16 09:06:47 +0000 |
---|---|---|
committer | lambda <pleromagit@rogerbraun.net> | 2019-01-16 09:06:47 +0000 |
commit | 608cc65d43277016a22500771360598775a3df1e (patch) | |
tree | 3af610ae2e006880c8905ace22e4185737e09d0a /lib | |
parent | da4b670451fcc41b960aeb33adb9f0184ba599cf (diff) | |
parent | 85a5be6220dd87e2884b5921fc1a6c92ee7cc745 (diff) | |
download | pleroma-608cc65d43277016a22500771360598775a3df1e.tar.gz |
Merge branch 'feature/improve-microformats' into 'develop'
improve microformats support
See merge request pleroma/pleroma!672
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/formatter.ex | 6 | ||||
-rw-r--r-- | lib/pleroma/html.ex | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index d80ae6576..4149265a2 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -145,7 +145,9 @@ defmodule Pleroma.Formatter do short_match = String.split(match, "@") |> tl() |> hd() {uuid, - "<span><a data-user='#{id}' class='mention' href='#{ap_id}'>@<span>#{short_match}</span></a></span>"} + "<span class='h-card'><a data-user='#{id}' class='u-url mention' href='#{ap_id}'>@<span>#{ + short_match + }</span></a></span>"} end) {subs, uuid_text} @@ -168,7 +170,7 @@ defmodule Pleroma.Formatter do subs ++ Enum.map(tags, fn {tag_text, tag, uuid} -> url = - "<a data-tag='#{tag}' href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{ + "<a class='hashtag' data-tag='#{tag}' href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{ tag_text }</a>" diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index 0c5b0f03f..f5c6e5033 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -78,14 +78,14 @@ defmodule Pleroma.HTML.Scrubber.TwitterText do # links 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", "class"]) # paragraphs and linebreaks Meta.allow_tag_with_these_attributes("br", []) Meta.allow_tag_with_these_attributes("p", []) # microformats - Meta.allow_tag_with_these_attributes("span", []) + Meta.allow_tag_with_these_attributes("span", ["class"]) # allow inline images for custom emoji @allow_inline_images Keyword.get(@markup, :allow_inline_images) @@ -119,7 +119,7 @@ defmodule Pleroma.HTML.Scrubber.Default do Meta.strip_comments() 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", "class"]) Meta.allow_tag_with_these_attributes("abbr", ["title"]) @@ -134,7 +134,7 @@ defmodule Pleroma.HTML.Scrubber.Default do Meta.allow_tag_with_these_attributes("ol", []) Meta.allow_tag_with_these_attributes("p", []) Meta.allow_tag_with_these_attributes("pre", []) - Meta.allow_tag_with_these_attributes("span", []) + Meta.allow_tag_with_these_attributes("span", ["class"]) Meta.allow_tag_with_these_attributes("strong", []) Meta.allow_tag_with_these_attributes("u", []) Meta.allow_tag_with_these_attributes("ul", []) |