isodoc 1.7.6.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +2 -2
  3. data/lib/isodoc/class_utils.rb +24 -1
  4. data/lib/isodoc/convert.rb +9 -0
  5. data/lib/isodoc/function/cleanup.rb +4 -0
  6. data/lib/isodoc/function/inline.rb +3 -5
  7. data/lib/isodoc/html_function/html.rb +1 -0
  8. data/lib/isodoc/html_function/postprocess.rb +4 -6
  9. data/lib/isodoc/metadata_date.rb +13 -11
  10. data/lib/isodoc/presentation_function/bibdata.rb +2 -2
  11. data/lib/isodoc/presentation_function/block.rb +0 -36
  12. data/lib/isodoc/presentation_function/inline.rb +14 -11
  13. data/lib/isodoc/presentation_function/terms.rb +223 -0
  14. data/lib/isodoc/presentation_xml_convert.rb +11 -4
  15. data/lib/isodoc/version.rb +1 -1
  16. data/lib/isodoc/word_function/body.rb +24 -14
  17. data/lib/isodoc/word_function/comments.rb +0 -4
  18. data/lib/isodoc/word_function/postprocess.rb +184 -176
  19. data/lib/isodoc/xref/xref_gen.rb +18 -22
  20. data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
  21. data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
  22. data/lib/isodoc/xslfo_convert.rb +11 -7
  23. data/lib/isodoc-yaml/i18n-ar.yaml +25 -0
  24. data/lib/isodoc-yaml/i18n-de.yaml +23 -0
  25. data/lib/isodoc-yaml/i18n-en.yaml +23 -0
  26. data/lib/isodoc-yaml/i18n-es.yaml +23 -0
  27. data/lib/isodoc-yaml/i18n-fr.yaml +23 -0
  28. data/lib/isodoc-yaml/i18n-ru.yaml +24 -1
  29. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +24 -0
  30. data/lib/metanorma/output/xslfo.rb +4 -11
  31. data/spec/assets/i18n.yaml +3 -1
  32. data/spec/isodoc/blocks_spec.rb +14 -8
  33. data/spec/isodoc/i18n_spec.rb +23 -18
  34. data/spec/isodoc/inline_spec.rb +193 -9
  35. data/spec/isodoc/lists_spec.rb +344 -222
  36. data/spec/isodoc/section_spec.rb +23 -22
  37. data/spec/isodoc/table_spec.rb +71 -73
  38. data/spec/isodoc/terms_spec.rb +498 -124
  39. data/spec/isodoc/xref_numbering_spec.rb +347 -0
  40. data/spec/isodoc/xref_spec.rb +274 -353
  41. data/spec/isodoc/xslfo_convert_spec.rb +34 -9
  42. metadata +12 -11
  43. data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -7,9 +7,18 @@ RSpec.describe IsoDoc do
7
7
  <sections>
8
8
  <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
9
9
  <p>For the purposes of this document, the following terms and definitions apply.</p>
10
- <term id="paddy1"><preferred>paddy</preferred>
10
+ <term id="paddy1"><preferred><expression><name>paddy</name></expression>
11
+ <field-of-application>in agriculture</field-of-application>
12
+ <usage-info>dated</usage-info>
13
+ <termsource status="modified">
14
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
15
+ <modification>
16
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
17
+ </modification>
18
+ </termsource>
19
+ </preferred>
11
20
  <domain>rice</domain>
12
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
21
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
13
22
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" keep-with-next="true" keep-lines-together="true">
14
23
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
15
24
  <ul>
@@ -21,12 +30,6 @@ RSpec.describe IsoDoc do
21
30
  <li>A</li>
22
31
  </ul>
23
32
  </termexample>
24
- <termsource status="modified">
25
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
26
- <modification>
27
- <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
28
- </modification>
29
- </termsource>
30
33
  <termsource status='identical'>
31
34
  <origin citeas=''>
32
35
  <termref base='IEV' target='xyz'>t1</termref>
@@ -41,10 +44,13 @@ RSpec.describe IsoDoc do
41
44
  </modification>
42
45
  </termsource>
43
46
  </term>
44
- <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
45
- <admitted>rough rice</admitted>
46
- <deprecates>cargo rice</deprecates>
47
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
47
+ <term id="paddy"><preferred><expression><name>paddy</name></expression></preferred>
48
+ <admitted><letter-symbol><name>paddy rice</name></letter-symbol>
49
+ <field-of-application>in agriculture</field-of-application>
50
+ </admitted>
51
+ <admitted><expression><name>rough rice</name></expression></admitted>
52
+ <deprecates><expression><name>cargo rice</name></expression></deprecates>
53
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
48
54
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
49
55
  <ul>
50
56
  <li>A</li>
@@ -67,112 +73,106 @@ RSpec.describe IsoDoc do
67
73
  INPUT
68
74
 
69
75
  presxml = <<~"PRESXML"
70
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
71
- <sections>
72
- <terms id='_terms_and_definitions' obligation='normative' displayorder="1">
73
- <title depth='1'>
74
- 1.
75
- <tab/>
76
- Terms and Definitions
77
- </title>
78
- <p>For the purposes of this document, the following terms and definitions apply.</p>
79
- <term id='paddy1'><name>1.1.</name>
80
- <preferred>paddy</preferred>
81
- <domain>rice</domain>
82
- <definition>
83
- <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
84
- </definition>
85
- <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' keep-with-next='true' keep-lines-together='true'>
86
- <name>EXAMPLE 1</name>
87
- <p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
88
- <ul>
89
- <li>A</li>
90
- </ul>
91
- </termexample>
92
- <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f894'>
93
- <name>EXAMPLE 2</name>
94
- <ul>
95
- <li>A</li>
96
- </ul>
97
- </termexample>
98
- <termsource status='modified'>
99
- <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'>
100
- <referenceFrom>3.1</referenceFrom>
101
- </locality>ISO 7301:2011, Clause 3.1</origin>
102
- <modification>
103
- <p id='_e73a417d-ad39-417d-a4c8-20e4e2529489'>
104
- The term "cargo rice" is shown as deprecated, and Note 1 to entry
105
- is not included here
106
- </p>
107
- </modification>
108
- </termsource>
109
- <termsource status='identical'>
110
- <origin citeas=''>
111
- <termref base='IEV' target='xyz'>t1</termref>
112
- </origin>
113
- </termsource>
114
- <termsource status='modified'>
115
- <origin citeas=''>
116
- <termref base='IEV' target='xyz'/>
117
- </origin>
118
- <modification>
119
- <p id='_'>with adjustments</p>
120
- </modification>
121
- </termsource>
122
- </term>
123
- <term id='paddy'><name>1.2.</name>
124
- <preferred>paddy</preferred>
125
- <admitted>paddy rice</admitted>
126
- <admitted>rough rice</admitted>
127
- <deprecates>cargo rice</deprecates>
128
- <definition>
129
- <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
130
- </definition>
131
- <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f893'>
132
- <name>EXAMPLE</name>
133
- <ul>
134
- <li>A</li>
135
- </ul>
136
- </termexample>
137
- <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74e' keep-with-next='true' keep-lines-together='true'>
138
- <name>Note 1 to entry</name>
139
- <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
140
- The starch of waxy rice consists almost entirely of amylopectin. The
141
- kernels have a tendency to stick together after cooking.
142
- </p>
143
- </termnote>
144
- <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74f'>
145
- <name>Note 2 to entry</name>
146
- <ul>
147
- <li>A</li>
148
- </ul>
149
- <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
150
- The starch of waxy rice consists almost entirely of amylopectin. The
151
- kernels have a tendency to stick together after cooking.
152
- </p>
153
- </termnote>
154
- <termsource status='identical'>
155
- <origin bibitemid='ISO7301' type='inline' droploc='true' citeas='ISO 7301:2011'><locality type='clause'>
156
- <referenceFrom>3.1</referenceFrom>
157
- </locality>ISO 7301:2011, 3.1</origin>
158
- <origin bibitemid='ISO7301' type='inline' case='lowercase' citeas='ISO 7301:2011'><locality type='clause'>
76
+ <?xml version='1.0'?>
77
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
78
+ <sections>
79
+ <terms id='_terms_and_definitions' obligation='normative' displayorder="1">
80
+ <title depth='1'>1.<tab/>Terms and Definitions</title>
81
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
82
+ <term id='paddy1'><name>1.1.</name>
83
+ <preferred><strong>paddy</strong>, &lt;in agriculture, dated&gt;</preferred>
84
+ <termsource status='modified'>
85
+ <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'>
86
+ <referenceFrom>3.1</referenceFrom>
87
+ </locality>ISO 7301:2011, Clause 3.1</origin>
88
+ <modification>
89
+ <p id='_e73a417d-ad39-417d-a4c8-20e4e2529489'>The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
90
+ </modification>
91
+ </termsource>
92
+ <domain>rice</domain>
93
+ <definition>
94
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
95
+ </definition>
96
+ <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' keep-with-next='true' keep-lines-together='true'>
97
+ <name>EXAMPLE 1</name>
98
+ <p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
99
+ <ul>
100
+ <li>A</li>
101
+ </ul>
102
+ </termexample>
103
+ <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f894'>
104
+ <name>EXAMPLE 2</name>
105
+ <ul>
106
+ <li>A</li>
107
+ </ul>
108
+ </termexample>
109
+ <termsource status='identical'>
110
+ <origin citeas=''>
111
+ <termref base='IEV' target='xyz'>t1</termref>
112
+ </origin>
113
+ </termsource>
114
+ <termsource status='modified'>
115
+ <origin citeas=''>
116
+ <termref base='IEV' target='xyz'/>
117
+ </origin>
118
+ <modification>
119
+ <p id='_'>with adjustments</p>
120
+ </modification>
121
+ </termsource>
122
+ </term>
123
+ <term id='paddy'><name>1.2.</name>
124
+ <preferred><strong>paddy</strong></preferred>
125
+ <admitted>paddy rice, &lt;in agriculture&gt;</admitted>
126
+ <admitted>rough rice</admitted>
127
+ <deprecates>cargo rice</deprecates>
128
+ <definition>
129
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
130
+ </definition>
131
+ <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f893'>
132
+ <name>EXAMPLE</name>
133
+ <ul>
134
+ <li>A</li>
135
+ </ul>
136
+ </termexample>
137
+ <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74e' keep-with-next='true' keep-lines-together='true'>
138
+ <name>Note 1 to entry</name>
139
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>The starch of waxy rice consists almost entirely of amylopectin. The
140
+ kernels have a tendency to stick together after cooking.</p>
141
+ </termnote>
142
+ <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74f'>
143
+ <name>Note 2 to entry</name>
144
+ <ul>
145
+ <li>A</li>
146
+ </ul>
147
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>The starch of waxy rice consists almost entirely of amylopectin. The
148
+ kernels have a tendency to stick together after cooking.</p>
149
+ </termnote>
150
+ <termsource status='identical'>
151
+ <origin bibitemid='ISO7301' type='inline' droploc='true' citeas='ISO 7301:2011'><locality type='clause'>
159
152
  <referenceFrom>3.1</referenceFrom>
