Skip to content

Commit

Permalink
https://github.com/metanorma/metanorma-ieee/issues/442
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Dec 10, 2024
1 parent e4eed42 commit be9a024
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions lib/metanorma/standoc/cleanup_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ def uninterrupt_quotes_around_xml(xmldoc)
end
end

# "abc<tag/>", def => "abc",<tag/> 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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/standoc/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def versioned(mod, flavour)
end

module Standoc
VERSION = "2.10.1".freeze
VERSION = "2.10.2".freeze
end
end
2 changes: 1 addition & 1 deletion metanorma-standoc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit be9a024

Please sign in to comment.