metanorma-standoc 2.2.5 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/automerge.yml +31 -0
  3. data/lib/isodoc/html/htmlstyle.css +1 -1
  4. data/lib/metanorma/standoc/base.rb +1 -0
  5. data/lib/metanorma/standoc/basicdoc.rng +0 -27
  6. data/lib/metanorma/standoc/biblio-standoc.rng +164 -0
  7. data/lib/metanorma/standoc/biblio.rng +45 -18
  8. data/lib/metanorma/standoc/cleanup.rb +1 -0
  9. data/lib/metanorma/standoc/cleanup_asciibib.rb +110 -0
  10. data/lib/metanorma/standoc/cleanup_biblio.rb +5 -111
  11. data/lib/metanorma/standoc/cleanup_block.rb +7 -6
  12. data/lib/metanorma/standoc/cleanup_boilerplate.rb +6 -6
  13. data/lib/metanorma/standoc/cleanup_inline.rb +2 -2
  14. data/lib/metanorma/standoc/cleanup_text.rb +10 -3
  15. data/lib/metanorma/standoc/inline.rb +3 -1
  16. data/lib/metanorma/standoc/isodoc-compile.rng +7 -0
  17. data/lib/metanorma/standoc/isodoc.rng +23 -195
  18. data/lib/metanorma/standoc/validate.rb +8 -8
  19. data/lib/metanorma/standoc/version.rb +1 -1
  20. data/metanorma-standoc.gemspec +0 -1
  21. data/spec/metanorma/biblio_spec.rb +152 -144
  22. data/spec/metanorma/cleanup_sections_spec.rb +1 -2
  23. data/spec/metanorma/cleanup_spec.rb +11 -0
  24. data/spec/metanorma/inline_spec.rb +63 -2
  25. data/spec/metanorma/macros_plantuml_spec.rb +4 -4
  26. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +3 -3
  27. data/spec/vcr_cassettes/bsi16341.yml +70 -72
  28. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +82 -82
  29. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  30. data/spec/vcr_cassettes/hide_refs.yml +58 -58
  31. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  32. data/spec/vcr_cassettes/isobib_get_123_1.yml +22 -22
  33. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
  34. data/spec/vcr_cassettes/isobib_get_123_2.yml +25 -25
  35. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  36. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  37. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +37 -21
  38. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -45
  39. data/spec/vcr_cassettes/std-link.yml +12 -12
  40. metadata +6 -16
@@ -12,22 +12,22 @@ RSpec.describe Metanorma::Standoc do
12
12
  === Standard
13
13
  id:: iso123
14
14
  docid::
15
- type::: ISO
16
- id::: ISO 123
15
+ type::: ISO
16
+ id::: ISO 123
17
17
  type:: standard
18
18
  contributor::
19
- role::: publisher
20
- organization:::
21
- name:::: ISO
19
+ role::: publisher
20
+ organization:::
21
+ name:::: ISO
22
22
  contributor::
23
- role::: author
24
- person:::
25
- name::::
23
+ role::: author
24
+ person:::
25
+ name::::
26
26
  +
27
27
  --
28
28
  completename::
29
- language::: en
30
- content::: Fred
29
+ language::: en
30
+ content::: Fred
31
31
  --
32
32
  contributor::
33
33
  role::: author
@@ -89,118 +89,118 @@ RSpec.describe Metanorma::Standoc do
89
89
  === Other Title
90
90
  fetched:: 2019-06-30
91
91
  title::
92
- type::: main
93
- content::: Geographic information
92
+ type::: main
93
+ content::: Geographic information
94
94
  title::
95
- type::: subtitle
96
- content::: Geographic information subtitle
97
- language::: en
98
- script::: Latn
99
- format::: text/plain
95
+ type::: subtitle
96
+ content::: Geographic information subtitle
97
+ language::: en
98
+ script::: Latn
99
+ format::: text/plain
100
100
  type:: standard
101
101
  docid::
102
- type::: ISO
103
- id::: TC211
104
- primary::: true
102
+ type::: ISO
103
+ id::: TC211
104
+ primary::: true
105
105
  docnumber:: 211
106
106
  edition:: 1
107
107
  language::
108
- . en
109
- . fr
108
+ . en
109
+ . fr
110
110
  script:: Latn
111
111
  version::
112
- revision_date::: 2019-04-01
113
- draft::: draft
112
+ revision_date::: 2019-04-01
113
+ draft::: draft
114
114
  biblionote::