160
- </locality>ISO 7301:2011, clause 3.1</origin>
161
- </termsource>
162
- </term>
163
- </terms>
164
- </sections>
165
- </iso-standard>
153
+ </locality>ISO 7301:2011, 3.1</origin>
154
+ <origin bibitemid='ISO7301' type='inline' case='lowercase' citeas='ISO 7301:2011'><locality type='clause'>
155
+ <referenceFrom>3.1</referenceFrom>
156
+ </locality>ISO 7301:2011, clause 3.1</origin>
157
+ </termsource>
158
+ </term>
159
+ </terms>
160
+ </sections>
161
+ </iso-standard>
166
162
  PRESXML
167
163
 
168
164
  html = <<~"OUTPUT"
169
165
  #{HTML_HDR}
170
166
  <p class="zzSTDTitle1"/>
171
167
  <div id="_terms_and_definitions">
172
- <h1> 1. &#160; Terms and Definitions </h1>
168
+ <h1>1.&#160; Terms and Definitions</h1>
173
169
  <p>For the purposes of this document,
174
170
  the following terms and definitions apply.</p>
175
- <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
171
+ <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;"><b>paddy</b>, &lt;in agriculture, dated&gt;</p>
172
+ <p>[TERMREF]
173
+ <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
174
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
175
+ [/TERMREF]</p>
176
176
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
177
177
  <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example" style='page-break-after: avoid;page-break-inside: avoid;'><p class="example-title">EXAMPLE 1</p>
