diff --git a/Gemfile.devel b/Gemfile.devel new file mode 100644 index 0000000..60e80c0 --- /dev/null +++ b/Gemfile.devel @@ -0,0 +1,3 @@ +gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "feature/presentation-terms" +gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "fix/remove-asciimath2unitsml" +gem "mn-requirements", git: "https://github.com/metanorma/mn-requirements", branch: "main" diff --git a/lib/isodoc/ieee/presentation_terms.rb b/lib/isodoc/ieee/presentation_terms.rb index 734eca1..c9b0290 100644 --- a/lib/isodoc/ieee/presentation_terms.rb +++ b/lib/isodoc/ieee/presentation_terms.rb @@ -1,78 +1,172 @@ module IsoDoc module Ieee class PresentationXMLConvert < IsoDoc::PresentationXMLConvert - def multidef(elem) - # require "debug"; binding.b - number_multidef(elem) - collapse_multidef(elem) + def multidef(elem, defn, fmt_defn) + ctr = IsoDoc::XrefGen::Counter.new("@") + coll = defn.each_with_object([]) do |d, m| + ctr.increment(d) + ret = semx_fmt_dup(d) + ret.at(ns("./verbal-definition | ./non-verbal-definition")).elements + .first.add_first_child("(#{ctr.print}) ") + m << ret + end + #require "debug"; binding.b + fmt_defn << coll.map { |c| to_xml(c) }.join(" ") + #coll.each { |x| unwrap_definition1(x) } + #fmt_defn << unwrap_multidef(coll) end - def number_multidef(elem) - c = IsoDoc::XrefGen::Counter.new("@") - elem.xpath(ns("./definition")).each do |d| - c.increment(d) - d.elements.first.add_first_child "(#{c.print}) " + def unwrap_multidef(coll) + if coll.all? do |c| + c.elements.size == 1 && c.elements.first.name == "p" + end + ret = coll.map do |c| + c.children = c.elements.first.children + end + return "

#{ret.map { |x| to_xml(x) }.join}

" end + coll.map { |c| to_xml(c.children) }.join(" ") end - def collapse_multidef(elem) - ins = elem.at(ns("./definition")).previous_element - coll = elem.xpath(ns("./definition")) - coll.each(&:remove) - ins.next = "#{unwrap_multidef(coll)}" +=begin + def unwrap_definition(elem) + elem.xpath(ns("./definition")).each do |d| + %w(verbal-definition non-verbal-representation).each do |e| + v = d&.at(ns("./#{e}")) + v&.replace(v.children) + end end + end - def unwrap_multidef(coll) - if coll.all? do |c| - c.elements.size == 1 && c.elements.first.name == "p" - end - ret = coll.map { |c| to_xml(c.elements.first.children) } - return "

#{ret.join}

" + to + + def unwrap_definition(_elem, fmt_defn) + fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d| + %w(verbal-definition non-verbal-representation).each do |e| + v = d&.at(ns("./#{e}")) + v&.replace(v.children) end - coll.map { |c| to_xml(c.children) }.join end + en + +=end + +def designation(docxml) + super +end + +def deprecates(desgn) + desgn.remove +end + + def designation_boldface(desgn) + #desgn["element"] == "preferred" or return + name = desgn.at(ns("./expression/name | ./letter-symbol/name")) or return + name.children = "#{name.children}" + end def unwrap_definition(docxml) docxml.xpath(ns(".//definition/verbal-definition")).each do |v| v.elements.all? { |e| %w(termsource p).include?(e.name) } or next p = v.xpath(ns("./p")) s = v.xpath(ns('./termsource')) - s.empty? or - s = " (#{s.map { |x| to_xml(x) }.join("\n")})" + s.empty? or s = " (#{s.map { |x| to_xml(x) }.join("\n")})" v.children = "

#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}#{s}