115
- type::: bibnote
116
- content:::
115
+ type::: bibnote
116
+ content:::
117
117
  +
118
118
  --
119
119
  Mark set a major league
120
120
  home run record in 1998.
121
121
  --
122
122
  docstatus::
123
- stage::: stage
124
- substage::: substage
125
- iteration::: iteration
123
+ stage::: stage
124
+ substage::: substage
125
+ iteration::: iteration
126
126
  date::
127
- type::: issued
128
- value::: 2014
127
+ type::: issued
128
+ value::: 2014
129
129
  date::
130
- type::: published
131
- from::: 2014-04
132
- to::: 2014-05
130
+ type::: published
131
+ from::: 2014-04
132
+ to::: 2014-05
133
133
  date::
134
- type::: accessed
135
- value::: 2015-05-20
134
+ type::: accessed
135
+ value::: 2015-05-20
136
136
  abstract::
137
- content:::
137
+ content:::
138
138
  +
139
139
  --
140
140
  ISO 19115-1:2014 defines the schema required for ...
141
141
  --
142
142
  abstract::
143
- content::: L'ISO 19115-1:2014 définit le schéma requis pour ...
144
- language::: fr
145
- script::: Latn
146
- format::: text/plain
143
+ content::: L'ISO 19115-1:2014 définit le schéma requis pour ...
144
+ language::: fr
145
+ script::: Latn
146
+ format::: text/plain
147
147
  copyright::
148
- owner:::
149
- name:::: International Organization for Standardization
150
- abbreviation:::: ISO
151
- url:::: www.iso.org
152
- from::: 2014
153
- to::: #{Time.now.year}
148
+ owner:::
149
+ name:::: International Organization for Standardization
150
+ abbreviation:::: ISO
151
+ url:::: www.iso.org
152
+ from::: 2014
153
+ to::: #{Time.now.year}
154
154
  link::
155
- type::: src
156
- content::: https://www.iso.org/standard/53798.html
155
+ type::: src
156
+ content::: https://www.iso.org/standard/53798.html
157
157
  link::
158
- type::: obp
159
- content::: https://www.iso.org/obp/ui/#!iso:std:53798:en
158
+ type::: obp
159
+ content::: https://www.iso.org/obp/ui/#!iso:std:53798:en
160
160
  link::
161
- type::: rss
162
- content::: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss
161
+ type::: rss
162
+ content::: https://www.iso.org/contents/data/standard/05/37/53798.detail.rss
163
163
  medium::
164
- form::: medium form
165
- size::: medium size
166
- scale::: medium scale
164
+ form::: medium form
165
+ size::: medium size
166
+ scale::: medium scale
167
167
  place:: bib place
168
168
  extent::
169
- locality:::
170
- type:::: section
171
- reference_from:::: 7
169
+ locality:::
170
+ type:::: section
171
+ reference_from:::: 7
172
172
  accesslocation::
173
- . accesslocation1
174
- . accesslocation2
173
+ . accesslocation1
174
+ . accesslocation2
175
175
  classification::
176
- type::: type
177
- value::: value
176
+ type::: type
177
+ value::: value
178
178
  validity::
179
- begins::: 2010-10-10 12:21
180
- ends::: 2011-02-03 18:30
179
+ begins::: 2010-10-10 12:21
180
+ ends::: 2011-02-03 18:30
181
181
 
182
182
 
183
183
  ==== Contributor
184
184
  organization::
185
- name::: International Organization for Standardization
186
- url::: www.iso.org
187
- abbreviation::: ISO
188
- subdivision::: division
185
+ name::: International Organization for Standardization
186
+ url::: www.iso.org
187
+ abbreviation::: ISO
188
+ subdivision::: division
189
189
  role::
190
- type::: publisher
191
- description::: Publisher role
190
+ type::: publisher
191
+ description::: Publisher role
192
192
 
193
193
  ==== Contributor
194
194
  person::
195
- name:::
196
- completename::::
195
+ name:::
196
+ completename::::
197
197
  +
198
198
  --
199
199
  content:: A. Bierman
200
200
  language:: en
201
201
  --
202
- affiliation:::
203
- organization::::
202
+ affiliation:::
203
+ organization::::
204
204
  +
205
205
  --
206
206
  name:: IETF
@@ -209,81 +209,81 @@ RSpec.describe Metanorma::Standoc do
209
209
  type::: uri
210
210
  id::: www.ietf.org
211
211
  --
