FIX: Duplicate a tag if image url is same to href

This commit is contained in:
Vinoth Kanan 2017-11-15 17:36:48 +05:30
parent 2e7c61681e
commit 5c11104f9f
1 changed files with 10 additions and 6 deletions

View File

@ -110,13 +110,17 @@ class CookedPostProcessor
parent = placeholder.parent
parent.add_next_sibling(placeholder)
if parent.name == 'a' && parent["href"].present? && url != parent["href"]
parent["class"] = "link"
a.add_previous_sibling(parent)
if parent.name == 'a' && parent["href"].present?
if url == parent["href"]
parent.remove
else
parent["class"] = "link"
a.add_previous_sibling(parent)
lspan = create_span_node("url", parent["href"])
parent.add_child(lspan)
lspan.add_previous_sibling(create_icon_node("link"))
lspan = create_span_node("url", parent["href"])
parent.add_child(lspan)
lspan.add_previous_sibling(create_icon_node("link"))
end
end
end