metanorma-iso 1.10.2 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/iso/basicdoc.rng +1 -11
  3. data/lib/asciidoctor/iso/biblio.rng +0 -2
  4. data/lib/asciidoctor/iso/front.rb +2 -2
  5. data/lib/asciidoctor/iso/isodoc.rng +42 -18
  6. data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
  7. data/lib/asciidoctor/iso/isostandard.rng +1 -3
  8. data/lib/asciidoctor/iso/reqt.rng +1 -1
  9. data/lib/asciidoctor/iso/section.rb +1 -1
  10. data/lib/asciidoctor/iso/validate.rb +1 -1
  11. data/lib/asciidoctor/iso/validate_section.rb +1 -1
  12. data/lib/isodoc/iso/html/isodoc.css +0 -1
  13. data/lib/isodoc/iso/html/isodoc.scss +0 -1
  14. data/lib/isodoc/iso/html/style-human.css +0 -1
  15. data/lib/isodoc/iso/html/style-human.scss +0 -1
  16. data/lib/isodoc/iso/html/style-iso.css +0 -1
  17. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  18. data/lib/isodoc/iso/iso.amendment.xsl +20 -7
  19. data/lib/isodoc/iso/iso.international-standard.xsl +20 -7
  20. data/lib/isodoc/iso/isosts_convert.rb +6 -2
  21. data/lib/isodoc/iso/presentation_xml_convert.rb +19 -9
  22. data/lib/isodoc/iso/sts_convert.rb +5 -2
  23. data/lib/metanorma/iso/processor.rb +2 -2
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/metanorma-iso.gemspec +3 -3
  26. data/spec/asciidoctor/blocks_spec.rb +4 -4
  27. data/spec/asciidoctor/cleanup_spec.rb +15 -12
  28. data/spec/asciidoctor/refs_spec.rb +87 -84
  29. data/spec/isodoc/i18n_spec.rb +7 -7
  30. data/spec/isodoc/inline_spec.rb +4 -4
  31. data/spec/isodoc/section_spec.rb +3 -3
  32. data/spec/isodoc/terms_spec.rb +18 -18
  33. data/spec/isodoc/xref_spec.rb +3 -3
  34. data/spec/metanorma/processor_spec.rb +110 -14
  35. data/spec/vcr_cassettes/docrels.yml +68 -68
  36. metadata +7 -7
@@ -9,7 +9,7 @@ RSpec.describe IsoDoc do
9
9
  <term id="paddy1">
10
10
  <preferred><expression><name>paddy</name></expression></preferred>
11
11
  <domain>rice</domain>
12
- <definition><verbaldefinition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbaldefinition></definition>
12
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
13
13
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
14
14
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
15
15
  <ul>
@@ -35,7 +35,7 @@ RSpec.describe IsoDoc do
35
35
  <admitted><expression><name>paddy rice</name></expression></admitted>
36
36
  <admitted><expression><name>rough rice</name></expression></admitted>
37
37
  <deprecates><expression><name>cargo rice</name></expression></deprecates>
38
- <definition><verbaldefinition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbaldefinition></definition>
38
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
39
39
  <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
40
40
  <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
41
41
  </termnote>
@@ -54,10 +54,10 @@ RSpec.describe IsoDoc do
54
54
  </term>
55
55
  <term id="A">
56
56
  <preferred><expression><name>term1</name></expression></preferred>
57
- <definition><verbaldefinition>term1 definition</verbaldefinition></definition>
57
+ <definition><verbal-definition>term1 definition</verbal-definition></definition>
58
58
  <term id="B">
59
59
  <preferred><expression><name>term2</name></expression></preferred>
60
- <definition><verbaldefinition>term2 definition</verbaldefinition></definition>
60
+ <definition><verbal-definition>term2 definition</verbal-definition></definition>
61
61
  </term>
62
62
  </term>
63
63
  </terms>
@@ -65,16 +65,16 @@ RSpec.describe IsoDoc do
65
65
  </iso-standard>
66
66
  INPUT
67
67
  presxml = <<~OUTPUT
68
+ <?xml version='1.0'?>
68
69
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
69
70
  <sections>
70
71
  <terms id='_terms_and_definitions' obligation='normative' displayorder='1'>
71
72
  <title depth='1'>1<tab/>Terms and Definitions</title>
72
73
 
73
74
  <term id='paddy1'><name>1.1</name>