" end super end + def unwrap_definition(_elem, fmt_defn) + fmt_defn.xpath(ns(".//semx[@element = 'definition']")).each do |d| + unwrap_definition1(d) + end + end + + def unwrap_definition1(d) + %w(verbal-definition non-verbal-representation).each do |e| + v = d.at(ns("./#{e}")) or next + if v.elements.all? { |e| %w(termsource p).include?(e.name) } + p = v.xpath(ns("./p")) + s = v.xpath(ns('./termsource')) + s.empty? or s = " (#{s.map { |x| to_xml(x) }.join()})" + v.children = + "#{p.map(&:children).map { |x| to_xml(x) }.join("\n")}#{s}" + else + s = v.xpath(ns('./termsource')) + unless s.empty? + s[0].previous = " (" + s[-1].next = ")" + end + end + v.replace(v.children) + end + end + + def related_designation1(desgn) + super + end + def related(docxml) - docxml.xpath(ns("//term[related]")).each { |f| related_term(f) } + insert_related_type(docxml) + admitted_to_related docxml + term_reorder(docxml) + docxml.xpath(ns("//term[fmt-related/semx]")).each { |f| related_term(f) } + end + + # temporarily insert related/@type to fmt-related/semx, for sorting + def insert_related_type(docxml) + docxml.xpath(ns("//fmt-related/semx")).each do |r| + orig = semx_orig(r) + r["type"] = orig["type"] + end end def related_term(term) - coll = term_related_reorder(term.xpath(ns("./related"))) - term_related_collapse(coll) + #require "debug"; binding.b + #coll = term_related_reorder(term.xpath(ns("./fmt-related/semx"))) + r = term.at(ns("./fmt-related")) + r.xpath(ns(".//xref | .//eref | .//termref")).each(&:remove) + coll = sort_related(r.xpath(ns("./semx"))) + r.children = term_related_collapse(coll) end def term_related_collapse(coll) prev = 0 + coll[0].wrap("

") coll[1..-1].each_with_index do |r, i| if coll[prev]["type"] != r["type"] - prev = i and next + prev = i + r.wrap("

") + next end - coll[prev].at(ns("./preferred")) << "; #{to_xml(r.at(ns('./preferred')) - .children)}" + #coll[prev].at(ns("./preferred")) << "; #{to_xml(r.at(ns('./preferred')) + #.children)}" + coll[prev] << "; #{to_xml(r)}" r.remove end end + def term_related_collapse(coll) + prev = 0 + ret = [[coll[0]]] + coll[1..-1].each do |r| + if ret[-1][0]["type"] != r["type"] + ret << [r] + next + end + ret[-1] << r + end + ret.map { |x| x.map { |y| to_xml(y) }.join("; ") }.map { |x| "

#{x}

" }.join("\n") + end + def sort_terms_key(term) d = term.at(ns("./preferred/expression/name | " \ "./preferred/letter-symbol/name | " \ "./preferred/graphical-symbol/figure/name | " \ "./preferred/graphical-symbol/figure/@id | " \ - "./preferred")) + "./preferred | ./fmt-preferred//semx")) f = term.at(ns("./field-of-application")) || term.at(ns("./domain")) @c.decode("#{sort_terms_key1(d)} :: #{sort_terms_key1(f)}") end @@ -84,6 +178,7 @@ def sort_terms_key1(elem) dup.text&.strip&.downcase || "zzzz" end + #KILL def term_related_reorder(coll) ins = coll.first.previous_element ret = sort_related(coll) @@ -109,24 +204,28 @@ def sort_related_key(related) "#{type} :: #{sort_terms_key(related)}" end - def terms(docxml) - admitted_to_related docxml - super + def termcleanup(docxml) collapse_term docxml + docxml.xpath(ns("//term//semx[@type]")).each { |x| x.delete("type") } # temp attribute from insert_related_type + super end def admitted_to_related(docxml) docxml.xpath(ns("//term")).each do |t| - t.xpath(ns("./admitted | ./preferred")).each_with_index do |a, i| + t.xpath(ns("./fmt-admitted/semx | ./fmt-preferred/semx")).each_with_index do |a, i| + orig = semx_orig(a) (i.zero? || - a.at(ns("./abbreviation-type | ./graphical-symbol"))) and next - admitted_to_related1(a, t.at(ns("./preferred"))) + orig.at(ns("./abbreviation-type | ./graphical-symbol"))) and next + out = t.at(ns("./fmt-related")) || t.at(ns("./definition")).before("").previous + admitted_to_related1(a, t.at(ns("./fmt-preferred/semx")), out) + a.parent.name == "fmt-preferred" and a.remove end + t.at(ns("./fmt-admitted"))&.remove end - term_reorder(docxml) + #term_reorder(docxml) end - def admitted_to_related1(adm, pref) + def admitted_to_related1(adm, pref, out) new = adm.dup adm["type"] = "equivalent" adm.name = "related" @@ -137,6 +236,33 @@ def admitted_to_related1(adm, pref) TERM end + def admitted_to_related1(adm, pref, out) + out << <<~TERM +#{to_xml(adm)}

+TERM + out.parent.next = <<~TERM + #{to_xml(adm)} + + #{to_xml(pref)} + + + TERM + end + + #KILL + def related1(node) + require "debug"; binding.b + p, ref, orig = related1_prep(node) + label = @i18n.relatedterms[orig["type"]].upcase + if p + node.children =(l10n("

#{label}: " \ + "#{to_xml(p)}

")) + else + node.children = (l10n("

