diff --git a/isodoc.gemspec b/isodoc.gemspec index d490e43c..1a270824 100644 --- a/isodoc.gemspec +++ b/isodoc.gemspec @@ -55,5 +55,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "sassc", "~> 2.4.0" spec.add_development_dependency "simplecov", "~> 0.15" spec.add_development_dependency "timecop", "~> 0.9" + spec.add_development_dependency "xml-c14n" # spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/isodoc/metadata.rb b/lib/isodoc/metadata.rb index 2fb2363c..5afe1fcf 100644 --- a/lib/isodoc/metadata.rb +++ b/lib/isodoc/metadata.rb @@ -14,7 +14,7 @@ def l10n(expr, lang = @lang, script = @script, locale = @locale) end def initialize(lang, script, locale, i18n, fonts_options = {}) - @metadata = { lang: lang, script: script } + @metadata = { lang:, script: } DATETYPES.each { |w| @metadata["#{w.gsub('-', '_')}date".to_sym] = "XXX" } @lang = lang @script = script @@ -29,10 +29,6 @@ def get @metadata end - def labels - @labels - end - def set(key, value) @metadata[key] = value end @@ -44,12 +40,12 @@ def currlang end def doctype(isoxml, _out) - b = isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}"))&.text || return - set(:doctype, status_print(b)) - b1 = isoxml&.at(ns("//bibdata/ext/doctype#{currlang}"))&.text || b - set(:doctype_display, status_print(b1)) - b = isoxml&.at(ns("//bibdata/ext/subdoctype#{NOLANG}"))&.text || return - set(:subdoctype, status_print(b)) + b = isoxml.at(ns("//bibdata/ext/doctype#{NOLANG}")) || return + set(:doctype, status_print(b.text)) + b1 = isoxml.at(ns("//bibdata/ext/doctype#{currlang}")) || b + set(:doctype_display, status_print(b1.text)) + b = isoxml.at(ns("//bibdata/ext/subdoctype#{NOLANG}")) || return + set(:subdoctype, status_print(b.text)) end def docstatus(xml, _out) @@ -59,11 +55,11 @@ def docstatus(xml, _out) s1 = xml.at(ns("//bibdata/status/stage#{currlang}")) || s set(:stage, status_print(s.text)) s1 and set(:stage_display, status_print(s1.text)) - (i = xml&.at(ns("//bibdata/status/substage#{NOLANG}"))&.text) and + (i = xml.at(ns("//bibdata/status/substage#{NOLANG}"))&.text) and set(:substage, i) - (i1 = xml&.at(ns("//bibdata/status/substage#{currlang}"))&.text || i) and + (i1 = xml.at(ns("//bibdata/status/substage#{currlang}"))&.text || i) and set(:substage_display, i1) - (i2 = xml&.at(ns("//bibdata/status/iteration"))&.text) and + (i2 = xml.at(ns("//bibdata/status/iteration"))&.text) and set(:iteration, i2) set(:unpublished, unpublished(s.text)) unpublished(s.text) && set(:stageabbr, stage_abbr(s.text)) diff --git a/lib/isodoc/xref/xref_gen.rb b/lib/isodoc/xref/xref_gen.rb index 164c8bdd..cfeb3d00 100644 --- a/lib/isodoc/xref/xref_gen.rb +++ b/lib/isodoc/xref/xref_gen.rb @@ -137,15 +137,16 @@ def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list) c = Counter.new(list["start"] ? list["start"].to_i - 1 : 0) list.xpath(ns("./li")).each do |li| bare_label, label = - list_item_value(li, c, depth, { list_anchor: list_anchor, prev_label: prev_label, + list_item_value(li, c, depth, { list_anchor:, prev_label:, refer_list: depth == 1 ? refer_list : nil }) li["id"] and @anchors[li["id"]] = { label: bare_label, bare_xref: "#{label})", xref: "#{label})", - type: "listitem", refer_list: refer_list, + type: "listitem", refer_list:, container: list_anchor[:container] } (li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol| - list_item_anchor_names(ol, list_anchor, depth + 1, label, refer_list) + list_item_anchor_names(ol, list_anchor, depth + 1, label, + refer_list) end end end @@ -227,7 +228,7 @@ def bookmark_container(parent) def bookmark_anchor_names(xml) xml.xpath(ns(".//bookmark")).noblank.each do |n| _parent, id = id_ancestor(n) - #container = bookmark_container(parent) + # container = bookmark_container(parent) @anchors[n["id"]] = { type: "bookmark", label: nil, value: nil, xref: @anchors.dig(id, :xref) || "???", container: @anchors.dig(id, :container) } diff --git a/spec/isodoc/blocks_notes_spec.rb b/spec/isodoc/blocks_notes_spec.rb index 9a3c25ec..0fb5a965 100644 --- a/spec/isodoc/blocks_notes_spec.rb +++ b/spec/isodoc/blocks_notes_spec.rb @@ -105,12 +105,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(doc) end it "processes sequences of notes" do @@ -169,10 +169,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes multi-para notes" do @@ -205,8 +205,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes non-para notes" do @@ -280,10 +280,10 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(doc) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(doc) end it "processes paragraphs containing notes" do @@ -367,10 +367,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true)))).to be_equivalent_to xmlpp(html) - expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}) - .convert("test", input, true)))).to be_equivalent_to xmlpp(doc) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(strip_guid(IsoDoc::WordConvert.new({}) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(doc) end it "converts notes and admonitions intended for coverpage" do @@ -467,12 +467,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html) - expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}) - .convert("test", presxml, true)))).to be_equivalent_to xmlpp(doc) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true)))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(strip_guid(IsoDoc::WordConvert.new({}) + .convert("test", presxml, true)))).to be_equivalent_to Xml::C14n.format(doc) end it "numbers notes in tables and figures separately from notes outside them" do @@ -517,8 +517,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(output) end it "processes admonitions" do @@ -567,10 +567,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes empty admonitions" do @@ -596,8 +596,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) end it "processes admonitions with titles" do @@ -651,10 +651,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes box admonitions" do @@ -708,9 +708,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert + .new(presxml_options) + .convert("test", input, true)))) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))) + .to be_equivalent_to Xml::C14n.format(output) end end diff --git a/spec/isodoc/blocks_spec.rb b/spec/isodoc/blocks_spec.rb index 82b0a169..7b3c1704 100644 --- a/spec/isodoc/blocks_spec.rb +++ b/spec/isodoc/blocks_spec.rb @@ -244,12 +244,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true)) .sub(%r{.*}m, ""))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) end it "processes examples" do @@ -352,12 +352,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(doc) end it "processes sequences of examples" do @@ -401,8 +401,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(output) end it "processes formulae" do @@ -555,12 +555,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(word) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(word) end it "processes paragraph attributes" do @@ -626,10 +626,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true)))).to be_equivalent_to xmlpp(html) - expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}) - .convert("test", input, true)))).to be_equivalent_to xmlpp(word) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(strip_guid(IsoDoc::WordConvert.new({}) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(word) end it "processes blockquotes" do @@ -675,10 +675,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) end it "processes term domains" do @@ -710,8 +710,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))) - .to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}).convert("test", input, true))) + .to be_equivalent_to Xml::C14n.format(output) end it "processes permissions" do @@ -862,10 +862,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) end it "processes requirements" do @@ -981,10 +981,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes recommendation" do @@ -1104,11 +1104,11 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", presxml, true))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "processes passthrough with compatible format" do @@ -1124,9 +1124,9 @@ .new(presxml_options.merge(output_formats: { html: "html", rfc: "rfc" })) .convert("test", input, true) IsoDoc::HtmlConvert.new({}).convert("test", presxml, false) - expect(xmlpp(File.read("test.html") + expect(Xml::C14n.format(File.read("test.html") .gsub(%r{^.*

