lib/asciidoctor/gb/converter.rb in metanorma-gb-1.0.10 vs lib/asciidoctor/gb/converter.rb in metanorma-gb-1.0.11
- old
+ new
@@ -114,19 +114,23 @@
s.name = elem.name
end
elem.replace(elem.children)
end
+ def text_clean(text)
+ text.gsub(/^\s*/, "").gsub(/</, "<").gsub(/>/, ">")
+ end
+
def duplicate_localisedstrings(zh)
en = zh.dup.remove
zh.after(en).after(" ")
zh["language"] = "zh"
en["language"] = "en"
en.traverse do |c|
- c.text? && c.content = c.text.gsub(HAN_TEXT, "").gsub(/^\s*/, "")
+ c.text? && c.content = text_clean(c.text.gsub(HAN_TEXT, ""))
end
zh.traverse do |c|
- c.text? && c.content = c.text.gsub(ROMAN_TEXT, "").gsub(/^\s*/, "")
+ c.text? && c.content = text_clean(c.text.gsub(ROMAN_TEXT, ""))
end
end
def inline_quoted(node)
ret = noko do |xml|