A lot :)
This commit is contained in:
parent
aad67af0d1
commit
63fc206c27
153 changed files with 2043 additions and 646 deletions
|
|
@ -1,17 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module PdfHelper
|
||||
def prepare_rich_text(rich_text)
|
||||
return rich_text
|
||||
|
||||
{ del: 'strikethrough' }.each do |tag, replacement|
|
||||
{ del: "strikethrough" }.each do |tag, replacement|
|
||||
rich_text = rich_text.to_s.gsub("<#{tag}", "<#{replacement}")
|
||||
rich_text = rich_text.to_s.gsub("</#{tag}>", "</#{replacement}>")
|
||||
end
|
||||
|
||||
%w[div p del blockquote pre code].each do |tag|
|
||||
rich_text = rich_text.to_s.gsub(%r{<#{tag}.*?>|</#{tag}>}, '')
|
||||
rich_text = rich_text.to_s.gsub(%r{<#{tag}.*?>|</#{tag}>}, "")
|
||||
end
|
||||
rich_text.gsub!(/<h1.*?>/, '')
|
||||
rich_text.gsub!(%r{</h1>}, '<br><br>')
|
||||
rich_text.gsub!(/<h1.*?>/, "")
|
||||
rich_text.gsub!(%r{</h1>}, "<br><br>")
|
||||
rich_text
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue