metanorma-bsi 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of metanorma-bsi might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +43 -0
- data/.github/workflows/release_github_packages.yml +49 -0
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/README.adoc +95 -11
- data/lib/asciidoctor/bsi/biblio.rng +1 -0
- data/lib/asciidoctor/bsi/bsi.rng +32 -4
- data/lib/asciidoctor/bsi/bsi_intro_en.xml +87 -61
- data/lib/asciidoctor/bsi/cleanup.rb +15 -8
- data/lib/asciidoctor/bsi/cleanup_ref.rb +10 -21
- data/lib/asciidoctor/bsi/converter.rb +7 -5
- data/lib/asciidoctor/bsi/front.rb +26 -5
- data/lib/asciidoctor/bsi/isodoc.rng +191 -3
- data/lib/asciidoctor/bsi/isostandard.rng +12 -0
- data/lib/asciidoctor/bsi/validate.rb +5 -6
- data/lib/asciidoctor/bsi/validate_list.rb +2 -2
- data/lib/isodoc/bsi/base_convert.rb +2 -1
- data/lib/isodoc/bsi/bsi.international-standard.xsl +3380 -2349
- data/lib/isodoc/bsi/html/htmlstyle.css +43 -22
- data/lib/isodoc/bsi/html/htmlstyle.scss +46 -22
- data/lib/isodoc/bsi/html_convert.rb +2 -2
- data/lib/isodoc/bsi/i18n-en.yaml +4 -4
- data/lib/isodoc/bsi/metadata.rb +2 -2
- data/lib/isodoc/bsi/presentation_xml_convert.rb +26 -5
- data/lib/isodoc/bsi/xref.rb +11 -4
- data/lib/metanorma/bsi/version.rb +1 -1
- data/metanorma-bsi.gemspec +2 -2
- data/spec/asciidoctor/base_spec.rb +564 -494
- data/spec/asciidoctor/blocks_spec.rb +192 -195
- data/spec/asciidoctor/cleanup_spec.rb +361 -361
- data/spec/asciidoctor/refs_spec.rb +8 -78
- data/spec/asciidoctor/section_spec.rb +227 -227
- data/spec/asciidoctor/validate_spec.rb +26 -1
- data/spec/isodoc/blocks_spec.rb +56 -21
- data/spec/isodoc/i18n_spec.rb +156 -234
- data/spec/isodoc/inline_spec.rb +7 -7
- data/spec/isodoc/iso_spec.rb +4 -4
- data/spec/isodoc/metadata_spec.rb +0 -1
- data/spec/isodoc/ref_spec.rb +7 -7
- data/spec/isodoc/section_spec.rb +400 -343
- data/spec/isodoc/terms_spec.rb +224 -225
- data/spec/isodoc/xref_spec.rb +1347 -1360
- data/spec/metanorma/processor_spec.rb +37 -40
- data/spec/spec_helper.rb +6 -4
- data/spec/vcr_cassettes/iso-639.yml +19 -19
- data/spec/vcr_cassettes/isobib_get_639_1967.yml +17 -17
- data/spec/vcr_cassettes/multistandard.yml +15 -193
- metadata +7 -5
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -3,244 +3,243 @@ require "spec_helper"
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML terms" do
|
5
5
|
input = <<~INPUT
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
<
|
11
|
-
<
|
12
|
-
<
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
<
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
<
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
</
|
34
|
-
|
35
|
-
<
|
36
|
-
<
|
37
|
-
<
|
38
|
-
<
|
39
|
-
|
40
|
-
<termnote id="_671a1994-4783-40d0-bc81-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
<
|
45
|
-
|
46
|
-
</
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</
|
52
|
-
|
53
|
-
|
54
|
-
</
|
55
|
-
</terms>
|
56
|
-
</sections>
|
57
|
-
</iso-standard>
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<sections>
|
8
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
|
9
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
10
|
+
<domain>rice</domain>
|
11
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
12
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74a">
|
13
|
+
<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>
|
14
|
+
</termnote>
|
15
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
16
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
17
|
+
<ul>
|
18
|
+
<li>A</li>
|
19
|
+
</ul>
|
20
|
+
</termexample>
|
21
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
22
|
+
<ul>
|
23
|
+
<li>A</li>
|
24
|
+
</ul>
|
25
|
+
</termexample>
|
26
|
+
<termsource status="modified">
|
27
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
28
|
+
<modification>
|
29
|
+
<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>
|
30
|
+
</modification>
|
31
|
+
</termsource></term>
|
32
|
+
<term id="paddy">
|
33
|
+
<preferred>paddy</preferred><admitted>paddy rice</admitted>
|
34
|
+
<admitted>rough rice</admitted>
|
35
|
+
<deprecates>cargo rice</deprecates>
|
36
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
37
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
38
|
+
<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>
|
39
|
+
</termnote>
|
40
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
41
|
+
<ul><li>A</li></ul>
|
42
|
+
<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>
|
43
|
+
</termnote>
|
44
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
45
|
+
<ul>
|
46
|
+
<li>A</li>
|
47
|
+
</ul>
|
48
|
+
</termexample>
|
49
|
+
<termsource status="identical">
|
50
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
|
51
|
+
</termsource></term>
|
52
|
+
</terms>
|
53
|
+
</sections>
|
54
|
+
</iso-standard>
|
58
55
|
INPUT
|
59
56
|
presxml = <<~INPUT
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
</p>
|
81
|
-
</termnote>
|
82
|
-
<termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892'>
|
83
|
-
<name>EXAMPLE 1</name>
|
84
|
-
<p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
|
85
|
-
<ul>
|
86
|
-
<li>A</li>
|
87
|
-
</ul>
|
88
|
-
</termexample>
|
89
|
-
<termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f894'>
|
90
|
-
<name>EXAMPLE 2</name>
|
91
|
-
<ul>
|
92
|
-
<li>A</li>
|
93
|
-
</ul>
|
94
|
-
</termexample>
|
95
|
-
<termsource status='modified'>
|
96
|
-
<origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'>
|
97
|
-
<locality type='clause'>
|
98
|
-
<referenceFrom>3.1</referenceFrom>
|
99
|
-
</locality>
|
100
|
-
ISO 7301:2011, 3.1
|
101
|
-
</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
|
57
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
58
|
+
<sections>
|
59
|
+
<terms id='_terms_and_definitions' obligation='normative' displayorder='1'>
|
60
|
+
<title depth='1'>
|
61
|
+
1
|
62
|
+
<tab/>
|
63
|
+
Terms and definitions
|
64
|
+
</title>
|
65
|
+
<term id='paddy1'>
|
66
|
+
<name>1.1</name>
|
67
|
+
<preferred>paddy</preferred>
|
68
|
+
<domain>rice</domain>
|
69
|
+
<definition>
|
70
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
71
|
+
</definition>
|
72
|
+
<termnote id='_671a1994-4783-40d0-bc81-987d06ffb74a'>
|
73
|
+
<name>NOTE</name>
|
74
|
+
<p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
|
75
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
76
|
+
kernels have a tendency to stick together after cooking.
|
106
77
|
</p>
|
107
|
-
</
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
<
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
</
|
135
|
-
</
|
136
|
-
<
|
137
|
-
<name>
|
138
|
-
<
|
139
|
-
|
140
|
-
</
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
</
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
78
|
+
</termnote>
|
79
|
+
<termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892'>
|
80
|
+
<name>EXAMPLE 1</name>
|
81
|
+
<p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
|
82
|
+
<ul>
|
83
|
+
<li>A</li>
|
84
|
+
</ul>
|
85
|
+
</termexample>
|
86
|
+
<termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f894'>
|
87
|
+
<name>EXAMPLE 2</name>
|
88
|
+
<ul>
|
89
|
+
<li>A</li>
|
90
|
+
</ul>
|
91
|
+
</termexample>
|
92
|
+
<termsource status='modified'>
|
93
|
+
<origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'>
|
94
|
+
<locality type='clause'>
|
95
|
+
<referenceFrom>3.1</referenceFrom>
|
96
|
+
</locality>
|
97
|
+
ISO 7301:2011, 3.1
|
98
|
+
</origin>
|
99
|
+
<modification>
|
100
|
+
<p id='_e73a417d-ad39-417d-a4c8-20e4e2529489'>
|
101
|
+
The term "cargo rice" is shown as deprecated, and Note 1 to entry
|
102
|
+
is not included here
|
103
|
+
</p>
|
104
|
+
</modification>
|
105
|
+
</termsource>
|
106
|
+
</term>
|
107
|
+
<term id='paddy'>
|
108
|
+
<name>1.2</name>
|
109
|
+
<preferred>paddy</preferred>
|
110
|
+
<admitted>paddy rice</admitted>
|
111
|
+
<admitted>rough rice</admitted>
|
112
|
+
<deprecates>cargo rice</deprecates>
|
113
|
+
<definition>
|
114
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
115
|
+
</definition>
|
116
|
+
<termnote id='_671a1994-4783-40d0-bc81-987d06ffb74e'>
|
117
|
+
<name>NOTE 1</name>
|
118
|
+
<p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
|
119
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
120
|
+
kernels have a tendency to stick together after cooking.
|
121
|
+
</p>
|
122
|
+
</termnote>
|
123
|
+
<termnote id='_671a1994-4783-40d0-bc81-987d06ffb74f'>
|
124
|
+
<name>NOTE 2</name>
|
125
|
+
<ul>
|
126
|
+
<li>A</li>
|
127
|
+
</ul>
|
128
|
+
<p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
|
129
|
+
The starch of waxy rice consists almost entirely of amylopectin. The
|
130
|
+
kernels have a tendency to stick together after cooking.
|
131
|
+
</p>
|
132
|
+
</termnote>
|
133
|
+
<termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f893'>
|
134
|
+
<name>EXAMPLE</name>
|
135
|
+
<ul>
|
136
|
+
<li>A</li>
|
137
|
+
</ul>
|
138
|
+
</termexample>
|
139
|
+
<termsource status='identical'>
|
140
|
+
<origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'>
|
141
|
+
<locality type='clause'>
|
142
|
+
<referenceFrom>3.1</referenceFrom>
|
143
|
+
</locality>
|
144
|
+
ISO 7301:2011, 3.1
|
145
|
+
</origin>
|
146
|
+
</termsource>
|
147
|
+
</term>
|
148
|
+
</terms>
|
149
|
+
</sections>
|
150
|
+
</iso-standard>
|
154
151
|
INPUT
|
155
152
|
html = <<~OUTPUT
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
<p>
|
193
|
-
[TERMREF]
|
194
|
-
<a href='#ISO7301'> ISO 7301:2011, 3.1 </a>
|
195
|
-
[MODIFICATION] The term "cargo rice" is shown as deprecated, and Note
|
196
|
-
1 to entry is not included here [/TERMREF]
|
197
|
-
</p>
|
198
|
-
<p class='TermNum' id='paddy'>1.2</p>
|
199
|
-
<p class='Terms' style='text-align:left;'>paddy</p>
|
200
|
-
<p class='AltTerms' style='text-align:left;'>paddy rice</p>
|
201
|
-
<p class='AltTerms' style='text-align:left;'>rough rice</p>
|
202
|
-
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
|
203
|
-
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
204
|
-
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
|
205
|
-
<p>
|
206
|
-
<span class='example_label'>EXAMPLE</span>
|
207
|
-
 