212
- description:::: Affiliation description
213
- contact:::
214
- street::::
215
- . 8 Street St
216
- city:::: City
217
- postcode:::: 123456
218
- country:::: Country
219
- state:::: State
220
- contact:::
221
- type:::: phone
222
- value:::: 223322
212
+ description:::: Affiliation description
213
+ contact:::
214
+ street::::
215
+ . 8 Street St
216
+ city:::: City
217
+ postcode:::: 123456
218
+ country:::: Country
219
+ state:::: State
220
+ contact:::
221
+ type:::: phone
222
+ value:::: 223322
223
223
  role:: author
224
224
 
225
225
  ==== Contributor
226
226
  organization::
227
- name::: IETF
228
- abbreviation::: IETF
229
- identifier:::
230
- type:::: uri
231
- id:::: www.ietf.org
227
+ name::: IETF
228
+ abbreviation::: IETF
229
+ identifier:::
230
+ type:::: uri
231
+ id:::: www.ietf.org
232
232
  role:: publisher
233
233
 
234
234
  ==== Contributor
235
235
  person::
236
- name:::
237
- language:::: en
238
- formatted_initials:::: A.
239
- surname:::: Bierman
240
- affiliation:::
236
+ name:::
237
+ language:::: en
238
+ formatted_initials:::: A.
239
+ surname:::: Bierman
240
+ affiliation:::
241
241
  +
242
242
  --
243
243
  organization::
244
- name::: IETF
245
- abbreviation::: IETF
244
+ name::: IETF
245
+ abbreviation::: IETF
246
246
  description::
247
- content::: Affiliation description
248
- language::: en
249
- script::: Latn
247
+ content::: Affiliation description
248
+ language::: en
249
+ script::: Latn
250
250
  --
251
- identifier:::
252
- type:::: uri
253
- id:::: www.person.com
251
+ identifier:::
252
+ type:::: uri
253
+ id:::: www.person.com
254
254
  role:: author
255
255
 
256
256
  ==== Relation
257
257
  type:: updates
258
258
  bibitem::
259
- title::: Geographic information
260
- formattedref::: ISO 19115:2003
261
- bib_locality:::
262
- type:::: page
263
- reference_from:::: 7
264
- reference_to:::: 10
259
+ title::: Geographic information
260
+ formattedref::: ISO 19115:2003
261
+ bib_locality:::
262
+ type:::: page
263
+ reference_from:::: 7
264
+ reference_to:::: 10
265
265
 
266
266
  ==== Relation
267
267
  type:: updates
268
268
  bibitem::
269
- type::: standard
270
- formattedref::: ISO 19115:2003/Cor 1:2006
271
- title::: Geographic information
269
+ type::: standard
270
+ formattedref::: ISO 19115:2003/Cor 1:2006
271
+ title::: Geographic information
272
272
 
273
273
  ==== Series
274
274
  type:: main
275
275
  title::
276
- type::: original
277
- content::: ISO/IEC FDIS 10118-3
278
- language::: en
279
- script::: Latn
280
- format::: text/plain
276
+ type::: original
277
+ content::: ISO/IEC FDIS 10118-3
278
+ language::: en
279
+ script::: Latn
280
+ format::: text/plain
281
281
  place:: Serie's place
282
282
  organization:: Serie's organization
283
283
  abbreviation::
284
- content::: ABVR
285
- language::: en
286
- script::: Latn
284
+ content::: ABVR
285
+ language::: en
286
+ script::: Latn
287
287
  from:: 2009-02-01
288
288
  to:: 2010-12-20
289
289
  number:: serie1234
@@ -293,9 +293,9 @@ RSpec.describe Metanorma::Standoc do
293
293
  type:: alt
294
294
  title:: seriestitle
295
295
  formattedref::
296
- content::: serieref
297
- language::: en
298
- script::: Latn
296
+ content::: serieref
297
+ language::: en
298
+ script::: Latn
299
299
 
300
300
  INPUT
301
301
  output = <<~OUTPUT
@@ -815,28 +815,28 @@ RSpec.describe Metanorma::Standoc do
815
815
  ==== Standard
816
816
  id:: iso123
817
817
  docid::
818
- type::: ISO
819
- id::: ISO 123
818
+ type::: ISO
819
+ id::: ISO 123
820
820
  type:: standard
821
821
  contributor::
822
- role::: publisher
823
- organization:::
824
- name:::: ISO
822
+ role::: publisher
823
+ organization:::
824
+ name:::: ISO
825
825
  contributor::
826
- role::: author
827
- person:::
828
- name::::
826
+ role::: author
827
+ person:::
828
+ name::::
829
829
  +
