FIX: Replace details content with instruction.

This commit is contained in:
Bianca Nenciu
2019-05-24 18:57:03 +03:00
committed by Guo Xiang Tan
parent 6cceb72173
commit 3a1d99577e
3 changed files with 27 additions and 3 deletions

View File

@ -31,8 +31,14 @@ after_initialize do
end
end
on(:reduce_cooked) do |fragment|
fragment.css("details.elided").each(&:remove)
on(:reduce_cooked) do |fragment, post|
fragment.css("details").each do |el|
text = fragment.css("summary").text
link = fragment.document.create_element("a")
link["href"] = post.url if post
link.content = I18n.t("details.excerpt_details")
el.replace text + " " + link.to_html
end
end
end