178
178
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
@@ -185,13 +185,10 @@ RSpec.describe IsoDoc do
185
185
  <li>A</li>
186
186
  </ul>
187
187
  </div>
188
- <p>[TERMREF]
189
- <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
190
- [MODIFICATION] The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
191
- [/TERMREF]</p>
192
188
  <p>[TERMREF] t1 [/TERMREF]</p>
193
189
  <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
194
- <p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
190
+ <p class="TermNum" id="paddy">1.2.</p>
191
+ <p class="Terms" style="text-align:left;"><b>paddy</b></p><p class="AltTerms" style="text-align:left;">paddy rice, &lt;in agriculture&gt;</p>
195
192
  <p class="AltTerms" style="text-align:left;">rough rice</p>
196
193
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
197
194
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
@@ -216,7 +213,11 @@ RSpec.describe IsoDoc do
216
213
  <p class="zzSTDTitle1"/>
217
214
  <div id="_terms_and_definitions"><h1>1.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
218
215
  the following terms and definitions apply.</p>
219
- <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
216
+ <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;"><b>paddy</b>, &lt;in agriculture, dated&gt;</p>
217
+ <p>[TERMREF]
218
+ <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
219
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
220
+ [/TERMREF]</p>
220
221
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
221
222
  <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example" style='page-break-after: avoid;page-break-inside: avoid;'><p class="example-title">EXAMPLE 1</p>
222
223
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
@@ -229,13 +230,10 @@ RSpec.describe IsoDoc do
229
230
  <li>A</li>
230
231
  </ul>
231
232
  </div>
232
- <p>[TERMREF]
233
- <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
234
- [MODIFICATION] The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
235
- [/TERMREF]</p>
236
233
  <p>[TERMREF] t1 [/TERMREF]</p>
237
234
  <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
238
- <p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
235
+ <p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;"><b>paddy</b></p>
236
+ <p class="AltTerms" style="text-align:left;">paddy rice, &lt;in agriculture&gt;</p>
239
237
  <p class="AltTerms" style="text-align:left;">rough rice</p>
240
238
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
241
239
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
@@ -268,16 +266,17 @@ RSpec.describe IsoDoc do
268
266
  <sections>
269
267
  <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
270
268
  <p>For the purposes of this document, the following terms and definitions apply.</p>
271
- <term id="paddy1"><preferred>paddy</preferred>
269
+ <term id="paddy1"><preferred><expression><name>paddy</name></expression></preferred>
272
270
  <domain>rice</domain>
273
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
274
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747e">rice retaining its husk after threshing, mark 2</p>
271
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
272
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747e">rice retaining its husk after threshing, mark 2</p>
275
273
  <termsource status="modified">
276
274
  <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
277
275
  <modification>
278
276
  <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
279
277
  </modification>
280
278
  </termsource>
279
+ </verbal-definition>
281
280
  </definition>
282
281
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" keep-with-next="true" keep-lines-together="true">
283
282
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
@@ -317,7 +316,7 @@ RSpec.describe IsoDoc do
317
316
  <p>For the purposes of this document, the following terms and definitions apply.</p>
318
317
  <term id='paddy1'>
319
318
  <name>1.1.</name>
320
- <preferred>paddy</preferred>
319
+ <preferred><strong>paddy</strong></preferred>
321
320
  <domain>rice</domain>
322
321
  <definition>
323
322
  <ol>
@@ -377,4 +376,379 @@ RSpec.describe IsoDoc do
377
376
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
378
377
  .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
379
378
  end