830
830
  --
831
831
  completename::
832
- language::: en
833
- content::: Fred
832
+ language::: en
833
+ content::: Fred
834
834
  --
835
835
  contributor::
836
- role::: author
837
- person:::
838
- name::::
839
- completename::::: Jack
836
+ role::: author
837
+ person:::
838
+ name::::
839
+ completename::::: Jack
840
840
 
841
841
  INPUT
842
842
  output = <<~OUTPUT
@@ -980,18 +980,26 @@ RSpec.describe Metanorma::Standoc do
980
980
  </bibitem>
981
981
  </relation>
982
982
  <extent type='volume'>
983
- <referenceFrom>4</referenceFrom>
983
+ <locality>
984
+ <referenceFrom>4</referenceFrom>
985
+ </locality>
984
986
  </extent>
985
987
  <extent type='issue'>
986
- <referenceFrom>2</referenceFrom>
987
- <referenceTo>3</referenceTo>
988
+ <locality>
989
+ <referenceFrom>2</referenceFrom>
990
+ <referenceTo>3</referenceTo>
991
+ </locality>
988
992
  </extent>
989
993
  <extent type='page'>
990
- <referenceFrom>12</referenceFrom>
991
- <referenceTo>13</referenceTo>
994
+ <locality>
995
+ <referenceFrom>12</referenceFrom>
996
+ <referenceTo>13</referenceTo>
997
+ </locality>
992
998
  </extent>
993
999
  <extent type='page'>
994
- <referenceFrom>19</referenceFrom>
1000
+ <locality>
1001
+ <referenceFrom>19</referenceFrom>
1002
+ </locality>
995
1003
  </extent>
996
1004
  </bibitem>
997
1005
  </references>
@@ -3,7 +3,6 @@ require "relaton_iec"
3
3
  require "fileutils"
4
4
 
5
5
  RSpec.describe Metanorma::Standoc do
6
- =begin
7
6
  it "appends any initial user-supplied text to boilerplate in terms and definitions" do
8
7
  input = <<~INPUT
9
8
  #{ASCIIDOC_BLANK_HDR}
@@ -1355,7 +1354,7 @@ RSpec.describe Metanorma::Standoc do
1355
1354
  expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1356
1355
  .to be_equivalent_to xmlpp(output)
1357
1356
  end
1358
- =end
1357
+
1359
1358
  it "processes section names, internationalisation file" do
1360
1359
  input = <<~INPUT
1361
1360
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":no-pdf:\n:i18nyaml: spec/assets/i18n.yaml")}
@@ -167,6 +167,9 @@ RSpec.describe Metanorma::Standoc do
167
167
 
168
168
  "((ppm))"&#xa0;
169
169
 
170
+ "stem:[3]".
171
+ footnote:[The mole]
172
+
170
173
  ....
171
174
  ((ppm))",
172
175
  ....
@@ -195,6 +198,14 @@ RSpec.describe Metanorma::Standoc do
195
198
  <primary>ppm</primary>
196
199
  </index>
197
200
  &#8221;&#160;
201
+ </p>
202
+ <p id='_'>“<stem type='MathML'>
203
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
204
+ <mn>3</mn>
205
+ </math>
206
+ </stem>”.<fn reference='1'>
207
+ <p id='_'>The mole</p>
208
+ </fn>
198
209
  </p>
199
210
  <figure id='_'>
200
211
  <pre id='_'>((ppm))",</pre>
@@ -1,7 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe Metanorma::Standoc do
4
- =begin
5
4
  it "handles spacing around markup" do
6
5
  input = <<~INPUT
7
6
  #{ASCIIDOC_BLANK_HDR}
@@ -337,7 +336,7 @@ RSpec.describe Metanorma::Standoc do
337
336
  expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
338
337
  .to be_equivalent_to(output)
339
338
  end
340
- =end
339
+
341
340
  it "processes crossreferences" do
342
341
  input = <<~INPUT
343
342
  #{ASCIIDOC_BLANK_HDR}
@@ -394,6 +393,68 @@ RSpec.describe Metanorma::Standoc do
394
393
  .to be_equivalent_to(xmlpp(output))
395
394
  end
396
395
 