#{label}: " \ + "**RELATED TERM NOT FOUND**

")) + end + end + def term_reorder(xmldoc) xmldoc.xpath(ns("//terms")).each { |t| term_reorder1(t) } end @@ -155,19 +281,35 @@ def sort_terms(terms) end end + def termcontainers(docxml) + super + docxml.xpath(ns("//term[not(./fmt-definition)]")).each do |t| + t << "" + end + end + def collapse_term(docxml) docxml.xpath(ns("//term")).each { |t| collapse_term1(t) } end def collapse_term1(term) + #pref = term.xpath(ns("./fmt-preferred//semx")).each_with_index.with_object([]) do |(a, i), m| + #orig = semx_orig(a, term) +#if i.zero? || orig.at(ns("./abbreviation-type | ./graphical-symbol")) + #m << a +#end + #end + ret = collapse_term_template( - pref: term.at(ns("./preferred"))&.remove, - def: term.at(ns("./definition")), - rels: term.xpath(ns("./related")).map(&:remove), - source: term.at(ns("./termsource")), + pref: term.at(ns("./fmt-preferred")), + def: term.at(ns("./fmt-definition")), + rels: term.at(ns("./fmt-related"))&.remove, + source: term.at(ns("./fmt-termsource"))&.remove, ) - (ins = term.elements.first and ins.previous = ret) or - term << ret + term.at(ns("./fmt-preferred"))&.remove + term.at(ns("./fmt-admitted"))&.remove + ins = term.at(ns("./fmt-definition")) and + ins.children = ret end def collapse_term_related(rels) @@ -180,29 +322,71 @@ def collapse_term_related(rels) ret end + def collapse_term_related(rels) + rels or return + rels.xpath(ns("./p")).each do |p| + #require "debug"; binding.b + orig = p.at(ns(".//semx[@element = 'related']")) + reln = "#{@i18n.relatedterms[orig['type']]}: " + p.add_first_child reln + p.xpath(ns(".//semx[@element = 'related']")).each do |r| + r.at(ns("./fmt-preferred")) or r.add_first_child "**RELATED TERM NOT FOUND**" + end + end + ret = rels.xpath(ns("./p")).map { |x| to_xml(x.children).strip }.join(". ") + ret += "." unless ret.empty? + ret + end + def collapse_term_template(opt) - defn = collapse_unwrap_definition(opt[:def]) + defn, multiblock = collapse_unwrap_definition(opt[:def]) + #require "debug"; binding.b src = nil opt[:source] and src = "(#{to_xml(opt[:source].remove.children).strip})" - t = opt[:pref] ? to_xml(opt[:pref].children) : "**TERM NOT FOUND**" + t = collapse_term_pref(opt) + #require "debug"; opt[:pref].nil? and binding.b + #require "debug"; opt[:rels].empty? or binding.b + tail = "#{collapse_term_related(opt[:rels])} #{src}" + if multiblock + tail = tail.strip.empty? ? "" : "

#{tail}

" + <<~TERM +

#{t}:

#{defn}#{tail} + TERM + else <<~TERM -

#{t}: #{defn} #{collapse_term_related(opt[:rels])} #{src}

+

#{t}: #{defn} #{tail}

