Use floki's new APIs for parsing fragments

This commit is contained in:
rinpatch 2020-02-16 01:55:26 +03:00
commit 472132215e
8 changed files with 121 additions and 106 deletions

View file

@ -8,8 +8,10 @@ defmodule Pleroma.Web.Metadata.Providers.RelMe do
@impl Provider
def build_tags(%{user: user}) do
(Floki.attribute(user.bio, "link[rel~=me]", "href") ++
Floki.attribute(user.bio, "a[rel~=me]", "href"))
bio_tree = Floki.parse_fragment!(user.bio)
(Floki.attribute(bio_tree, "link[rel~=me]", "href") ++
Floki.attribute(bio_tree, "a[rel~=me]", "href"))
|> Enum.map(fn link ->
{:link, [rel: "me", href: link], []}
end)