|
208
|
-
</p>
|
209
|
-
<ul>
|
210
|
-
<li>A</li>
|
211
|
-
</ul>
|
212
|
-
</div>
|
213
|
-
<div id='_671a1994-4783-40d0-bc81-987d06ffb74e' class='Note'>
|
153
|
+
#{HTML_HDR}
|
154
|
+
<div id="">
|
155
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
156
|
+
<div class="boilerplate_legal"/>
|
157
|
+
</div>
|
158
|
+
#{IEC_TITLE1}
|
159
|
+
<div id='_terms_and_definitions'>
|
160
|
+
<h1> 1   Terms and definitions </h1>
|
161
|
+
<p class='TermNum' id='paddy1'>1.1</p>
|
162
|
+
<p class='Terms' style='text-align:left;'>paddy</p>
|
163
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'><rice> rice retaining its husk after threshing</p>
|
164
|
+
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
|
165
|
+
<p>
|
166
|
+
<span class='example_label'>EXAMPLE 1</span>
|
167
|
+
 Foreign seeds, husks, bran, sand, dust.
|
168
|
+
</p>
|
169
|
+
<ul>
|
170
|
+
<li>A</li>
|
171
|
+
</ul>
|
172
|
+
</div>
|
173
|
+
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
|
174
|
+
<p>
|
175
|
+
<span class='example_label'>EXAMPLE 2</span>
|
176
|
+
 
