lib/asciidoctor/standoc/cleanup.rb in metanorma-standoc-1.3.11 vs lib/asciidoctor/standoc/cleanup.rb in metanorma-standoc-1.3.12
- old
+ new
@@ -61,21 +61,21 @@
boilerplate_cleanup(xmldoc)
xmldoc
end
def smartquotes_cleanup(xmldoc)
+ xmldoc.xpath("//date").each { |d| Utils::endash_date(d) }
xmldoc.traverse do |n|
next unless n.text?
if @smartquotes
next unless n.ancestors("pre, tt, sourcecode, bibdata, on, "\
"figure[@class = 'pseudocode']").empty?
n.replace(Utils::smartformat(n.text))
else
n.replace(n.text.gsub(/(?<=\p{Alnum})\u2019(?=\p{Alpha})/, "'"))
end
end
- xmldoc
end
def docidentifier_cleanup(xmldoc)
end
@@ -147,10 +147,17 @@
prev = a.parent.previous
prev.next = a.remove
end
end
+ def termdomain1_cleanup(xmldoc)
+ xmldoc.xpath("//domain").each do |d|
+ defn = d.at("../definition") and
+ defn.previous = d.remove
+ end
+ end
+
def termdefinition_cleanup(xmldoc)
xmldoc.xpath("//term").each do |d|
first_child = d.at("./p | ./figure | ./formula") || return
t = Nokogiri::XML::Element.new("definition", xmldoc)
first_child.replace(t)
@@ -194,9 +201,10 @@
def termdef_cleanup(xmldoc)
termdef_unnest_cleanup(xmldoc)
termdef_stem_cleanup(xmldoc)
termdomain_cleanup(xmldoc)
termdefinition_cleanup(xmldoc)
+ termdomain1_cleanup(xmldoc)
termdef_boilerplate_cleanup(xmldoc)
termdef_subclause_cleanup(xmldoc)
term_children_cleanup(xmldoc)
termdocsource_cleanup(xmldoc)
end