diff --git a/Gemfile.devel b/Gemfile.devel new file mode 100644 index 0000000..22972db --- /dev/null +++ b/Gemfile.devel @@ -0,0 +1,4 @@ +gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "feature/presxml-autonum" +gem "isodoc-i18n", git: "https://github.com/metanorma/isodoc-i18n", branch: "fix/markup-connectives" +gem "mn-requirements", git: "https://github.com/metanorma/mn-requirements", branch: "feature/presxml-autonum" + diff --git a/lib/isodoc/ietf/blocks.rb b/lib/isodoc/ietf/blocks.rb index 09e28f0..f2fb5aa 100644 --- a/lib/isodoc/ietf/blocks.rb +++ b/lib/isodoc/ietf/blocks.rb @@ -166,9 +166,11 @@ def formula_where(dlist, out) def formula_parse1(node, out) out.t **attr_code(anchor: node["id"]) do |p| parse(node.at(ns("./stem")), p) - lbl = @xrefs.anchor(node["id"], :label, false) - lbl.nil? or - p << " (#{lbl})" + if lbl = @xrefs.anchor(node["id"], :label, false) + lbl.gsub!(%r{]*>}, "") + /^\(.+?\)$/.match?(lbl) or lbl = "(#{lbl})" + p << " #{lbl}" + end end end diff --git a/lib/isodoc/ietf/inline.rb b/lib/isodoc/ietf/inline.rb index c252bae..50059e0 100644 --- a/lib/isodoc/ietf/inline.rb +++ b/lib/isodoc/ietf/inline.rb @@ -138,7 +138,8 @@ def eref_parse(node, out) section: eref_section(node), relative: eref_relative(node), sectionFormat: node["displayFormat"]) do |l| - linkend.each { |n| parse(n, l) } + linkend.map(&:text).join.strip.empty? or + linkend.each { |n| parse(n, l) } end end @@ -148,10 +149,11 @@ def eref_relative(node) end def eref_section(node) - @isodoc.eref_localities( + ret = @isodoc.eref_localities( node.xpath(ns("./locality | ./localityStack")), nil, node - )&.sub(/^,/, "")&.sub(/^\s*(Sections?|Clauses?)/, "")&.strip - &.sub(/,$/, "") || "" + ) or return "" + ret.gsub(%r{]*>}, "").sub(/^,/, "") + .sub(/^\s*(Sections?|Clauses?)/, "").strip.sub(/,$/, "") end def origin_parse(node, out) @@ -171,6 +173,10 @@ def index_parse(node, out) def bookmark_parse(node, out) out.bookmark nil, **attr_code(anchor: node["id"]) end + + def span_parse(node, out) + children_parse(node, out) + end end end end diff --git a/lib/isodoc/ietf/reqt.rb b/lib/isodoc/ietf/reqt.rb index 737348d..cd843ee 100644 --- a/lib/isodoc/ietf/reqt.rb +++ b/lib/isodoc/ietf/reqt.rb @@ -12,9 +12,9 @@ def recommendation_parse(node, out) end def recommendation_parse1(node, out) - recommendation_name(node.at(ns("./name")), out) + recommendation_name(node.at(ns("./fmt-name")), out) node.children.each do |n| - parse(n, out) unless n.name == "name" + parse(n, out) unless n.name == "fmt-name" end end diff --git a/lib/isodoc/ietf/xref.rb b/lib/isodoc/ietf/xref.rb index 4179599..2b2e410 100644 --- a/lib/isodoc/ietf/xref.rb +++ b/lib/isodoc/ietf/xref.rb @@ -7,12 +7,11 @@ def termnote_anchor_names(docxml) docxml.xpath(ns("//term[descendant::termnote]")).each do |t| c = IsoDoc::XrefGen::Counter.new notes = t.xpath(ns("./termnote")) - notes.each do |n| - next if n["id"].nil? || n["id"].empty? - + notes.noblank.each do |n| idx = notes.size == 1 ? "" : " #{c.increment(n).print}" @anchors[n["id"]] = - anchor_struct(idx, n, @labels["note_xref"], "note", false) + anchor_struct(idx, n, @labels["note_xref"], "note", + { container: true }) end end end diff --git a/spec/isodoc/blocks_spec.rb b/spec/isodoc/blocks_spec.rb index be13ebb..95a72fb 100644 --- a/spec/isodoc/blocks_spec.rb +++ b/spec/isodoc/blocks_spec.rb @@ -517,11 +517,9 @@ $$ r = 1 % $$ (1) @@ -797,18 +795,19 @@ Inherits: /ss/584/2015/level/1 - I recommend#{' '} + I recommend this . As for the measurement targets, The measurement target shall be measured as: - $$ r/1 = 0 $$ (1) - The following code will be run for verification: - - CoreRoot(success): HttpResponse if (success) recommendation(label: - success-response) end#{' '} - + $$ r/1 = 0 $$ (1) + The following code will be run for verification: + CoreRoot(success): HttpResponse + if (success) + recommendation(label: success-response) + end + diff --git a/spec/isodoc/lists_spec.rb b/spec/isodoc/lists_spec.rb index d95824a..ac31762 100644 --- a/spec/isodoc/lists_spec.rb +++ b/spec/isodoc/lists_spec.rb @@ -56,25 +56,26 @@ INPUT output = <<~OUTPUT #{XML_HDR} -
    -
  1. - all information necessary for the complete identification of the sample; +
      +
    1. + all information necessary for the complete identification of the sample;
      1. - a reference to this document (i.e. ISO 17301-1); + a reference to this document (i.e. ISO 17301-1);
        1. - the sampling method used; + the sampling method used;
    OUTPUT - expect(Xml::C14n.format(IsoDoc::Ietf::RfcConvert.new({}) - .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) + expect(strip_guid(Xml::C14n.format(IsoDoc::Ietf::RfcConvert.new({}) + .convert("test", input, true)))) + .to be_equivalent_to Xml::C14n.format(output) end it "processes Roman Upper ordered lists" do @@ -97,21 +98,22 @@ INPUT output = <<~OUTPUT #{XML_HDR} -
      -
    1. - all information necessary for the complete identification of the sample; +
        +
      1. + all information necessary for the complete identification of the sample;
      2. -
      3. - a reference to this document (i.e. ISO 17301-1); +
      4. + a reference to this document (i.e. ISO 17301-1);
      5. -
      6. - the sampling method used; +
      7. + the sampling method used;
      OUTPUT - expect(Xml::C14n.format(IsoDoc::Ietf::RfcConvert.new({}) - .convert("test", input, true))).to be_equivalent_to Xml::C14n.format(output) + expect(strip_guid(Xml::C14n.format(IsoDoc::Ietf::RfcConvert.new({}) + .convert("test", input, true)))) + .to be_equivalent_to Xml::C14n.format(output) end it "processes definition lists" do