TERM + end + end + + def collapse_term_pref(opt) + p = opt[:pref] + p.text.strip.empty? and return "**TERM NOT FOUND**" + s = p.xpath(ns(".//semx[@element = 'termsource']")) + unless s.empty? + s[0].previous = " (" + s[-1].next = ")" + end + p.xpath(ns(".//fmt-termsource")).each { |x| x.replace(x.children) } + to_xml(p.children).strip + end def collapse_unwrap_definition(defn) - defn.nil? and return nil - s = defn.remove.xpath(ns("./termsource")) - p = defn.at(ns("./p")) + #require "debug"; binding.b + defn.nil? and return nil, nil + s = defn.xpath(ns(".//fmt-termsource")) + p = defn.at(ns(".//p")) !s.empty? && p and p << s.map(&:remove).map(&:children) .map { |x| to_xml(x) }.join - if defn.elements.size == 1 && defn.elements.first.name == "p" - defn.elements.first.children - else defn.elements - end + # fmt-definition/semx/p + elems = defn.at(ns("./semx")) || defn + multiblock = elems.at(ns("./table | ./formula | ./dl | ./ol | ./ul")) || elems.xpath(ns("./p")).size > 1 + [defn.elements, multiblock] end - def termsource1(elem) + # KILL + def termsource1xx(elem) while elem&.next_element&.name == "termsource" elem << "; #{to_xml(elem.next_element.remove.children)}" end @@ -210,6 +394,12 @@ def termsource1(elem) elem.children = l10n("#{adapt}#{to_xml(elem.children).strip}") end + def termsource_label(elem, sources) + adapt = termsource_adapt(elem["status"]) and + sources = "#{adapt}#{sources}" + elem.replace(l10n(sources)) + end + def termsource_adapt(status) case status when "adapted" then @i18n.adapted_from @@ -217,17 +407,17 @@ def termsource_adapt(status) end # domain is rendered in designation_field instead - def termdomain(elem) - d = elem.at(ns(".//domain")) or return - d["hidden"] = "true" + def termdomain(elem, domain) + #d = elem.at(ns(".//domain")) or return + #d["hidden"] = "true" end - # TODO wrap domain not in , but or equivalent - def designation_field(desgn, name) - if desgn.name == "preferred" - f = desgn.xpath(ns("./../domain | ./../subject")).map(&:remove) - .map { |u| to_xml(u.children) }.join(", ") - name << ", <#{f}>" unless f.empty? + def designation_field(desgn, name, orig) + if desgn["element"] == "preferred" + f = orig.parent.xpath(ns("./domain | ./subject")) + .map { |u| to_xml(semx_fmt_dup(u)) }.join(", ") + #require 'debug'; binding.b + name << ", <#{f}>" unless f.empty? end super end @@ -244,6 +434,27 @@ def merge_second_preferred(term) pref << " (#{tail})" end + def merge_second_preferred(term) + term.name == "fmt-admitted" and return + pref = + term.parent.at(ns("./preferred[not(abbreviation-type)][expression/name]")) + x = term.parent.xpath(ns("./preferred[expression/name][abbreviation-type] | " \ + "./admitted[expression/name][abbreviation-type]")) + (pref && !x.empty?) or return +fmt_pref = term.parent.at(ns(".//semx[@source = '#{pref['id']}']")) +fdf = fmt_pref.at(ns(".//span[@class = 'fmt-designation-field']"))&.text + out = to_xml(fmt_pref) + tail = x.map do |p| + #require "debug"; binding.b + ret = term.parent.at(ns(".//semx[@source = '#{p['id']}']")).remove + fdf1 = ret.at(ns(".//span[@class = 'fmt-designation-field']")) + fdf1 && (fdf1&.text == fdf) and fdf1.remove # repetition of domain suppressed + to_xml(ret).strip + end.join(", ") + out += " (#{tail})" + term.children = out + end + def termnote1(elem) lbl = termnote_label(elem) prefix_name(elem, { label: block_delim }, lower2cap(lbl), "name") @@ -258,7 +469,7 @@ def term(docxml); end def concept1(node) concept_render(node, ital: "false", ref: "false", bold: "false", - linkref: "false", linkmention: "false") + linkref: "false", linkmention: "false") end end end diff --git a/lib/metanorma/ieee/biblio.rng b/lib/metanorma/ieee/biblio.rng index 71191b2..66c553a 100644 --- a/lib/metanorma/ieee/biblio.rng +++ b/lib/metanorma/ieee/biblio.rng @@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/ An identifier of the person according to an international identifier scheme - + Contact information for the person, including URI, address, phone number, and email - + @@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega An identifier of the organization according to an international identifier scheme - + Contact information for the organization, including address, phone number, and email - + A logo for the organization @@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega Contact information for a person or organization - + + + + + + + - + The phone number associated with a person or organization diff --git a/spec/isodoc/section_spec.rb b/spec/isodoc/section_spec.rb index c422801..b9180b8 100644 --- a/spec/isodoc/section_spec.rb +++ b/spec/isodoc/section_spec.rb @@ -221,12 +221,21 @@ . 1 - -

- Term2 - : -

-
+ + + + Term2 + + + +

+ + Term2 + + : +

+
+
Acronyms and abbreviations diff --git a/spec/isodoc/terms_spec.rb b/spec/isodoc/terms_spec.rb index 01ff1a5..892c4a5 100644 --- a/spec/isodoc/terms_spec.rb +++ b/spec/isodoc/terms_spec.rb @@ -75,247 +75,391 @@ INPUT presxml = <<~PRESXML - - - - Contents - - - -

??? for ???

- - Terms and Definitions - - - 1 - . - - - - - Terms and Definitions - - - Clause - 1 - -

For the purposes of this document, the following terms and definitions apply.

- -

- paddy - , <rice>, <in agriculture, dated>: rice retaining its husk after threshing ( - - - 3.1 - - ISO  - 7301 - : - 2011 - , 3.1 - - , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here) -

- - - - - Example - 1 - - - - : - - - - Example - 1 - - - - Clause - 1 - . - 1 - - , - Example - 1 - -

Foreign seeds, husks, bran, sand, dust.