Foreword

}m, "") - .gsub(%r{.*}m, ""))).to be_equivalent_to xmlpp(<<~OUTPUT) + .gsub(%r{.*}m, ""))).to be_equivalent_to Xml::C14n.format(<<~OUTPUT) Hello OUTPUT end @@ -1179,8 +1179,8 @@ presxml = IsoDoc::PresentationXMLConvert .new(presxml_options.merge(output_formats: { html: "html", rfc: "rfc" })) .convert("test", input, true) - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true)))).to be_equivalent_to Xml::C14n.format(output) end it "ignores columnbreak" do @@ -1205,8 +1205,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(output) end it "processes toc" do @@ -1448,11 +1448,11 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end end diff --git a/spec/isodoc/cleanup_spec.rb b/spec/isodoc/cleanup_spec.rb index 3047164d..8e6fa45b 100644 --- a/spec/isodoc/cleanup_spec.rb +++ b/spec/isodoc/cleanup_spec.rb @@ -24,8 +24,8 @@ OUTPUT - expect(xmlpp(IsoDoc::WordConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((output)) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((output)) end it "cleans up figures" do @@ -54,8 +54,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((output)) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((output)) end it "cleans up figures (Word)" do @@ -84,8 +84,8 @@ OUTPUT - expect(xmlpp(IsoDoc::WordConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((output)) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((output)) end it "cleans up inline headers" do @@ -156,8 +156,8 @@ OUTPUT - expect(xmlpp(IsoDoc::WordConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((output)) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((output)) end it "cleans up footnotes" do @@ -201,8 +201,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((output)) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((output)) end it "cleans up footnotes (Word)" do @@ -275,8 +275,8 @@ OUTPUT - expect(xmlpp(IsoDoc::WordConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((output)) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((output)) end it "cleans up tables with tfoot" do @@ -441,8 +441,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((html)) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((html)) end it "cleans up tables without tfoot" do @@ -589,7 +589,7 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to xmlpp((html)) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .cleanup(Nokogiri::XML(input)).to_s)).to be_equivalent_to Xml::C14n.format((html)) end end diff --git a/spec/isodoc/figures_spec.rb b/spec/isodoc/figures_spec.rb index 497f8ef4..d2423833 100644 --- a/spec/isodoc/figures_spec.rb +++ b/spec/isodoc/figures_spec.rb @@ -225,17 +225,17 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true).gsub(/</, "<")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true)))).to be_equivalent_to Xml::C14n.format(html) FileUtils.rm_rf "spec/assets/odf1.emf" - expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}) + expect(Xml::C14n.format(strip_guid(IsoDoc::WordConvert.new({}) .convert("test", presxml, true) .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'") .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes subfigures" do @@ -346,17 +346,17 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true).gsub(/</, "<")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true)))).to be_equivalent_to Xml::C14n.format(html) FileUtils.rm_rf "spec/assets/odf1.emf" - expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}) + expect(Xml::C14n.format(strip_guid(IsoDoc::WordConvert.new({}) .convert("test", presxml, true) .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'") .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes figure classes" do @@ -433,9 +433,9 @@ OUTPUT - expect(strip_guid(xmlpp(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(strip_guid(Xml::C14n.format(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true).gsub(/</, "<")))) - .to be_equivalent_to xmlpp(presxml) + .to be_equivalent_to Xml::C14n.format(presxml) end it "processes raw SVG" do @@ -472,11 +472,11 @@ OUTPUT - expect(strip_guid(xmlpp(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(strip_guid(Xml::C14n.format(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .gsub(/</, "<") .gsub(%r{data:image/emf;base64,[^"']+}, "data:image/emf;base64")))) - .to be_equivalent_to xmlpp(presxml + .to be_equivalent_to Xml::C14n.format(presxml .gsub(%r{data:image/emf;base64,[^"']+}, "data:image/emf;base64")) end @@ -576,19 +576,19 @@ output = IsoDoc::PresentationXMLConvert .new(presxml_options.merge(output_formats: { html: "html", doc: "doc" })) .convert("test", input, true) - expect(strip_guid(xmlpp(output + expect(strip_guid(Xml::C14n.format(output .gsub(/</, "<") .sub(%r{.*.* OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes svgmap" do @@ -809,12 +809,12 @@ OUTPUT FileUtils.rm_rf("spec/assets/action_schemaexpg1.emf") FileUtils.rm_rf("spec/assets/action_schemaexpg2.emf") - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true)) .sub(%r{.*}m, "") .gsub(%r{"\.\\}, '"./') .gsub(%r{'\.\\}, "'./") .gsub(%r{data:image/emf;base64,[^"']+}, "data:image/emf;base64"))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end end diff --git a/spec/isodoc/footnotes_spec.rb b/spec/isodoc/footnotes_spec.rb index d3ea4a19..330015f8 100644 --- a/spec/isodoc/footnotes_spec.rb +++ b/spec/isodoc/footnotes_spec.rb @@ -123,11 +123,11 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", input, true) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}).convert("test", input, true))) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}).convert("test", input, true) .gsub(/_Ref\d+/, "_Ref"))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes IsoXML reviewer notes" do @@ -252,14 +252,14 @@ out = File.read("test.html").sub(/^.*
.*$}m, "
" ) - expect(xmlpp(out)).to be_equivalent_to xmlpp(html) + expect(Xml::C14n.format(out)).to be_equivalent_to Xml::C14n.format(html) FileUtils.rm_f "test.doc" IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }) .convert("test", input, false) out = File.read("test.doc").sub(/^.*.*$}m, "") - expect(xmlpp(out)).to be_equivalent_to xmlpp(word) + expect(Xml::C14n.format(out)).to be_equivalent_to Xml::C14n.format(word) end it "processes IsoXML reviewer notes spanning list" do @@ -383,13 +383,13 @@ out = File.read("test.html").sub(/^.*
.*$}m, "
" ) - expect(xmlpp(out)).to be_equivalent_to xmlpp(html) + expect(Xml::C14n.format(out)).to be_equivalent_to Xml::C14n.format(html) FileUtils.rm_f "test.doc" IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }) .convert("test", input, false) out = File.read("test.doc").sub(/^.*.*$}m, "") - expect(xmlpp(out)).to be_equivalent_to xmlpp(word) + expect(Xml::C14n.format(out)).to be_equivalent_to Xml::C14n.format(word) end end diff --git a/spec/isodoc/form_spec.rb b/spec/isodoc/form_spec.rb index f05bc5bc..0f79c052 100644 --- a/spec/isodoc/form_spec.rb +++ b/spec/isodoc/form_spec.rb @@ -155,9 +155,9 @@ DOC - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(doc) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(doc) end end diff --git a/spec/isodoc/i18n_spec.rb b/spec/isodoc/i18n_spec.rb index 75315a5f..d556b402 100644 --- a/spec/isodoc/i18n_spec.rb +++ b/spec/isodoc/i18n_spec.rb @@ -227,12 +227,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert .new(presxml_options).convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "defaults to English" do @@ -382,10 +382,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "processes French" do @@ -614,12 +614,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes Simplified Chinese" do @@ -867,12 +867,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes i18n file" do @@ -1172,16 +1172,16 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert .new({ i18nyaml: "spec/assets/i18n.yaml" } .merge(presxml_options)) .convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert .new({ i18nyaml: "spec/assets/i18n.yaml" }) .convert("test", presxml, true))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "internationalises locality" do @@ -1229,12 +1229,12 @@

OUTPUT - expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri::XML(IsoDoc::PresentationXMLConvert .new({ i18nyaml: "spec/assets/i18n.yaml" } .merge(presxml_options)) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) - .to be_equivalent_to xmlpp(presxml) + .to be_equivalent_to Xml::C14n.format(presxml) end it "processes LTR within RTL" do @@ -1360,10 +1360,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert .new(presxml_options).convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(presxml) + .to be_equivalent_to Xml::C14n.format(presxml) end private diff --git a/spec/isodoc/inline_spec.rb b/spec/isodoc/inline_spec.rb index 2a81603b..2bf6e9c8 100644 --- a/spec/isodoc/inline_spec.rb +++ b/spec/isodoc/inline_spec.rb @@ -57,14 +57,14 @@

OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true)) .sub(/^.*

.*$}m, "")) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true)) .sub(/^.*

.*$}m, "")) - .to be_equivalent_to xmlpp(doc) + .to be_equivalent_to Xml::C14n.format(doc) end it "processes dates" do @@ -89,8 +89,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(output) end it "ignores index entries" do @@ -118,8 +118,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(output) end it "processes concept markup" do @@ -352,10 +352,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes concept attributes" do @@ -470,10 +470,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes concept markup for symbols" do @@ -560,10 +560,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes embedded inline formatting" do @@ -593,8 +593,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes inline images" do @@ -623,8 +623,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes links" do @@ -666,8 +666,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes updatetype links" do @@ -703,14 +703,14 @@

OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true)) .sub(/^.*

.*$}m, "")) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true)) .sub(/^.*

.*$}m, "")) - .to be_equivalent_to xmlpp(doc) + .to be_equivalent_to Xml::C14n.format(doc) end it "processes unrecognised markup" do @@ -740,8 +740,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes AsciiMath and MathML" do @@ -783,9 +783,9 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true).sub(" OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "duplicates MathML with AsciiMath" do @@ -866,11 +866,11 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .gsub("", "")))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "overrides duplication of MathML with AsciiMath" do @@ -916,13 +916,13 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert .new({ suppressasciimathdup: true } .merge(presxml_options)) .convert("test", input, true) .gsub("", "")))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "processes eref types" do @@ -1008,11 +1008,11 @@ OUTPUT output = IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) - expect(xmlpp(strip_guid(Nokogiri::XML(output) + expect(Xml::C14n.format(strip_guid(Nokogiri::XML(output) .at("//xmlns:foreword").to_xml))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}) - .convert("test", output, true)))).to be_equivalent_to xmlpp(html) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(strip_guid(IsoDoc::HtmlConvert.new({}) + .convert("test", output, true)))).to be_equivalent_to Xml::C14n.format(html) end it "processes eref content" do @@ -1130,10 +1130,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) end it "processes eref content pointing to reference with citation URL" do @@ -1277,19 +1277,19 @@ OUTPUT output = IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) - expect(xmlpp(strip_guid(Nokogiri::XML(output) + expect(Xml::C14n.format(strip_guid(Nokogiri::XML(output) .at("//xmlns:foreword").to_xml))) - .to be_equivalent_to xmlpp(presxml) + .to be_equivalent_to Xml::C14n.format(presxml) xml = IsoDoc::HtmlConvert.new({}) .convert("test", output, true) - expect(xmlpp(Nokogiri::XML(xml) + expect(Xml::C14n.format(Nokogiri::XML(xml) .at("//div[h1/@class='ForewordTitle']").to_xml)) - .to be_equivalent_to xmlpp(html) + .to be_equivalent_to Xml::C14n.format(html) xml = IsoDoc::WordConvert.new({}) .convert("test", output, true) - expect(xmlpp(Nokogiri::XML(xml) + expect(Xml::C14n.format(Nokogiri::XML(xml) .at("//div[h1/@class='ForewordTitle']").to_xml)) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes eref content pointing to hidden bibliographic entries" do @@ -1463,12 +1463,12 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(word) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(word) end it "processes eref content with Unicode characters" do @@ -1503,8 +1503,8 @@ OUTPUT xml = Nokogiri::XML(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true)) - expect(xmlpp(strip_guid(xml.at("//xmlns:foreword").to_xml))) - .to be_equivalent_to xmlpp(presxml) + expect(Xml::C14n.format(strip_guid(xml.at("//xmlns:foreword").to_xml))) + .to be_equivalent_to Xml::C14n.format(presxml) end it "processes variant" do @@ -1571,10 +1571,10 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "processes add, del" do @@ -1604,8 +1604,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes formatting in eref/@citeas" do @@ -1642,8 +1642,8 @@ OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true)))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true)))).to be_equivalent_to Xml::C14n.format(output) end it "combines locality stacks with connectives" do @@ -1785,8 +1785,8 @@ 35810XYZ, Clauses 3 to 5 and 8 to 10 OUTPUT - expect(xmlpp(IsoDoc::PresentationXMLConvert.new(presxml_options) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::PresentationXMLConvert.new(presxml_options) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "processes ruby markup" do @@ -1847,17 +1847,17 @@ プロテゴ(まも)!

OUTPUT - expect(xmlpp(strip_guid(IsoDoc::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::PresentationXMLConvert .new(presxml_options.merge(output_formats: { html: "html", doc: "doc" })) .convert("test", input, true)) .sub(%r{.*}m, "") .sub(%r{.*}m, ""))) - .to be_equivalent_to xmlpp(presxml) - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", presxml, true))).to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(presxml) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", presxml, true))).to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", presxml, true) .sub(/^.*

.*$}m, ""))) - .to be_equivalent_to xmlpp(doc) + .to be_equivalent_to Xml::C14n.format(doc) end end diff --git a/spec/isodoc/lists_spec.rb b/spec/isodoc/lists_spec.rb index d11b303f..68dd801f 100644 --- a/spec/isodoc/lists_spec.rb +++ b/spec/isodoc/lists_spec.rb @@ -84,12 +84,12 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes unordered checklists" do @@ -179,12 +179,12 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes ordered lists" do @@ -299,12 +299,12 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes Roman Upper ordered lists" do @@ -351,9 +351,9 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end it "processes definition lists" do @@ -466,12 +466,12 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert.new({}) + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(word) + .to be_equivalent_to Xml::C14n.format(word) end it "processes nested definition lists (Word)" do @@ -559,8 +559,8 @@ OUTPUT - expect(xmlpp(IsoDoc::WordConvert.new({}) + expect(Xml::C14n.format(IsoDoc::WordConvert.new({}) .convert("test", input, true))) - .to be_equivalent_to xmlpp(output) + .to be_equivalent_to Xml::C14n.format(output) end end diff --git a/spec/isodoc/postproc_spec.rb b/spec/isodoc/postproc_spec.rb index 43e11018..c2c13997 100644 --- a/spec/isodoc/postproc_spec.rb +++ b/spec/isodoc/postproc_spec.rb @@ -368,8 +368,8 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert.new({}) - .convert("test", input, true))).to be_equivalent_to xmlpp(output) + expect(Xml::C14n.format(IsoDoc::HtmlConvert.new({}) + .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) end it "cleans up HTML output preface placeholder paragraphs" do @@ -405,7 +405,7 @@ INPUT html = Nokogiri::XML(File.read("test.html")).at("//body") html.xpath("//script").each(&:remove) - expect(strip_guid(xmlpp(html.to_xml))) + expect(strip_guid(Xml::C14n.format(html.to_xml))) .to be_equivalent_to <<~OUTPUT
@@ -453,8 +453,8 @@ INPUT html = Nokogiri::XML(File.read("test.html")) .at("//div[@id = 'toc']") - expect(strip_guid(xmlpp(html.to_xml))) - .to be_equivalent_to xmlpp(<<~OUTPUT) + expect(strip_guid(Xml::C14n.format(html.to_xml))) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)
  • @@ -506,7 +506,7 @@ .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") - expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~OUTPUT) + expect(Xml::C14n.format(html)).to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    Clause 4

    @@ -567,9 +567,9 @@ .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") expect(`ls test_*_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + expect(Xml::C14n.format(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) - .to be_equivalent_to xmlpp(<<~OUTPUT) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -617,9 +617,9 @@ .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") expect(`ls test_*_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + expect(Xml::C14n.format(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) - .to be_equivalent_to xmlpp(<<~OUTPUT) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -816,9 +816,9 @@ .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") expect(`ls test_*_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + expect(Xml::C14n.format(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) - .to be_equivalent_to xmlpp(<<~OUTPUT) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -858,9 +858,9 @@ .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") expect(`ls test_*_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + expect(Xml::C14n.format(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) - .to be_equivalent_to xmlpp(<<~OUTPUT) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -895,9 +895,9 @@ html = File.read("test.html") .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") - expect(xmlpp(html + expect(Xml::C14n.format(html .gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))) - .to be_equivalent_to xmlpp(<<~OUTPUT) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -930,9 +930,9 @@ html = File.read("spec/test.html") .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") - expect(xmlpp(html + expect(Xml::C14n.format(html .gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))) - .to be_equivalent_to xmlpp(<<~OUTPUT) + .to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -1020,7 +1020,7 @@ html = File.read("test.html") .sub(/^.*
    /m, '
    ') .sub(%r{
    .*$}m, "
    ") - expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~OUTPUT) + expect(Xml::C14n.format(html)).to be_equivalent_to Xml::C14n.format(<<~OUTPUT)

    @@ -1038,7 +1038,7 @@ word = File.read("test.doc") .sub(/^.*
    /m, '
    ') .sub(%r{

    \s*
    \s*

    \s*
    .*$}m, "") - expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~OUTPUT) + expect(Xml::C14n.format(word)).to be_equivalent_to Xml::C14n.format(<<~OUTPUT)


    @@ -1111,18 +1111,18 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert + expect(Xml::C14n.format(IsoDoc::HtmlConvert .new(wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test") .html_preface(Nokogiri::XML(input)).to_xml) .sub(/^.*

    .*$}m, "
    ")) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert .new(wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test") .word_cleanup(Nokogiri::XML(input)).to_xml) .sub(/^.*
    .*$}m, "
    ")) - .to be_equivalent_to xmlpp(doc) + .to be_equivalent_to Xml::C14n.format(doc) end it "cleans up coverpage note" do @@ -1184,18 +1184,18 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert + expect(Xml::C14n.format(IsoDoc::HtmlConvert .new(wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test") .html_preface(Nokogiri::XML(input)).to_xml) .sub(/^.*
    .*$}m, "
    ")) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert .new(wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test") .word_cleanup(Nokogiri::XML(input)).to_xml) .sub(/^.*
    .*$}m, "
    ")) - .to be_equivalent_to xmlpp(doc) + .to be_equivalent_to Xml::C14n.format(doc) end it "removes coverpage note destination if unused" do @@ -1253,18 +1253,18 @@ OUTPUT - expect(xmlpp(IsoDoc::HtmlConvert + expect(Xml::C14n.format(IsoDoc::HtmlConvert .new(wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test") .html_preface(Nokogiri::XML(input)).to_xml) .sub(/^.*
    .*$}m, "
    ")) - .to be_equivalent_to xmlpp(html) - expect(xmlpp(IsoDoc::WordConvert + .to be_equivalent_to Xml::C14n.format(html) + expect(Xml::C14n.format(IsoDoc::WordConvert .new(wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test") .word_cleanup(Nokogiri::XML(input)).to_xml) .sub(/^.*
    .*$}m, "
    ")) - .to be_equivalent_to xmlpp(doc) + .to be_equivalent_to Xml::C14n.format(doc) end it "generates bare HTML file" do @@ -1313,7 +1313,7 @@ .sub(%r{.*$}m, "") .gsub(%r{}m, "