|
177
|
+
</p>
|
178
|
+
<ul>
|
179
|
+
<li>A</li>
|
180
|
+
</ul>
|
181
|
+
</div>
|
182
|
+
<div id='_671a1994-4783-40d0-bc81-987d06ffb74a' class='Note'>
|
183
|
+
<p>
|
184
|
+
NOTE: The starch of waxy rice consists almost entirely of
|
185
|
+
amylopectin. The kernels have a tendency to stick together after
|
186
|
+
cooking.
|
187
|
+
</p>
|
188
|
+
</div>
|
214
189
|
<p>
|
215
|
-
|
216
|
-
|
217
|
-
|
190
|
+
[TERMREF]
|
191
|
+
<a href='#ISO7301'> ISO 7301:2011, 3.1 </a>
|
192
|
+
[MODIFICATION] The term "cargo rice" is shown as deprecated, and Note
|
193
|
+
1 to entry is not included here [/TERMREF]
|
218
194
|
</p>
|
219
|
-
|
220
|
-
|
221
|
-
<p>
|
222
|
-
|
195
|
+
<p class='TermNum' id='paddy'>1.2</p>
|
196
|
+
<p class='Terms' style='text-align:left;'>paddy</p>
|
197
|
+
<p class='AltTerms' style='text-align:left;'>paddy rice</p>
|
198
|
+
<p class='AltTerms' style='text-align:left;'>rough rice</p>
|
199
|
+
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
|
200
|
+
<p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
|
201
|
+
<div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
|
202
|
+
<p>
|
203
|
+
<span class='example_label'>EXAMPLE</span>
|
204
|
+
 