-
    -
  • A
  • -
-
- - - - - Example - 2 - - - - : - - - - Example - 2 - - - - Clause - 1 - . - 1 - - , - Example - 2 - -
    -
  • A
  • -
-
- - adapted from - - t1 - - , adapted ; - - - - , adapted — with adjustments - -
- -

- paddy - : rice retaining its husk after threshing - Syn: - paddy rice - , <in agriculture>; - rough rice - . ( - - - 3.1 - - ISO  - 7301 - : - 2011 - , 3.1 - - ) -

- DEPRECATED: cargo rice - - - - - Example - - - - : - - - - Example - - - - Clause - 1 - . - 2 - - , - Example - -
    -
  • A
  • -
-
- - - - NOTE - 1 - - - - - Note - 1 - - - - Clause - 1 - . - 2 - - , - Note - 1 - -

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

-
- - - - NOTE - 2 - - - - - Note - 2 - - - - Clause - 1 - . - 2 - - , - Note - 2 - -
    -
  • A
  • -
-

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

-
-
- -

- paddy rice - , <in agriculture>: - See: - paddy - . -

-
- -

- rough rice - : - See: - paddy - . -

-
-
-
-
+ + + + Contents + + + +

??? for ???

+ + Terms and Definitions + + + 1 + . + + + + + Terms and Definitions + + + Clause + 1 + +

For the purposes of this document, the following terms and definitions apply.

+ + + + paddy + + in agriculture + dated + + + + 3.1 + + + +

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

+
+
+
+ rice + + +

rice retaining its husk after threshing

+
+
+ +

+ + paddy + + , < + rice + > + + + , < + in agriculture + , + dated + > + + + ( + + + + 3.1 + + ISO  + 7301 + : + 2011 + , 3.1 + + , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here + + ): + rice retaining its husk after threshing + (adapted from + + + t1 + + , adapted + + ; + + + + + , adapted — with adjustments + + ) +

+
+ + + + + Example + 1 + + + + : + + + + Example + 1 + + + + Clause + 1 + . + 1 + + , + Example + 1 + +

Foreign seeds, husks, bran, sand, dust.

+
    +
  • A
  • +
+
+ + + + + Example + 2 + + + + : + + + + Example + 2 + + + + Clause + 1 + . + 1 + + , + Example + 2 + +
    +
  • A
  • +
+
+ + + t1 + + +

+ + + + + + + +

with adjustments

+
+
+
+ + + + paddy + + + + + paddy rice + + in agriculture + + + + rough rice + + + + + cargo rice + + + + +

rice retaining its husk after threshing

+
+
+ +

+ + paddy + + : + rice retaining its husk after threshing + Syn: + + + + paddy rice + + , < + in agriculture + > + + + + + ; + + + + rough rice + + + + . ( + + + + 3.1 + + ISO  + 7301 + : + 2011 + , 3.1 + + + ) +

+
+ + + + + Example + + + + : + + + + Example + + + + Clause + 1 + . + 2 + + , + Example + +
    +
  • A
  • +
+
+ + + + NOTE + 1 + + + + + Note + 1 + + + + Clause + 1 + . + 2 + + , + Note + 1 + +

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

+
+ + + + NOTE + 2 + + + + + Note + 2 + + + + Clause + 1 + . + 2 + + , + Note + 2 + +
    +
  • A
  • +
+

The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

+
+ + + + 3.1 + + + +
+ + +

+ + paddy rice + + , < + in agriculture + > + + + : + See: + + + + paddy + + + + . +

+
+
+ + +

+ + rough rice + + : + See: + + + + paddy + + + + . +

+
+
+
+
+
PRESXML html = <<~"OUTPUT" @@ -327,12 +471,12 @@

paddy - , <rice>, <in agriculture, dated>: rice retaining its husk after threshing ( + , <rice>, <in agriculture, dated> ( ISO  7301 : 2011 - , 3.1, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here) + , 3.1, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here): rice retaining its husk after threshing (adapted from t1, adapted; Termbase IEV, term ID xyz, adapted — with adjustments)

@@ -357,14 +501,6 @@

-

adapted from t1, adapted - - - - ; - Termbase IEV, term ID xyz, adapted - — - with adjustments

paddy @@ -380,7 +516,6 @@ 2011 , 3.1)

-

DEPRECATED: cargo rice

Example @@ -464,12 +599,12 @@

paddy - , <rice>, <in agriculture, dated>: rice retaining its husk after threshing ( + , <rice>, <in agriculture, dated> ( ISO  7301 : 2011 - , 3.1, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here) + , 3.1, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here): rice retaining its husk after threshing (adapted from t1, adapted; Termbase IEV, term ID xyz, adapted — with adjustments)

