lib/asciidoctor/itu/cleanup.rb in metanorma-itu-1.2.16 vs lib/asciidoctor/itu/cleanup.rb in metanorma-itu-1.3.0
- old
+ new
@@ -22,16 +22,16 @@
text = t.at("./descendant::text()") or next
text.replace(text.text.capitalize)
end
end
- def insert_missing_sections(x)
- insert_scope(x)
- insert_norm_ref(x)
- insert_terms(x)
- insert_symbols(x)
- insert_conventions(x)
+ def insert_missing_sections(xml)
+ insert_scope(xml)
+ insert_norm_ref(xml)
+ insert_terms(xml)
+ insert_symbols(xml)
+ insert_conventions(xml)
end
def add_id
%(id="_#{UUIDTools::UUID.random_create}")
end
@@ -107,12 +107,14 @@
xmldoc
end
def smartquotes_cleanup(xmldoc)
return super if @smartquotes
+
xmldoc.traverse do |n|
next unless n.text?
+
n.replace(HTMLEntities.new.encode(
n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'").
gsub(/\u201c|\u201d|\u201e|\u201f/, '"'), :basic))
end
xmldoc
@@ -173,9 +175,10 @@
return 3 if bib.at("#{PUBLISHER}[name = 'International "\
"Electrotechnical Commission']")
return 4 if bib.at("./docidentifier[@type][not(@type = 'DOI' or "\
"@type = 'metanorma' or @type = 'ISSN' or @type = "\
"'ISBN')]")
+
5
end
def sort_biblio(bib)
bib.sort do |a, b|