Skip to content

Commit

Permalink
Merge pull request #129 from metanorma/fix/nokogiri-1.13
Browse files Browse the repository at this point in the history
Nokogiri 1.13-safe processing: https://github.com/metanorma/isodoc/is…
  • Loading branch information
opoudjis authored May 16, 2022
2 parents 51c6bac + bc00d0e commit 490aae8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/isodoc/ribose/word_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def make_body2(body, docxml)
introduction docxml, div2
preface docxml, div2
acknowledgements docxml, div2
div2.p { |p| p << "&nbsp;" } # placeholder
div2.p { |p| p << "&#xa0;" } # placeholder
end
section_break(body)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/isodoc/html_convert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
output = xmlpp(<<~"OUTPUT")
<div id='H'>
<h1 id='toc0'>1.&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
<p class='Terms' style='text-align:left;' id='J'><strong>1.1.</strong>&#xA0;Term2</p>
<p class='Terms' style='text-align:left;' id='J'><strong>1.1.</strong>Term2</p>
<p class='AltTerms' style='text-align:left;'>Term2A</p>
<p class='AltTerms' style='text-align:left;'>Term2B</p>
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: Term2C</p>
Expand Down
2 changes: 1 addition & 1 deletion spec/metanorma/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<p class="zzSTDTitle1"></p>
<div id="H">
<h1 id="toc0">1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
<p class='Terms' style='text-align:left;' id='J'><strong>1.1</strong>&#xA0;Term2</p>
<p class='Terms' style='text-align:left;' id='J'><strong>1.1</strong>Term2</p>
</div>
</main>
OUTPUT
Expand Down
7 changes: 7 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ def htmlencode(html)
end

def xmlpp(xml)
c = HTMLEntities.new
xml &&= xml.split(/(&\S+?;)/).map do |n|
if /^&\S+?;$/.match?(n)
c.encode(c.decode(n), :hexadecimal)
else n
end
end.join
s = ""
f = REXML::Formatters::Pretty.new(2)
f.compact = true
Expand Down

0 comments on commit 490aae8

Please sign in to comment.