diff --git a/lib/metanorma/standoc/cleanup_text.rb b/lib/metanorma/standoc/cleanup_text.rb index 5cb998d5..13957127 100644 --- a/lib/metanorma/standoc/cleanup_text.rb +++ b/lib/metanorma/standoc/cleanup_text.rb @@ -88,6 +88,15 @@ def uninterrupt_quotes_around_xml(xmldoc) end end + # "abc", def => "abc", def + # TODO? + def uninterrupt_quotes_around_xml1(xmldoc) + xmldoc.xpath("//text()[preceding-sibling::*[1]]").each do |n| + uninterrupt_quotes_around_xml_skip(n) and next + uninterrupt_quotes_around_xml1(n.previous) + end + end + IGNORE_QUOTES_ELEMENTS = %w(pre tt sourcecode stem asciimath figure bibdata passthrough identifier metanorma-extension).freeze @@ -157,6 +166,20 @@ def dumb2smart_quotes(xmldoc) end end + def dumb2smart_quotesx(xmldoc) + # TODO?> + prev = "" + xmldoc.xpath("//* | //text()").each do |x| + x.is_a?(Nokogiri::XML::Node) or next + block?(x) and prev = "" + empty_tag_with_text_content?(x) and prev = "dummy" + x.text? or next +ancestor_include?(x, IGNORE_QUOTES_ELEMENTS) and next + dumb2smart_quotes1(x, prev) + prev = x.text + end + end + def dumb2smart_quotes1(curr, prev) /[-'"(<>]|\.\.|\dx/.match?(curr.text) or return diff --git a/lib/metanorma/standoc/version.rb b/lib/metanorma/standoc/version.rb index 92973ddd..49b3be59 100644 --- a/lib/metanorma/standoc/version.rb +++ b/lib/metanorma/standoc/version.rb @@ -19,6 +19,6 @@ def versioned(mod, flavour) end module Standoc - VERSION = "2.10.1".freeze + VERSION = "2.10.2".freeze end end diff --git a/metanorma-standoc.gemspec b/metanorma-standoc.gemspec index 1a676027..e081dff2 100644 --- a/metanorma-standoc.gemspec +++ b/metanorma-standoc.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |spec| spec.add_dependency "asciidoctor", "~> 2.0.0" spec.add_dependency "crass", "~> 1.0.0" spec.add_dependency "iev", "~> 0.3.0" - spec.add_dependency "isodoc", "~> 2.12.2" + spec.add_dependency "isodoc", "~> 2.12.4" spec.add_dependency "metanorma", ">= 1.6.0" spec.add_dependency "metanorma-plugin-datastruct", "~> 0.3.0" spec.add_dependency "metanorma-plugin-glossarist", "~> 0.2.0"