74
- <preferred>paddy</preferred>
75
- <domain>rice</domain>
75
+ <preferred><strong>paddy</strong></preferred>
76
76
  <definition>
77
- <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
77
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p>
78
78
  </definition>
79
79
  <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892'>
80
80
  <name>EXAMPLE 1</name>
@@ -97,7 +97,7 @@ RSpec.describe IsoDoc do
97
97
  </termsource>
98
98
  </term>
99
99
  <term id='paddy'><name>1.2</name>
100
- <preferred>paddy</preferred>
100
+ <preferred><strong>paddy</strong></preferred>
101
101
  <admitted>paddy rice</admitted>
102
102
  <admitted>rough rice</admitted>
103
103
  <deprecates>cargo rice</deprecates>
@@ -129,11 +129,11 @@ RSpec.describe IsoDoc do
129
129
  </term>
130
130
  <term id='A'>
131
131
  <name>1.3</name>
132
- <preferred>term1</preferred>
132
+ <preferred><strong>term1</strong></preferred>
133
133
  <definition>term1 definition</definition>
134
134
  <term id='B'>
135
135
  <name>1.3.1</name>
136
- <preferred>term2</preferred>
136
+ <preferred><strong>term2</strong></preferred>
137
137
  <definition>term2 definition</definition>
138
138
  </term>
139
139
  </term>
@@ -147,7 +147,7 @@ RSpec.describe IsoDoc do
147
147
  <p class="zzSTDTitle1"/>
148
148
  <div id="_terms_and_definitions">
149
149
  <h1>1&#160; Terms and Definitions</h1>
150
- <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
150
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;"><b>paddy</b></p>
151
151
 
152
152
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
153
153
  <div class="example" id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
@@ -168,7 +168,7 @@ RSpec.describe IsoDoc do
168
168
  [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
169
169
  [/TERMREF]</p>
170
170
  <p class="TermNum" id="paddy">1.2</p>
171
- <p class="Terms" style="text-align:left;">paddy</p>
171
+ <p class="Terms" style="text-align:left;"><b>paddy</b></p>
172
172
  <p class="AltTerms" style="text-align:left;">paddy rice</p>
173
173
  <p class="AltTerms" style="text-align:left;">rough rice</p>
174
174
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
@@ -194,10 +194,10 @@ RSpec.describe IsoDoc do
194
194
  <p>[TERMREF]<a href="#ISO7301">ISO 7301:2011, 3.1</a>
195
195
  [/TERMREF]</p>
196
196
  <p class='TermNum' id='A'>1.3</p>
197
- <p class='Terms' style='text-align:left;'>term1</p>
197
+ <p class='Terms' style='text-align:left;'><b>term1</b></p>
198
198
  term1 definition
199
199
  <p class='TermNum' id='B'>1.3.1</p>
200
- <p class='Terms' style='text-align:left;'>term2</p>
200
+ <p class='Terms' style='text-align:left;'><b>term2</b></p>
201
201
  term2 definition
202
202
  </div>
203
203
  </div>
@@ -207,7 +207,7 @@ RSpec.describe IsoDoc do
207
207
 
208
208
  word = <<~OUTPUT
209
209
  <div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1>
210
- <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
210
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;"><b>paddy</b></p>
211
211
 
212
212
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f" class="Definition">&lt;rice&gt; rice retaining its husk after threshing</p>
213
213
  <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span>Foreign seeds, husks, bran, sand, dust.</p><ul>
@@ -222,7 +222,7 @@ RSpec.describe IsoDoc do
222
222
  [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
223
223
  [/TERMREF]</p>
224
224
  <p class="TermNum" id="paddy">1.2</p>
225
- <p class="Terms" style="text-align:left;">paddy</p>
225
+ <p class="Terms" style="text-align:left;"><b>paddy</b></p>
226
226
  <p class="AltTerms" style="text-align:left;">paddy rice</p>
227
227
  <p class="AltTerms" style="text-align:left;">rough rice</p>
228
228
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
@@ -237,10 +237,10 @@ RSpec.describe IsoDoc do
237
237
  <p class="Source">[TERMREF]<a href="#ISO7301">ISO 7301:2011, 3.1</a>
238
238
  [/TERMREF]</p>
239
239
  <p class='TermNum' id='A'>1.3</p>
240
- <p class='Terms' style='text-align:left;'>term1</p>
240
+ <p class='Terms' style='text-align:left;'><b>term1</b></p>
241
241
  term1 definition
242
242
  <p class='TermNum' id='B'>1.3.1</p>
243
- <p class='Terms' style='text-align:left;'>term2</p>
243
+ <p class='Terms' style='text-align:left;'><b>term2</b></p>
244
244
  term2 definition
245
245
  </div>
246
246
  OUTPUT
@@ -1002,7 +1002,7 @@ RSpec.describe IsoDoc do
1002
1002
  <title>2</title>
1003
1003
  <term id="_waxy_rice">
1004
1004
  <name>2.1</name>
1005
- <preferred>waxy rice</preferred>
1005
+ <preferred><strong>waxy rice</strong></preferred>
1006
1006
  <termnote id="note1">
1007
1007
  <name>Note 1 to entry</name>
1008
1008
  <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
@@ -1012,7 +1012,7 @@ RSpec.describe IsoDoc do
1012
1012
  </term>
1013
1013
  <term id="_nonwaxy_rice">
1014
1014
  <name>2.2</name>
1015
- <preferred>nonwaxy rice</preferred>
1015
+ <preferred><strong>nonwaxy rice</strong></preferred>
1016
1016
  <termnote id="note2">
1017
1017
  <name>Note 1 to entry</name>
1018
1018
  <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
@@ -1199,7 +1199,7 @@ RSpec.describe IsoDoc do
1199
1199
  </title>
1200
1200
  <term id='J'>
1201
1201
  <name>3.1.1</name>
1202
- <preferred>Term2</preferred>
1202
+ <preferred><strong>Term2</strong></preferred>
1203
1203
  </term>
1204
1204
  </terms>
1205
1205
  <definitions id='K' inline-header='true'>
@@ -8,6 +8,100 @@ RSpec.describe Metanorma::Iso::Processor do
8
8
  registry.register(Metanorma::Iso::Processor)
9
9
  processor = registry.find_processor(:iso)
10
10
 
11
+ inputxml = <<~INPUT
12
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
13
+ <bibdata type="standard">
14
+ <title language="en" format="text/plain" type="main">English</title>
15
+ <title language="en" format="text/plain" type="title-main">English</title>
16
+ <title language="fr" format="text/plain" type="main">French</title>
17
+ <title language="fr" format="text/plain" type="title-main">French</title>
18
+ <docidentifier type="ISO">ISO DIR 1</docidentifier><docidentifier type="iso-with-lang">ISO DIR 1(F)</docidentifier><docidentifier type="iso-reference">ISO DIR 1(F)</docidentifier>
19
+ <docnumber>1</docnumber>
20
+ <contributor>
21
+ <role type="author"/>
22
+ <organization>
23
+ <name>International Organization for Standardization</name>
24
+ <abbreviation>ISO</abbreviation>
25
+ </organization>
26
+ </contributor>
27
+ <contributor>
28
+ <role type="publisher"/>
29
+ <organization>
30
+ <name>International Organization for Standardization</name>
31
+ <abbreviation>ISO</abbreviation>
32
+ </organization>
33
+ </contributor>
34
+ <language>fr</language>
35
+ <script>Latn</script>
36
+ <status>
37
+ <stage abbreviation="IS">60</stage>
38
+ <substage>60</substage>
39
+ </status>
40
+ <copyright>
41
+ <from>2021</from>
42
+ <owner>
43
+ <organization>
44
+ <name>International Organization for Standardization</name>
45
+ <abbreviation>ISO</abbreviation>
46
+ </organization>
47
+ </owner>
48
+ </copyright>
49
+ <ext>
50
+ <doctype>directive</doctype>
51
+ <subdoctype>vocabulary</subdoctype>
52
+ <editorialgroup>
53
+ <technical-committee/>
54
+ <subcommittee/>
55
+ <workgroup/>
56
+ </editorialgroup>
57
+ <structuredidentifier>
58
+ <project-number>ISO 1</project-number>
59
+ </structuredidentifier>
60
+ <stagename>International standard</stagename>
61
+ </ext>
62
+ </bibdata>
63
+ <boilerplate>
64
+ <copyright-statement>
65
+ <clause>
66
+ <title>DOCUMENT PROT&#201;G&#201; PAR COPYRIGHT</title>
67
+ <p id="boilerplate-year">&#169; ISO 2021</p>
68
+
69
+ <p id="boilerplate-message">
70
+ Droits de reproduction r&#233;serv&#233;s. Sauf indication contraire, aucune partie de cette publication ne
71
+ peut &#234;tre reproduite ni utilis&#233;e sous quelque forme que ce soit et par aucun proc&#233;d&#233;, &#233;lectronique
72
+ ou m&#233;canique, y compris la photocopie, l&#8217;affichage sur l&#8217;internet ou sur un Intranet, sans
73
+ autorisation &#233;crite pr&#233;alable. Les demandes d&#8217;autorisation peuvent &#234;tre adress&#233;es &#224; l&#8217;ISO &#224;
74
+ l&#8217;adresse ci-apr&#232;s ou au comit&#233; membre de l&#8217;ISO dans le pays du demandeur.
75
+ </p>
76
+
77
+ <p id="boilerplate-address" align="left">
78
+ ISO copyright office<br/>
79
+ Ch. de Blandonnet 8 &#8226; CP 401<br/>
80
+ CH-1214 Vernier, Geneva, Switzerland<br/>
81
+ Tel.&#160;&#160;+ 41 22 749 01 11<br/>
82
+ Fax&#160;&#160;+ 41 22 749 09 47<br/>
83
+ Email: copyright@iso.org<br/>
84
+ Website: www.iso.org
85
+ </p>
86
+ <p id="boilerplate-place">
87
+ Publi&#233; en Suisse
88
+ </p>
89
+ </clause>
90
+ </copyright-statement>
91
+
92
+
93
+ </boilerplate>
94
+ <sections>
95
+ <terms id="H" obligation="normative"><title>1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</title>
96
+ <term id="J">
97
+ <name>1.1</name>
98
+ <preferred>Term2</preferred>
99
+ </term>
100
+ </terms>
101
+ </sections>
102
+ </iso-standard>
103
+ INPUT
104
+
11
105
  it "registers against metanorma" do
12
106
  expect(processor).not_to be nil
13
107
  end
@@ -35,27 +129,18 @@ RSpec.describe Metanorma::Iso::Processor do
35
129
  .to be_equivalent_to xmlpp(output)
36
130
  end
37
131
 
38
- it "generates HTML from IsoDoc XML" do
132
+ it "generates HTML from Metanorma XML" do
39
133
  FileUtils.rm_f "test.xml"
40
- processor.output(<<~"INPUT", "test.xml", "test.html", :html)
41
- <iso-standard xmlns="http://riboseinc.com/isoxml">
42
- <sections>
43
- <terms id="H" obligation="normative"><title>1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</title>
44
- <term id="J">
45
- <name>1.1</name>
46
- <preferred>Term2</preferred>
47
- </term>
48
- </terms>
49
- </sections>
50
- </iso-standard>
51
- INPUT
134
+ FileUtils.rm_f "test.html"
135
+ processor.output(inputxml, "test.xml", "test.html", :html)
52
136
  expect(xmlpp(File.read("test.html", encoding: "utf-8")
53
137
  .gsub(%r{^.*<main}m, "<main")
54
138
  .gsub(%r{</main>.*}m, "</main>")))
55
139
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
56
140
  <main class="main-section">
57
141
  <button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
58
- <p class="zzSTDTitle1"></p>
142
+ <div class='authority'> </div>
143
+ <p class='zzSTDTitle1'>French</p>
59
144
  <div id="H"><h1 id="toc0">1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
60
145
  <h2 class="TermNum" id="J">1.1</h2>
61
146
  <p class="Terms" style="text-align:left;">Term2</p>
@@ -63,4 +148,15 @@ RSpec.describe Metanorma::Iso::Processor do
63
148
  </main>
64
149
  OUTPUT
65
150
  end
151
+
152
+ it "generates STS from Metanorma XML" do
153
+ FileUtils.rm_f "test.xml"
154
+ FileUtils.rm_f "test.sts.xml"
155
+ FileUtils.rm_f "test.iso.sts.xml"
156
+ File.open("test.xml", "w") { |f| f.write inputxml }
157
+ processor.output(inputxml, "test.xml", "test.sts.xml", :sts)
158
+ processor.output(inputxml, "test.xml", "test.iso.sts.xml", :isosts)
159
+ expect(File.exist?("test.sts.xml")).to be true
160
+ expect(File.exist?("test.iso.sts.xml")).to be true
161
+ end
66
162
  end