metanorma-iso 1.5.10 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +66 -0
  3. data/README.adoc +5 -6
  4. data/lib/asciidoctor/iso/base.rb +5 -5
  5. data/lib/asciidoctor/iso/basicdoc.rng +50 -3
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  7. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  8. data/lib/asciidoctor/iso/cleanup.rb +38 -6
  9. data/lib/asciidoctor/iso/front.rb +5 -0
  10. data/lib/asciidoctor/iso/isodoc.rng +36 -43
  11. data/lib/asciidoctor/iso/isostandard.rng +11 -0
  12. data/lib/asciidoctor/iso/validate.rb +1 -1
  13. data/lib/asciidoctor/iso/validate_section.rb +9 -0
  14. data/lib/isodoc/iso/base_convert.rb +2 -1
  15. data/lib/isodoc/iso/html/header.html +12 -24
  16. data/lib/isodoc/iso/html/htmlstyle.css +1 -1
  17. data/lib/isodoc/iso/html/htmlstyle.scss +1 -1
  18. data/lib/isodoc/iso/html/isodoc.css +42 -42
  19. data/lib/isodoc/iso/html/isodoc.scss +42 -42
  20. data/lib/isodoc/iso/html/style-human.css +13 -9
  21. data/lib/isodoc/iso/html/style-human.scss +7 -7
  22. data/lib/isodoc/iso/html/style-iso.css +11 -7
  23. data/lib/isodoc/iso/html/style-iso.scss +5 -5
  24. data/lib/isodoc/iso/html/wordstyle.css +67 -67
  25. data/lib/isodoc/iso/html/wordstyle.scss +67 -67
  26. data/lib/isodoc/iso/html_convert.rb +4 -0
  27. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  28. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  29. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  30. data/lib/isodoc/iso/i18n.rb +10 -11
  31. data/lib/isodoc/iso/iso.amendment.xsl +391 -88
  32. data/lib/isodoc/iso/iso.international-standard.xsl +391 -88
  33. data/lib/isodoc/iso/metadata.rb +20 -19
  34. data/lib/isodoc/iso/word_convert.rb +4 -0
  35. data/lib/isodoc/iso/xref.rb +10 -0
  36. data/lib/metanorma/iso/processor.rb +11 -9
  37. data/lib/metanorma/iso/version.rb +1 -1
  38. data/metanorma-iso.gemspec +2 -2
  39. data/spec/asciidoctor-iso/base_spec.rb +26 -14
  40. data/spec/asciidoctor-iso/blocks_spec.rb +1 -1
  41. data/spec/asciidoctor-iso/cleanup_spec.rb +11 -5
  42. data/spec/asciidoctor-iso/lists_spec.rb +6 -6
  43. data/spec/asciidoctor-iso/refs_spec.rb +174 -143
  44. data/spec/asciidoctor-iso/section_spec.rb +5 -0
  45. data/spec/asciidoctor-iso/validate_spec.rb +18 -1
  46. data/spec/isodoc/amd_spec.rb +187 -22
  47. data/spec/isodoc/blocks_spec.rb +1 -0
  48. data/spec/isodoc/i18n_spec.rb +9 -22
  49. data/spec/isodoc/inline_spec.rb +1 -1
  50. data/spec/isodoc/metadata_spec.rb +170 -3
  51. data/spec/isodoc/postproc_spec.rb +2 -5
  52. data/spec/isodoc/ref_spec.rb +4 -7
  53. data/spec/isodoc/section_spec.rb +20 -0
  54. data/spec/isodoc/xref_spec.rb +12 -0
  55. data/spec/spec_helper.rb +17 -1
  56. metadata +8 -12
  57. data/.github/workflows/macos.yml +0 -41
  58. data/.github/workflows/ubuntu.yml +0 -45
  59. data/.github/workflows/windows.yml +0 -43
  60. data/lib/asciidoctor/iso/macros.rb +0 -21
  61. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
  62. data/spec/asciidoctor-iso/macros_spec.rb +0 -310