@@ -494,14 +629,6 @@

-

adapted from t1, adapted - - - - ; - Termbase IEV, term ID xyz, adapted - — - with adjustments

paddy @@ -517,7 +644,6 @@ 2011 , 3.1)

-

DEPRECATED: cargo rice

Example @@ -634,7 +760,7 @@ INPUT output = <<~OUTPUT - + Contents @@ -648,11 +774,11 @@ 1 . - - - - - Definitions + + + + + Definitions Clause @@ -672,17 +798,26 @@

-

- prozac - : -

+ + + prozac + + + +

+ + prozac + + : +

+
-

- - - - + + + + + x @@ -691,20 +826,53 @@ 1 - - - \\mathbf{x_{1}} - mathbf(x_(1)) - - - : -

+ + x_{1} + x_(1) + + + + + +

+ + + + + + + + x + + + 1 + + + + + \\mathbf{x_{1}} + mathbf(x_(1)) + + + + : +

+
-

- Xanax - : -

+ + + Xanax + + + +

+ + Xanax + + : +

+
@@ -742,7 +910,7 @@ INPUT presxml = <<~PRESXML - + Contents @@ -768,28 +936,70 @@

For the purposes of this document, the following terms and definitions apply.

-

- paddy - , <rice>: rice retaining its husk after threshing, mark 2 rice retaining its husk after threshing, mark 3 ( - - - - 3.1 - - ISO  - 7301 - : - 2011 - , 3.1 - - , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here - - ) ( + + + paddy + + + rice + + +

rice retaining its husk after threshing, mark 2

+

rice retaining its husk after threshing, mark 3

+ + + + 3.1 + + + +

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

+
+
+ + + +

+ + paddy + + , < + rice + > + + + : + + rice retaining its husk after threshing, mark 2 rice retaining its husk after threshing, mark 3 ( + + + + 3.1 + + ISO  + 7301 + : + 2011 + , 3.1 + + , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here + + ) + + ( + + + t1 + + + ) +

+
+ t1 - ) -

+
@@ -872,40 +1082,91 @@

For the purposes of this document, the following terms and definitions apply.

-

- paddy - , <rice>: - (A) -  rice retaining its - - husk - - after threshing - (B) -  rice retaining its husk after threshing, mark 2 ( - - - - 3.1 - - ISO  - 7301 - : - 2011 - , 3.1 - - , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here - - ) ( - - t1 - - ; - - - - , modified — with adjustments) -

+ + + paddy + + + rice + + +

+ rice retaining its + + husk + + after threshing +

+
+
+ + +

rice retaining its husk after threshing, mark 2

+ + + + 3.1 + + + +

The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here

+
+
+
+
+ +

+ + paddy + + , < + rice + > + + + : + + (A) +  rice retaining its + + husk + + after threshing + + + (B) +  rice retaining its husk after threshing, mark 2 ( + + + + 3.1 + + ISO  + 7301 + : + 2011 + , 3.1 + + , modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here + + ) + + ( + + + t1 + + + ; + + + + + , modified — with adjustments + + ) +