379
+
380
+ it "processes IsoXML term with multiple preferred terms" do
381
+ input = <<~"INPUT"
382
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
383
+ <sections>
384
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
385
+ <term id="paddy1">
386
+ <preferred><expression><name>paddy</name></expression></preferred>
387
+ <preferred><expression><name>muddy rice</name></expression></preferred>
388
+ <domain>rice</domain>
389
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
390
+ </term>
391
+ <term id="paddy2">
392
+ <preferred><expression><name language="eng">paddy</name></expression></preferred>
393
+ <preferred><expression><name language="eng">muddy rice</name></expression></preferred>
394
+ <domain>rice</domain>
395
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747a">rice retaining its husk after threshing</p></verbal-definition></definition>
396
+ </term>
397
+ <term id="paddy3">
398
+ <preferred geographic-area="US"><expression><name>paddy</name></expression></preferred>
399
+ <preferred><expression><name>muddy rice</name></expression></preferred>
400
+ <domain>rice</domain>
401
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747b">rice retaining its husk after threshing</p></verbal-definition></definition>
402
+ </term>
403
+ <term id="paddy4">
404
+ <preferred><expression language="eng"><name>paddy</name></expression></preferred>
405
+ <preferred><expression language="fra"><name>muddy rice</name></expression></preferred>
406
+ <domain>rice</domain>
407
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747c">rice retaining its husk after threshing</p></verbal-definition></definition>
408
+ </term>
409
+ </terms>
410
+ </sections>
411
+ </iso-standard>
412
+ INPUT
413
+ presxml = <<~PRESXML
414
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
415
+ <sections>
416
+ <terms id='_terms_and_definitions' obligation='normative' displayorder='1'>
417
+ <title depth='1'>
418
+ 1.
419
+ <tab/>
420
+ Terms and Definitions
421
+ </title>
422
+ <term id='paddy1'>
423
+ <name>1.1.</name>
424
+ <preferred><strong>paddy; muddy rice</strong></preferred>
425
+ <domain>rice</domain>
426
+ <definition>
427
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
428
+ </definition>
429
+ </term>
430
+ <term id='paddy2'>
431
+ <name>1.2.</name>
432
+ <preferred>
433
+ <strong>paddy; muddy rice</strong>
434
+ </preferred>
435
+ <domain>rice</domain>
436
+ <definition>
437
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747a'>rice retaining its husk after threshing</p>
438
+ </definition>
439
+ </term>
440
+ <term id='paddy3'>
441
+ <name>1.3.</name>
442
+ <preferred geographic-area="US">
443
+ <strong>paddy</strong>, US
444
+ </preferred>
445
+ <preferred>
446
+ <strong>muddy rice</strong>
447
+ </preferred>
448
+ <domain>rice</domain>
449
+ <definition>
450
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747b'>rice retaining its husk after threshing</p>
451
+ </definition>
452
+ </term>
453
+ <term id='paddy4'>
454
+ <name>1.4.</name>
455
+ <preferred>
456
+ <strong>paddy</strong>, eng
457
+ </preferred>
458
+ <preferred>
459
+ <strong>muddy rice</strong>, fra
460
+ </preferred>
461
+ <domain>rice</domain>
462
+ <definition>
463
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747c'>rice retaining its husk after threshing</p>
464
+ </definition>
465
+ </term>
466
+ </terms>
467
+ </sections>
468
+ </iso-standard>
469
+ PRESXML
470
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
471
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
472
+ end
473
+
474
+ it "processes IsoXML term with grammatical information" do
475
+ input = <<~"INPUT"
476
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
477
+ <sections>
478
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
479
+ <term id="paddy1">
480
+ <preferred geographic-area="US"><expression language="en" script="Latn"><name>paddy</name>
481
+ <pronunciation>pædiː</pronunciation>
482
+ <grammar>
483
+ <gender>masculine</gender>
484
+ <gender>feminine</gender>
485
+ <number>singular</number>
486
+ <isPreposition>false</isPreposition>
487
+ <isNoun>true</isNoun>
488
+ <grammar-value>irregular declension</grammar-value>
489
+ </grammar>
490
+ </expression></preferred>
491
+ <preferred><expression><name>muddy rice</name>
492
+ <grammar>
493
+ <gender>neuter</gender>
494
+ <isNoun>true</isNoun>
495
+ <grammar-value>irregular declension</grammar-value>
496
+ </grammar>
497
+ </expression></preferred>
498
+ <domain>rice</domain>
499
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
500
+ </term>
501
+ </terms>
502
+ </sections>
503
+ </iso-standard>
504
+ INPUT
505
+ presxml = <<~PRESXML
506
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
507
+ <sections>
508
+ <terms id='_terms_and_definitions' obligation='normative' displayorder='1'>
509
+ <title depth='1'>
510
+ 1.
511
+ <tab/>
512
+ Terms and Definitions
513
+ </title>
514
+ <term id='paddy1'>
515
+ <name>1.1.</name>
516
+ <preferred geographic-area='US'><strong>paddy</strong>, m, f, sg, noun, en Latn US, /p&#xE6;di&#x2D0;/</preferred>
517
+ <preferred><strong>muddy rice</strong>, n, noun</preferred>
518
+ <domain>rice</domain>
519
+ <definition>
520
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
521
+ </definition>
522
+ </term>
523
+ </terms>
524
+ </sections>
525
+ </iso-standard>
526
+ PRESXML
527
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
528
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
529
+ end
530
+
531
+ it "processes IsoXML term with empty or graphical designations" do
532
+ input = <<~"INPUT"
533
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
534
+ <sections>
535
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
536
+ <term id="paddy1">
537
+ <preferred><expression><name/></expression></preferred>
538
+ <preferred isInternational='true'><graphical-symbol><figure id='_'><pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre></figure>
539
+ </graphical-symbol>
540
+ </preferred>
541
+ <domain>rice</domain>
542
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
543
+ </term>
544
+ </terms>
545
+ </sections>
546
+ </iso-standard>
547
+ INPUT
548
+ presxml = <<~PRESXML
549
+ <?xml version='1.0'?>
550
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
551
+ <sections>
552
+ <terms id='_terms_and_definitions' obligation='normative' displayorder='1'>
553
+ <title depth='1'>1.<tab/>Terms and Definitions</title>
554
+ <term id='paddy1'>
555
+ <name>1.1.</name>
556
+ <preferred><strong/></preferred>
557
+ <preferred isInternational='true'><figure id='_'>
558
+ <name>Figure 1</name>
559
+ <pre id='_'>&lt;LITERAL&gt; FIGURATIVE</pre>
560
+ </figure>
561
+ </preferred>
562
+ <domain>rice</domain>
563
+ <definition>
564
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
565
+ </definition>
566
+ </term>
567
+ </terms>
568
+ </sections>
569
+ </iso-standard>
570
+ PRESXML
571
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
572
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
573
+ end
574
+
575
+ it "processes IsoXML term with nonverbal definitions" do
576
+ input = <<~"INPUT"
577
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
578
+ <sections>
579
+ <terms id='A' obligation='normative'>
580
+ <title>Terms and definitions</title>
581
+ <p id='B'>For the purposes of this document, the following terms and definitions apply.</p>
582
+ <term id='term-term'>
583
+ <preferred>
584
+ <expression>
585
+ <name>Term</name>
586
+ </expression>
587
+ </preferred>
588
+ <definition>
589
+ <verbal-definition>
590
+ <p id='C'>Definition</p>
591
+ <termsource status='identical' type='authoritative'>
592
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
593
+ <localityStack>
594
+ <locality type='section'>
595
+ <referenceFrom>1</referenceFrom>
596
+ </locality>
597
+ </localityStack>
598
+ </origin>
599
+ </termsource>
600
+ </verbal-definition>
601
+ <non-verbal-representation>
602
+ <table id='D'>
603
+ <thead>
604
+ <tr>
605
+ <th valign='top' align='left'>A</th>
606
+ <th valign='top' align='left'>B</th>
607
+ </tr>
608
+ </thead>
609
+ <tbody>
610
+ <tr>
611
+ <td valign='top' align='left'>C</td>
612
+ <td valign='top' align='left'>D</td>
613
+ </tr>
614
+ </tbody>
615
+ </table>
616
+ </non-verbal-representation>
617
+ </definition>
618
+ <termsource status='identical' type='authoritative'>
619
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
620
+ <localityStack>
621
+ <locality type='section'>
622
+ <referenceFrom>2</referenceFrom>
623
+ </locality>
624
+ </localityStack>
625
+ </origin>
626
+ </termsource>
627
+ </term>
628
+ <term id='term-term-2'>
629
+ <preferred>
630
+ <expression>
631
+ <name>Term 2</name>
632
+ </expression>
633
+ </preferred>
634
+ <definition>
635
+ <non-verbal-representation>
636
+ <figure id='E'>
637
+ <pre id='F'>Literal</pre>
638
+ </figure>
639
+ <formula id='G'>
640
+ <stem type='MathML'>
641
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
642
+ <mi>x</mi>
643
+ <mo>=</mo>
644
+ <mi>y</mi>
645
+ </math>
646
+ </stem>
647
+ </formula>
648
+ <termsource status='identical' type='authoritative'>
649
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
650
+ <localityStack>
651
+ <locality type='section'>
652
+ <referenceFrom>3</referenceFrom>
653
+ </locality>
654
+ </localityStack>
655
+ </origin>
656
+ </termsource>
657
+ </non-verbal-representation>
658
+ </definition>
659
+ </term>
660
+ </terms>
661
+ </sections>
662
+ </iso-standard>
663
+ INPUT
664
+ presxml = <<~PRESXML
665
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
666
+ <sections>
667
+ <terms id='A' obligation='normative' displayorder='1'>
668
+ <title depth='1'>
669
+ 1.
670
+ <tab/>
671
+ Terms and definitions
672
+ </title>
673
+ <p id='B'>For the purposes of this document, the following terms and definitions apply.</p>
674
+ <term id='term-term'>
675
+ <name>1.1.</name>
676
+ <preferred><strong>Term</strong></preferred>
677
+ <definition>
678
+ <p id='C'>Definition</p>
679
+ <termsource status='identical' type='authoritative'>
680
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
681
+ <localityStack>
682
+ <locality type='section'>
683
+ <referenceFrom>1</referenceFrom>
684
+ </locality>
685
+ </localityStack>
686
+ , Section 1
687
+ </origin>
688
+ </termsource>
689
+ <table id='D'>
690
+ <name>Table 1</name>
691
+ <thead>
692
+ <tr>
693
+ <th valign='top' align='left'>A</th>
694
+ <th valign='top' align='left'>B</th>
695
+ </tr>
696
+ </thead>
697
+ <tbody>
698
+ <tr>
699
+ <td valign='top' align='left'>C</td>
700
+ <td valign='top' align='left'>D</td>
701
+ </tr>
702
+ </tbody>
703
+ </table>
704
+ </definition>
705
+ <termsource status='identical' type='authoritative'>
706
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
707
+ <localityStack>
708
+ <locality type='section'>
709
+ <referenceFrom>2</referenceFrom>
710
+ </locality>
711
+ </localityStack>
712
+ , Section 2
713
+ </origin>
714
+ </termsource>
715
+ </term>
716
+ <term id='term-term-2'>
717
+ <name>1.2.</name>
718
+ <preferred><strong>Term 2</strong></preferred>
719
+ <definition>
720
+ <figure id='E'>
721
+ <name>Figure 1</name>
722
+ <pre id='F'>Literal</pre>
723
+ </figure>
724
+ <formula id='G'>
725
+ <name>1</name>
726
+ <stem type='MathML'>
727
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
728
+ <mi>x</mi>
729
+ <mo>=</mo>
730
+ <mi>y</mi>
731
+ </math>
732
+ <!-- x = y -->
733
+ </stem>
734
+ </formula>
735
+ <termsource status='identical' type='authoritative'>
736
+ <origin bibitemid='ISO2191' type='inline' citeas=''>
737
+ <localityStack>
738
+ <locality type='section'>
739
+ <referenceFrom>3</referenceFrom>
740
+ </locality>
741
+ </localityStack>
742
+ , Section 3
743
+ </origin>
744
+ </termsource>
745
+ </definition>
746
+ </term>
747
+ </terms>
748
+ </sections>
749
+ </iso-standard>
750
+ PRESXML
751
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
752
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
753
+ end
380
754
  end