Skip to content

Commit

Permalink
annotate fmt-designation-field: #630
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jan 3, 2025
1 parent a2ff3be commit 44a22ff
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/isodoc/function/inline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions lib/isodoc/presentation_function/concepts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ def designation_boldface(desgn)
end

def designation_field(desgn, name, orig)
f = desgn.xpath(ns("./field-of-application | ./usage-info"))
&.map { |u| to_xml(u.children) }&.join(", ")
f = orig.xpath(ns("./field-of-application | ./usage-info"))
&.map { |u| to_xml(semx_fmt_dup(u)) }&.join(", ")
f&.empty? and return nil
name << ", &#x3c;#{f}&#x3e;"
name << "<span class='fmt-designation-field'>, &#x3c;#{f}&#x3e;</span>"
end

def designation_grammar(grammar)
Expand Down
61 changes: 40 additions & 21 deletions spec/isodoc/terms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@
<expression>
<name>paddy</name>
</expression>
<field-of-application>in agriculture</field-of-application>
<usage-info>dated</usage-info>
<field-of-application id="_">in agriculture</field-of-application>
<usage-info id="_">dated</usage-info>
<termsource status="modified" original-id="_">
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">
<locality type="clause">
Expand All @@ -226,22 +226,28 @@
<p>
<semx element="preferred" source="_">
<strong>paddy</strong>
, &lt;in agriculture, dated&gt;
<span class="fmt-designation-field">
, &lt;
<semx element="field-of-application" source="_">in agriculture</semx>
,
<semx element="usage-info" source="_">dated</semx>
&gt;
</span>
</semx>
</p>
<fmt-termsource>
[SOURCE:
<semx element="termsource" source="_">
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">
<locality type="clause">
<referenceFrom>3.1</referenceFrom>
</locality>
ISO 7301:2011, Clause 3.1
</origin>
, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
</semx>
]
</fmt-termsource>
[SOURCE:
<semx element="termsource" source="_">
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">
<locality type="clause">
<referenceFrom>3.1</referenceFrom>
</locality>
ISO 7301:2011, Clause 3.1
</origin>
, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
</semx>
]
</fmt-termsource>
</fmt-preferred>
<domain id="_">rice</domain>
<definition id="_">
Expand Down Expand Up @@ -376,7 +382,7 @@
<letter-symbol>
<name>paddy rice</name>
</letter-symbol>
<field-of-application>in agriculture</field-of-application>
<field-of-application id="_">in agriculture</field-of-application>
</admitted>
<admitted id="_">
<expression>
Expand All @@ -385,7 +391,14 @@
</admitted>
<fmt-admitted>
<p>
<semx element="admitted" source="_">paddy rice, &lt;in agriculture&gt;</semx>
<semx element="admitted" source="_">
paddy rice
<span class="fmt-designation-field">
, &lt;
<semx element="field-of-application" source="_">in agriculture</semx>
&gt;
</span>
</semx>
</p>
<p>
<semx element="admitted" source="_">rough rice</semx>
Expand All @@ -398,7 +411,7 @@
</deprecates>
<fmt-deprecates>
<p>
DEPRECATED:
DEPRECATED:
<semx element="deprecates" source="_">cargo rice</semx>
</p>
</fmt-deprecates>
Expand Down Expand Up @@ -1870,14 +1883,20 @@
<expression>
<name>Second Term</name>
</expression>
<field-of-application>Field</field-of-application>
<usage-info>Usage Info 1</usage-info>
<field-of-application id="_">Field</field-of-application>
<usage-info id="_">Usage Info 1</usage-info>
</preferred>
<fmt-preferred>
<p>
<semx element="preferred" source="_">
<strong>Second Term</strong>
, &lt;Field, Usage Info 1&gt;
<span class="fmt-designation-field">
, &lt;
<semx element="field-of-application" source="_">Field</semx>
,
<semx element="usage-info" source="_">Usage Info 1</semx>
&gt;
</span>
</semx>
</p>
</fmt-preferred>
Expand Down

0 comments on commit 44a22ff

Please sign in to comment.