@@ -1,310 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Asciidoctor::ISO do
4
- it "processes the Asciidoctor::ISO inline macros" do
5
- expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
- #{ASCIIDOC_BLANK_HDR}
7
- alt:[term1]
8
- deprecated:[term1]
9
- domain:[term1]
10
- INPUT
11
- #{BLANK_HDR}
12
- <sections>
13
- <admitted>term1</admitted>
14
- <deprecates>term1</deprecates>
15
- <domain>term1</domain>
16
- </sections>
17
- </iso-standard>
18
- OUTPUT
19
- end
20
-
21
- describe 'term inline macros' do
22
- subject(:convert) do
23
- xmlpp(
24
- strip_guid(
25
- Asciidoctor.convert(
26
- input, backend: :iso, header_footer: true)))
27
- end
28
- let(:input) do
29
- <<~XML
30
- #{ASCIIDOC_BLANK_HDR}
31
- == Terms and Definitions
32
-
33
- === name2
34
-
35
- == Main
36
-
37
- term:[name,name2] is a term
38
- XML
39
- end
40
- let(:output) do
41
- <<~XML
42
- #{BLANK_HDR}
43
- <sections>
44
- <terms id='_' obligation='normative'>
45
- <title>Terms and definitions</title>
46
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
47
- <p id='_'>
48
- ISO and IEC maintain terminological databases for use in standardization
49
- at the following addresses:
50
- </p>
51
- <ul id='_'>
52
- <li>
53
- <p id='_'>
54
- ISO Online browsing platform: available at
55
- <link target='http://www.iso.org/obp'/>
56
- </p>
57
- </li>
58
- <li>
59
- <p id='_'>
60
- IEC Electropedia: available at
61
- <link target='http://www.electropedia.org'/>
62
- </p>
63
- </li>
64
- </ul>
65
- <term id='term-name2'>
66
- <preferred>name2</preferred>
67
- </term>
68
- </terms>
69
- <clause id='_' inline-header='false' obligation='normative'>
70
- <title>Main</title>
71
- <p id='_'>
72
- <em>name</em>
73
- (
74
- <xref target='term-name2'/>
75
- ) is a term
76
- </p>
77
- </clause>
78
- </sections>
79
- </iso-standard>
80
- XML
81
- end
82
-
83
- it 'converts macro into the correct xml' do
84
- expect(convert).to(be_equivalent_to(xmlpp(output)))
85
- end
86
-
87
- context 'default params' do
88
- let(:input) do
89
- <<~XML
90
- #{ASCIIDOC_BLANK_HDR}
91
-
92
- == Terms and Definitions
93
-
94
- === name
95
-
96
- == Main
97
-
98
- term:[name] is a term
99
- XML
100
- end
101
- let(:output) do
102
- <<~XML
103
- #{BLANK_HDR}
104
- <sections>
105
- <terms id='_' obligation='normative'>
106
- <title>Terms and definitions</title>
107
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
108
- <p id='_'>
109
- ISO and IEC maintain terminological databases for use in standardization
110
- at the following addresses:
111
- </p>
112
- <ul id='_'>
113
- <li>
114
- <p id='_'>
115
- ISO Online browsing platform: available at
116
- <link target='http://www.iso.org/obp' />
117
- </p>
118
- </li>
119
- <li>
120
- <p id='_'>
121
- IEC Electropedia: available at
122
- <link target='http://www.electropedia.org' />
123
- </p>
124
- </li>
125
- </ul>
126
- <term id='term-name'>
127
- <preferred>name</preferred>
128
- </term>
129
- </terms>
130
- <clause id='_' inline-header='false' obligation='normative'>
131
- <title>Main</title>
132
- <p id='_'>
133
- <em>name</em>
134
- (
135
- <xref target='term-name' />
136
- ) is a term
137
- </p>
138
- </clause>
139
- </sections>
140
- </iso-standard>
141
- XML
142
- end
143
-
144
- it 'uses `name` as termref name' do
145
- expect(convert).to(be_equivalent_to(xmlpp(output)))
146
- end
147
- end
148
-
149
- context 'multiply exising ids in document' do
150
- let(:input) do
151
- <<~XML
152
- #{ASCIIDOC_BLANK_HDR}
153
-
154
- == Terms and Definitions
155
-
156
- === name
157
- === name2
158
-
159
- [[term-name]]
160
- == Main
161
-
162
- paragraph
163
-
164
- [[term-name2]]
165
- == Second
166
-
167
- term:[name] is a term
168
- term:[name2] is a term
169
- XML
170
- end
171
- let(:output) do
172
- <<~XML
173
- #{BLANK_HDR}
174
- <sections>
175
- <terms id='_' obligation='normative'>
176
- <title>Terms and definitions</title>
177
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
178
- <p id='_'>
179
- ISO and IEC maintain terminological databases for use in standardization
180
- at the following addresses:
181
- </p>
182
- <ul id='_'>
183
- <li>
184
- <p id='_'>
185
- ISO Online browsing platform: available at
186
- <link target='http://www.iso.org/obp' />
187
- </p>
188
- </li>
189
- <li>
190
- <p id='_'>
191
- IEC Electropedia: available at
192
- <link target='http://www.electropedia.org' />
193
- </p>
194
- </li>
195
- </ul>
196
- <term id='term-name-1'>
197
- <preferred>name</preferred>
198
- </term>
199
- <term id='term-name2-1'>
200
- <preferred>name2</preferred>
201
- </term>
202
- </terms>
203
- <clause id='term-name' inline-header='false' obligation='normative'>
204
- <title>Main</title>
205
- <p id='_'>paragraph</p>
206
- </clause>
207
- <clause id='term-name2' inline-header='false' obligation='normative'>
208
- <title>Second</title>
209
- <p id='_'>
210
- <em>name</em>
211
- (
212
- <xref target='term-name-1' />
213
- ) is a term
214
- <em>name2</em>
215
- (
216
- <xref target='term-name2-1' />
217
- ) is a term
218
- </p>
219
- </clause>
220
- </sections>
221
- </iso-standard>
222
- XML
223
- end
224
-
225
- it 'generates unique ids which dont match existing ids' do
226
- expect(convert).to(be_equivalent_to(xmlpp(output)))
227
- end
228
- end
229
-
230
- context 'when missing actual ref' do
231
- let(:input) do
232
- <<~XML
233
- #{ASCIIDOC_BLANK_HDR}
234
-
235
- == Terms and Definitions
236
-
237
- === name identity
238
-
239
- [[name-check]]
240
- === name check
241
-
242
- paragraph
243
-
244
- term:[name check] is a term
245
-
246
- term:[name identity] is a term
247
-
248
- Moreover, term:[missing] is a term
249
- XML
250
- end
251
- let(:output) do
252
- <<~XML
253
- #{BLANK_HDR}
254
- <sections>
255
- <terms id='_' obligation='normative'>
256
- <title>Terms and definitions</title>
257
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
258
- <p id='_'>
259
- ISO and IEC maintain terminological databases for use in standardization
260
- at the following addresses:
261
- </p>
262
- <ul id='_'>
263
- <li>
264
- <p id='_'>
265
- ISO Online browsing platform: available at
266
- <link target='http://www.iso.org/obp'/>
267
- </p>
268
- </li>
269
- <li>
270
- <p id='_'>
271
- IEC Electropedia: available at
272
- <link target='http://www.electropedia.org'/>
273
- </p>
274
- </li>
275
- </ul>
276
- <term id='term-name-identity'>
277
- <preferred>name identity</preferred>
278
- </term>
279
- <term id='name-check'>
280
- <preferred>name check</preferred>
281
- <definition>
282
- <p id='_'>paragraph</p>
283
- <p id='_'>
284
- <em>name check</em>
285
- (
286
- <xref target='name-check'/>
287
- ) is a term
288
- </p>
289
- <p id='_'>
290
- <em>name identity</em>
291
- (
292
- <xref target='term-name-identity'/>
293
- ) is a term
294
- </p>
295
- <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
296
- </p>
297
- </definition>
298
- </term>
299
- </terms>
300
- </sections>
301
- </iso-standard>
302
- XML
303
- end
304
-
305
- it 'generates unique ids which dont match existing ids' do
306
- expect(convert).to(be_equivalent_to(xmlpp(output)))
307
- end
308
- end
309
- end
310
- end