|
205
|
+
</p>
|
223
206
|
<ul>
|
224
207
|
<li>A</li>
|
225
208
|
</ul>
|
226
|
-
|
227
|
-
|
228
|
-
|
209
|
+
</div>
|
210
|
+
<div id='_671a1994-4783-40d0-bc81-987d06ffb74e' class='Note'>
|
211
|
+
<p>
|
212
|
+
NOTE 1: The starch of waxy rice consists almost entirely of
|
213
|
+
amylopectin. The kernels have a tendency to stick together after
|
214
|
+
cooking.
|
229
215
|
</p>
|
216
|
+
</div>
|
217
|
+
<div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class='Note'>
|
218
|
+
<p>
|
219
|
+
NOTE 2:
|
220
|
+
<ul>
|
221
|
+
<li>A</li>
|
222
|
+
</ul>
|
223
|
+
<p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
|
224
|
+
The starch of waxy rice consists almost entirely of amylopectin.
|
225
|
+
The kernels have a tendency to stick together after cooking.
|
226
|
+
</p>
|
227
|
+
</p>
|
228
|
+
</div>
|
229
|
+
<p>
|
230
|
+
[TERMREF]
|
231
|
+
<a href='#ISO7301'> ISO 7301:2011, 3.1 </a>
|
232
|
+
[/TERMREF]
|
230
233
|
</p>
|
231
234
|
</div>
|
232
|
-
<p>
|
233
|
-
[TERMREF]
|
234
|
-
<a href='#ISO7301'> ISO 7301:2011, 3.1 </a>
|
235
|
-
[/TERMREF]
|
236
|
-
</p>
|
237
235
|
</div>
|
238
|
-
</
|
239
|
-
</
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({})
|
236
|
+
</body>
|
237
|
+
</html>
|
238
|
+
OUTPUT
|
239
|
+
|
240
|
+
expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
|
241
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
242
|
+
expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({})
|
243
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
245
244
|
end
|
246
245
|
end
|