396
+ it "processes crossreferences style" do
397
+ input = <<~INPUT
398
+ #{ASCIIDOC_BLANK_HDR}
399
+ [[reference]]
400
+ == Section
401
+
402
+ Inline Reference to <<reference>>
403
+ Inline Reference to <<reference,style=basic%>>
404
+ Inline Reference to <<reference,style=basic>>
405
+ Inline Reference to <<reference,style=%>>
406
+ INPUT
407
+ output = <<~OUTPUT
408
+ #{BLANK_HDR}
409
+ <sections>
410
+ <clause id='reference' inline-header='false' obligation='normative'>
411
+ <title>Section</title>
412
+ <p id='_'>
413
+ Inline Reference to
414
+ <xref target='reference'/>
415
+ Inline Reference to
416
+ <xref target='reference' style='basic'/>
417
+ Inline Reference to
418
+ <xref target='reference'>style=basic</xref>
419
+ Inline Reference to
420
+ <xref target='reference'>style=%</xref>
421
+ </p>
422
+ </clause>
423
+ </sections>
424
+ </standard-document>
425
+ OUTPUT
426
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
427
+ .to be_equivalent_to(xmlpp(output))
428
+ end
429
+
430
+ it "processes crossreferences style as document attribute" do
431
+ input = <<~INPUT
432
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":nodoc:\n:xrefstyle: full")}
433
+ [[reference]]
434
+ == Section
435
+
436
+ Inline Reference to <<reference>>
437
+ Inline Reference to <<reference,style=basic%>>
438
+ INPUT
439
+ output = <<~OUTPUT
440
+ #{BLANK_HDR}
441
+ <sections>
442
+ <clause id='reference' inline-header='false' obligation='normative'>
443
+ <title>Section</title>
444
+ <p id='_'>
445
+ Inline Reference to
446
+ <xref target='reference'/>
447
+ Inline Reference to
448
+ <xref target='reference' style='basic'/>
449
+ </p>
450
+ </clause>
451
+ </sections>
452
+ </standard-document>
453
+ OUTPUT
454
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
455
+ .to be_equivalent_to(xmlpp(output))
456
+ end
457
+
397
458
  it "processes formatting within crossreferences" do
398
459
  input = <<~INPUT
399
460
  #{ASCIIDOC_BLANK_HDR}
@@ -129,8 +129,8 @@ RSpec.describe Metanorma::Standoc do
129
129
  expect(
130
130
  xmlpp(
131
131
  strip_guid(Asciidoctor.convert(input, *OPTIONS))
132
- .gsub(%r{"[^".]+spec/assets/lutaml/[^./"]+\.png},
133
- '"spec/assets/_.png'),
132
+ .gsub(%r{spec/assets/lutaml/[^./]+\.png},
133
+ "spec/assets/_.png"),
134
134
  ),
135
135
  ).to(be_equivalent_to(xmlpp(output)))
136
136
  end
@@ -169,8 +169,8 @@ RSpec.describe Metanorma::Standoc do
169
169
  expect(
170
170
  xmlpp(
171
171
  strip_guid(Asciidoctor.convert(input, *OPTIONS))
172
- .gsub(%r{"[^".]+spec/assets/lutaml/[^./"]+\.png},
173
- '"spec/assets/_.png'),
172
+ .gsub(%r{spec/assets/lutaml/[^./]+\.png},
173
+ "spec/assets/_.png"),
174
174
  ),
175
175
  ).to(be_equivalent_to(xmlpp(output)))
176
176
  end
@@ -354,15 +354,15 @@ RSpec.shared_examples "structured data 2 text preprocessor" do
354
354
  <sections>
355
355
  <clause id='_' inline-header='false' obligation='normative'>
356
356
  <title>0 → 1 lorem == lorem</title>
357
- <sourcecode lang='ruby' id='_'>link:doc-0.rb[]</sourcecode>
357
+ <sourcecode lang='ruby' id='_'>link:doc-0.rb[role=include]</sourcecode>
358
358
  </clause>
359
359
  <clause id='_' inline-header='false' obligation='normative'>
360
360
  <title>1 → 2 ipsum == ipsum</title>
361
- <sourcecode lang='ruby' id='_'>link:doc-1.rb[]</sourcecode>
361
+ <sourcecode lang='ruby' id='_'>link:doc-1.rb[role=include]</sourcecode>
362
362
  </clause>
363
363
  <clause id='_' inline-header='false' obligation='normative'>
364
364
  <title>2 → 3 dolor == dolor</title>
365
- <sourcecode lang='ruby' id='_'>link:doc-2.rb[]</sourcecode>
365
+ <sourcecode lang='ruby' id='_'>link:doc-2.rb[role=include]</sourcecode>
366
366
  </clause>
367
367
  </sections>
368
368
  </standard-document>