diff --git a/lib/isodoc/function/inline.rb b/lib/isodoc/function/inline.rb
index 6d299a5f..dc64f512 100644
--- a/lib/isodoc/function/inline.rb
+++ b/lib/isodoc/function/inline.rb
@@ -21,7 +21,7 @@ def location_parse(node, out); end
SPAN_UNWRAP_CLASSES =
%w[fmt-caption-label fmt-label-delim fmt-caption-delim fmt-autonum-delim
fmt-element-name fmt-conn fmt-comma fmt-enum-comma fmt-obligation
- fmt-xref-container].freeze
+ fmt-xref-container fmt-designation-field].freeze
def span_parse(node, out)
klass = node["style"] || node["class"]
@@ -203,6 +203,7 @@ def children_parse(node, out)
def xref_label_parse(node, out); end
def name_parse(node, out); end
+ def semx_definition_parse(node, out); end
def floating_title_parse(node, out); end
diff --git a/lib/isodoc/function/terms.rb b/lib/isodoc/function/terms.rb
index fbb1e352..08fdacd5 100644
--- a/lib/isodoc/function/terms.rb
+++ b/lib/isodoc/function/terms.rb
@@ -10,21 +10,44 @@ def modification_parse(node, out)
para.children.each { |n| parse(n, out) }
end
+ def semx_deprecated_term_parse(node, out); end
+
def deprecated_term_parse(node, out)
- out.p class: "DeprecatedTerms", style: "text-align:left;" do |p|
- node.children.each { |c| parse(c, p) }
+ node.children.each do |c|
+ if c.name == "p"
+ out.p class: "DeprecatedTerms", style: "text-align:left;" do |p|
+ c.children.each { |c1| parse(c1, p) }
+ end
+ else parse(c, out)
+ end
end
end
+ def semx_admitted_term_parse(node, out); end
+
def admitted_term_parse(node, out)
- out.p class: "AltTerms", style: "text-align:left;" do |p|
- node.children.each { |c| parse(c, p) }
+ node.children.each do |c|
+ if c.name == "p"
+ out.p class: "AltTerms", style: "text-align:left;" do |p|
+ c.children.each { |c1| parse(c1, p) }
+ end
+ else parse(c, out)
+ end
end
end
+ def semx_term_parse(node, out); end
+
+ def semx_related_parse(node, out); end
+
def term_parse(node, out)
- out.p class: "Terms", style: "text-align:left;" do |p|
- node.children.each { |c| parse(c, p) }
+ node.children.each do |c|
+ if c.name == "p"
+ out.p class: "Terms", style: "text-align:left;" do |p|
+ c.children.each { |c1| parse(c1, p) }
+ end
+ else parse(c, out)
+ end
end
end
@@ -51,16 +74,15 @@ def termnote_parse1(node, para, div)
para&.name != "p" and parse(para, div)
end
+ def semx_termref_parse(node, out); end
+
def termref_parse(node, out)
out.p do |p|
node.children.each { |n| parse(n, p) }
end
end
- def termdomain_parse(node, out)
- node["hidden"] == "true" and return
- node.children.each { |n| parse(n, out) }
- end
+ def termdomain_parse(node, out); end
def termdef_parse(node, out)
name = node.at(ns("./fmt-name"))&.remove
diff --git a/lib/isodoc/function/to_word_html.rb b/lib/isodoc/function/to_word_html.rb
index c2f63d13..b80d053f 100644
--- a/lib/isodoc/function/to_word_html.rb
+++ b/lib/isodoc/function/to_word_html.rb
@@ -215,12 +215,18 @@ def parse(node, out)
when "pre" then pre_parse(node, out)
when "annotation" then annotation_parse(node, out)
when "term" then termdef_parse(node, out)
- when "preferred" then term_parse(node, out)
- when "admitted" then admitted_term_parse(node, out)
- when "deprecates" then deprecated_term_parse(node, out)
+ when "preferred" then semx_term_parse(node, out)
+ when "fmt-preferred" then term_parse(node, out)
+ when "admitted" then semx_admitted_term_parse(node, out)
+ when "fmt-admitted" then admitted_term_parse(node, out)
+ when "deprecates" then semx_deprecated_term_parse(node, out)
+ when "fmt-deprecates" then deprecated_term_parse(node, out)
when "domain" then termdomain_parse(node, out)
- when "definition" then definition_parse(node, out)
- when "termsource" then termref_parse(node, out)
+ when "definition" then semx_definition_parse(node, out)
+ when "fmt-definition" then definition_parse(node, out)
+ when "termsource" then semx_termref_parse(node, out)
+ when "fmt-termsource" then termref_parse(node, out)
+ when "related" then semx_related_parse(node, out)
when "modification" then modification_parse(node, out)
when "termnote" then termnote_parse(node, out)
when "terms" then terms_parse(node, out)
diff --git a/lib/isodoc/presentation_function/autonum.rb b/lib/isodoc/presentation_function/autonum.rb
index afdc8032..aeb751e6 100644
--- a/lib/isodoc/presentation_function/autonum.rb
+++ b/lib/isodoc/presentation_function/autonum.rb
@@ -44,14 +44,23 @@ def transfer_id(old, new)
old.delete("id")
end
+ def semx_fmt_dup(elem)
+ elem["id"] ||= "_#{UUIDTools::UUID.random_create}"
+ new = Nokogiri::XML(<<~XML).root
+
#{label}: " \ + node.children =(l10n("
#{label}: " \ "#{to_xml(p)} (#{Common::to_xml(ref)})
")) else - node.replace(l10n("#{label}: " \ + node.children = (l10n("
#{label}: " \ "**RELATED TERM NOT FOUND**
")) end end + + def related1_prep(node) + p = node.at(ns("./fmt-preferred"))&.children + ref = node.at(ns("./xref | ./eref | ./termref")) + orig = semx_orig(node) + [p, ref, orig] + end + + def related_designation1(desgn) + out = desgn.parent.at(ns("./fmt-#{desgn.name}")) + d1 = semx_fmt_dup(desgn) + %w(preferred admitted deprecates).each do |w| + d = d1.at(ns("./#{w}[last()]")) and d.after("#{ret}
" + ret + end + + def merge_preferred_eligible?(first, second) + orig_first, orig_second, firstex, secondex = + merge_preferred_eligible_prep(first, second) + orig_first["geographic-area"] == orig_second["geographic-area"] && + firstex["language"] == secondex["language"] && + !orig_first.at(ns("./pronunciation | ./grammar | ./graphical-symbol")) && + !orig_second.at(ns("./pronunciation | ./grammar | ./graphical-symbol")) && + orig_first.name == "preferred" && orig_second.name == "preferred" + end + + def merge_preferred_eligible_prep(first, second) + orig_first = semx_orig(first) + orig_second = semx_orig(second) + firstex = orig_first.at(ns("./expression")) || {} + secondex = orig_second.at(ns("./expression")) || {} + [orig_first, orig_second, firstex, secondex] + end + + def designation1(desgn) + desgn.parent.name == "related" and return + out = desgn.parent.at(ns("./fmt-#{desgn.name}")) + d1 = semx_fmt_dup(desgn) + s = d1.at(ns("./termsource")) + name = d1.at(ns("./expression/name | ./letter-symbol/name | " \ + "./graphical-symbol")) or return + designation_annotate(d1, name, desgn) + out << d1 + s and out << s.wrap("A
B
[SOURCE: ISO 712, Section 1 — with adjustments ; ISO 712, Section 2]
+[SOURCE: ISO 712, Section 1 — with adjustments; ISO 712, Section 2]
Figure 1 — Split-it-right sample divider
@@ -361,7 +361,7 @@
A B [SOURCE: ISO 712, Section 1 — with adjustments ; ISO 712, Section 2] [SOURCE: ISO 712, Section 1 — with adjustments; ISO 712, Section 2]
Figure 1 — Split-it-right sample divider
diff --git a/spec/isodoc/i18n_spec.rb b/spec/isodoc/i18n_spec.rb
index 0ef94dc6..d74b8b09 100644
--- a/spec/isodoc/i18n_spec.rb
+++ b/spec/isodoc/i18n_spec.rb
@@ -76,339 +76,348 @@
INPUT
presxml = <<~PRESXML
-
- See
- Text
+ See
+ Text
+
- See
- Text
+ See
+ Text
+
- See
-
-
+ See
+
+
+
- See
-
- See
-
-
+ See
+
+ See
+
+
+
+
+
+
+
+ This is a preamble Initial note Initial admonition Text This is a preamble Initial note Initial admonition Text
+ This is a preamble Text
+ This is a preamble Text Text Text
+ [SOURCE: ISO 712, Section 1 —
- with adjustments ; ISO 712, Section 2] NOTE This is a table about rice [SOURCE: ISO 712, Section 1
- — with adjustments ; ISO 712, Section 2] NOTE This is a table about rice
+ with adjustments For the purposes of this document, the following terms and definitions apply.
- <
- Foreign seeds, husks, bran, sand, dust. rice retaining its husk after threshing The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. For the purposes of this document, the following terms and definitions apply. The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
+ rice retaining its husk after threshing
+ <
+ Foreign seeds, husks, bran, sand, dust. comment with adjustments
+
+
+
+ DEPRECATED:
+ rice retaining its husk after threshing rice retaining its husk after threshing The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. For the purposes of this document, the following terms and definitions apply. 1.1. paddy, <in agriculture, dated> [SOURCE: ISO 7301:2011, Clause 3.1, modified
- —
- The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here] <rice> rice retaining its husk after threshing EXAMPLE 1 Foreign seeds, husks, bran, sand, dust. EXAMPLE 2 [SOURCE: t1
- —
- comment
-
- ;
- Termbase IEV, term ID xyz, modified
- —
- with adjustments] 1.2. paddy paddy rice, <in agriculture> rough rice DEPRECATED: cargo rice rice retaining its husk after threshing EXAMPLE Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. Note 2 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking. [SOURCE: ISO 7301:2011, 3.1
- ISO 7301:2011, clause 3.1]
-
-
-
-
- (normative)
-
-
+
+
+
+
+ (normative)
+
+
-
-
-
-
- (normative)
-
-
+
+
+
+
+ (normative)
+
+
-
-
-
-
- (规范性附录)
-
-
+
+
+
+
+ (规范性附录)
+
+
-
-
-
-
-
-
- (normative)
-
-
+
+
+
+
+
+
+ (normative)
+
+
- (normative)
-
-
- (normative)
-
-
- (normative)
-
-
- (normative)
-
-
+ (normative)
+
+
+ (normative)
+
+
+ (normative)
+
+
+ (normative)
+
+
-
-
-
-
- (normative)
-
-
- (normative)
-
+
+
+
+
+ (normative)
+
+
+ (normative)
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ 1. Terms and Definitions
-
-
-
-
-
-