+
@@ -969,6 +1230,19 @@
  • A
  • + + + t1 + + + + + + + +

    with adjustments

    +
    +
    @@ -1031,11 +1305,11 @@ 1 . - - - - - Terms and Definitions + + + + + Terms and Definitions Clause @@ -1043,22 +1317,57 @@

    For the purposes of this document, the following terms and definitions apply.

    -

    - paddy - , <rice>: - (A) -  rice retaining its husk after threshing - (B) -  rice retaining its husk after threshing, mark 2 ( - - t1 - - ; - - - - , modified — with adjustments) -

    + + + paddy + + + rice + + +

    rice retaining its husk after threshing

    +
    +
    + + +

    rice retaining its husk after threshing, mark 2

    +
    +
    + +

    + + paddy + + , < + rice + > + + + : + + (A) +  rice retaining its husk after threshing + + + (B) +  rice retaining its husk after threshing, mark 2 + + ( + + + t1 + + + ; + + + + + , modified — with adjustments + + ) +

    +
    @@ -1075,17 +1384,17 @@ Example 1 - - - Clause - 1 - . - 1 - - , - Example - 1 - + + + Clause + 1 + . + 1 + + , + Example + 1 +

    Foreign seeds, husks, bran, sand, dust.

    • A
    • @@ -1107,21 +1416,34 @@ Example 2 - - - Clause - 1 - . - 1 - - , - Example - 2 - + + + Clause + 1 + . + 1 + + , + Example + 2 +
      • A
      + + + t1 + + + + + + + +

      with adjustments

      +
      +
      @@ -1193,99 +1515,385 @@ 1 . - - - - - Terms and Definitions + + + + + Terms and Definitions Clause 1 -

      - A - , <rice>: rice retaining its husk after threshing - Syn: - B - . -

      + + + A + + + + + B + + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + A + + , < + rice + > + + + : + rice retaining its husk after threshing + Syn: + + + + B + + , < + rice + > + + + + + . +

      +
      -

      - B - : - See: - A - . -

      + +

      + + B + + , < + rice + > + + + : + See: + + + + A + + , < + rice + > + + + + + . +

      +
      -

      - C (D) - , <rice>: rice retaining its husk after threshing -

      + + + C + + + + + D + + initialism + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + C + + , < + rice + > + + + ( + + D + + ): + rice retaining its husk after threshing +

      +
      -

      - E - , <rice>: rice retaining its husk after threshing - Syn: - F - . -

      + + + E + + + + + F + + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + E + + , < + rice + > + + + : + rice retaining its husk after threshing + Syn: + + + + F + + + + . +

      +
      -

      - F - : - See: - E - . -

      + +

      + + F + + : + See: + + + + E + + , < + rice + > + + + + + . +

      +
      -

      - G (H) - , <rice>: rice retaining its husk after threshing -

      + + + G + + + + + H + + initialism + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + G + + , < + rice + > + + + ( + + H + + ): + rice retaining its husk after threshing +

      +
      -

      - I - , <rice>, US: rice retaining its husk after threshing - Syn: - J - . -

      + + + I + + + + + J + + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + I + + , < + rice + > + + , US + + : + rice retaining its husk after threshing + Syn: + + + + J + + , < + rice + > + + + + + . +

      +
      -

      - J - : - See: - I - . -

      + +

      + + J + + , < + rice + > + + + : + See: + + + + I + + , < + rice + > + + , US + + + + . +

      +
      -

      - K - , <rice>, eng: rice retaining its husk after threshing - Syn: - L - , fra. -

      + + + K + + + + + L + + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + K + + , < + rice + > + + , eng + + : + rice retaining its husk after threshing + Syn: + + + + L + + , < + rice + > + + , fra + + + + . +

      +
      -

      - L - , fra: - See: - K - , eng. -

      + +

      + + L + + , < + rice + > + + , fra + + : + See: + + + + K + + , < + rice + > + + , eng + + + + . +

      +
      @@ -1343,33 +1951,108 @@ 1 . - - - - - Terms and Definitions + + + + + Terms and Definitions Clause 1 -

      - muddy rice - , n, noun: - See: - paddy - , m, f, sg, noun, en Latn, /pædiː/. -

      + +

      + + muddy rice + + , < + rice + > + + , n, noun + + : + See: + + + + paddy + + , < + rice + > + + , m, f, sg, noun, en Latn US, /pædiː/ + + + + . +

      +
      -

      - paddy - , <rice>, m, f, sg, noun, en Latn US, /pædiː/: rice retaining its husk after threshing - Syn: - muddy rice - , n, noun. -

      + + + paddy + pædiː + + masculine + feminine + singular + false + true + irregular declension + + + + + + muddy rice + + neuter + true + irregular declension + + + + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + paddy + + , < + rice + > + + , m, f, sg, noun, en Latn US, /pædiː/ + + : + rice retaining its husk after threshing + Syn: + + + + muddy rice + + , < + rice + > + + , n, noun + + + + . +

      +
      @@ -1399,7 +2082,7 @@ INPUT presxml = <<~PRESXML - + Contents @@ -1413,36 +2096,69 @@ 1 . - - - - - Terms and Definitions + + + + + Terms and Definitions Clause 1 -

      - - , <rice>: rice retaining its husk after threshing -

      - -
      - - - Figure - 1 - - - - Figure - 1 - -
      <LITERAL> FIGURATIVE
      -
      + + + + + + +
      +
      <LITERAL> FIGURATIVE
      +
      +
      +
      + rice + + +

      rice retaining its husk after threshing

      +
      +
      + +

      + + + + , < + rice + > + + + +

      + + + Figure + 1 + + + + Figure + 1 + +
      <LITERAL> FIGURATIVE
      +
      + + , < + rice + > + + + : + rice retaining its husk after threshing +

      +
      @@ -1544,7 +2260,7 @@
      INPUT presxml = <<~PRESXML - + Contents @@ -1558,11 +2274,11 @@ 1 . - - - - - Terms and definitions + + + + + Terms and definitions Clause @@ -1570,111 +2286,203 @@

      For the purposes of this document, the following terms and definitions apply.

      -

      - Term 2 - : -

      - - + + + Term 2 + + + + +
      +
      Literal
      +
      + + + + x + = + y + + x = y + x = y + + + + + + + 3 + + + + +
      +
      + +

      + + Term 2 + + : +

      + +
      + + + Figure + 1 + + + Figure 1 - - - - Figure - 1 - -
      Literal
      -
      - - - + +
      Literal
      +
      + + + + ( + 1 + ) + + + + Equation ( - 1 + 1 ) - - - - Equation - ( - 1 - ) - - - - x - = - y - - x = y - x = y - - - - - - - 3 - - - , Section 3 - - -

      + + + + x + = + y + + x = y + x = y + + + ( + + + + + 3 + + + , Section 3 + + + ) + +
      -

      - Term - : + + + Term + + + + +

      Definition

      + + + + + 1 + + + + + + + + + + + + + + + + + + + +
      AB
      CD
      +
      + +

      + + Term + + : +

      + Definition ( - - - - - 1 - - - , Section 1 - - + + + + + 1 + + + , Section 1 + + ) -

      - - - +
      + + + Table + 1 + + + Table 1 - - - - Table - 1 - - - - - - - - - - - - - -
      AB
      CD
      - ( + + + + A + B + + + + + C + D + + + +
      +

      + ( + + + + + 2 + + + , Section 2 + + + ) +

      +
      + 2 - , Section 2 - ) -

      +
      @@ -1686,6 +2494,7 @@ .to be_equivalent_to Xml::C14n.format(presxml) end + it "processes related terms and admitted terms" do input = <<~INPUT @@ -1765,47 +2574,185 @@ 1 . - - - - - Terms and definitions + + + + + Terms and definitions Clause 1 -

      - First Designation - : Definition 2 - Contrast: - Fifth Designation - , n; - Fourth Designation - , n. - Syn: - Second Designation - . - See also: - Third Designation - , n. -

      + + + First Designation + + + + + Second Designation + + + + + + Fourth Designation + + neuter + + + + + + + + + Third Designation + + neuter + + + + + + + + + Fifth Designation + + neuter + + + + + + + +

      Definition 2

      +
      +
      + +

      + + First Designation + + : + Definition 2 + Contrast: + + + + Fifth Designation + + neuter + + + + + + Fifth Designation + , n + + + + ; + + + + Fourth Designation + + neuter + + + + + + Fourth Designation + , n + + + + . + Syn: + + + + Second Designation + + + + . + See also: + + + + Third Designation + + neuter + + + + + + Third Designation + , n + + + + . +

      +
      -

      - Second Designation - : - See: - First Designation - . -

      + +

      + + Second Designation + + : + See: + + + + First Designation + + + + . +

      +
      -

      - Second Term - , <Field, Usage Info 1>: Definition 1 -

      + + + Second Term + + Field + Usage Info 1 + + + +

      Definition 1

      +
      +
      + +

      + + Second Term + + , < + Field + , + Usage Info 1 + > + + + : + Definition 1 +

      +
      @@ -1826,21 +2773,18 @@ Terms and definitions -

      - First Designation - : Definition 2 - Contrast: - **RELATED TERM NOT FOUND**. - See also: - Third Designation - , n. -

      + First Designation + Definition 2 + + + + + Third Designation +
      -

      - Second Term - , <Field, Usage Info 1>: Definition 1 -

      + Second Term + Definition 1
      @@ -1863,11 +2807,11 @@ 1 . - - - - - + + + + + Terms and definitions @@ -1876,23 +2820,40 @@ 1 -

      **TERM NOT FOUND**:

      -

      - First Designation - : Definition 2 - Contrast: - **RELATED TERM NOT FOUND**. - See also: - Third Designation - , n. -

      + First Designation + Definition 2 + +

      + **TERM NOT FOUND**: + Definition 2 + Contrast: + + **RELATED TERM NOT FOUND** + + . + See also: + + Third Designation + + . +

      +
      + + + + + Third Designation +
      -

      **TERM NOT FOUND**:

      -

      - Second Term - , <Field, Usage Info 1>: Definition 1 -

      + Second Term + Definition 1 + +

      + **TERM NOT FOUND**: + Definition 1 +

      +
      diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5561304..5d46728 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -74,6 +74,7 @@ def htmlencode(xml) def strip_guid(xml) xml.gsub(%r{ id=['"]_[^"']+['"]}, ' id="_"') + .gsub(%r{ original-id=['"]_[^"']+['"]}, ' original-id="_"') .gsub(%r{ target=['"]_[^"']+['"]}, ' target="_"') .gsub(%r{ source=['"]_[^"']+['"]}, ' source="_"') .gsub(%r{ name=['"]_[^"']+['"]}, ' name="_"')