metanorma-standoc 1.4.2 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -7
  3. data/.github/workflows/ubuntu.yml +6 -11
  4. data/.github/workflows/windows.yml +0 -8
  5. data/.rubocop.yml +1 -1
  6. data/Rakefile +2 -0
  7. data/lib/asciidoctor/standoc/base.rb +15 -21
  8. data/lib/asciidoctor/standoc/cleanup.rb +1 -0
  9. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +11 -24
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +57 -1
  11. data/lib/asciidoctor/standoc/cleanup_ref.rb +13 -8
  12. data/lib/asciidoctor/standoc/cleanup_section.rb +90 -6
  13. data/lib/asciidoctor/standoc/cleanup_terms.rb +12 -2
  14. data/lib/asciidoctor/standoc/converter.rb +16 -2
  15. data/lib/asciidoctor/standoc/front.rb +0 -12
  16. data/lib/asciidoctor/standoc/front_contributor.rb +28 -3
  17. data/lib/asciidoctor/standoc/inline.rb +1 -1
  18. data/lib/asciidoctor/standoc/isodoc.rng +16 -7
  19. data/lib/asciidoctor/standoc/log.rb +10 -1
  20. data/lib/asciidoctor/standoc/ref.rb +24 -25
  21. data/lib/asciidoctor/standoc/section.rb +31 -27
  22. data/lib/asciidoctor/standoc/utils.rb +18 -1
  23. data/lib/asciidoctor/standoc/validate.rb +30 -18
  24. data/lib/asciidoctor/standoc/validate_section.rb +1 -1
  25. data/lib/metanorma/standoc/processor.rb +0 -4
  26. data/lib/metanorma/standoc/version.rb +1 -1
  27. data/metanorma-standoc.gemspec +3 -2
  28. data/spec/asciidoctor-standoc/base_spec.rb +21 -6
  29. data/spec/asciidoctor-standoc/blocks_spec.rb +21 -7
  30. data/spec/asciidoctor-standoc/cleanup_spec.rb +1337 -23
  31. data/spec/asciidoctor-standoc/inline_spec.rb +7 -4
  32. data/spec/asciidoctor-standoc/macros_spec.rb +41 -23
  33. data/spec/asciidoctor-standoc/refs_dl_spec.rb +9 -7
  34. data/spec/asciidoctor-standoc/refs_spec.rb +16 -16
  35. data/spec/asciidoctor-standoc/section_spec.rb +42 -38
  36. data/spec/asciidoctor-standoc/table_spec.rb +7 -1
  37. data/spec/asciidoctor-standoc/validate_spec.rb +40 -0
  38. data/spec/assets/{html.css → html.scss} +0 -0
  39. data/spec/assets/i18n.yaml +17 -2
  40. data/spec/assets/{word.css → word.scss} +0 -0
  41. data/spec/metanorma/processor_spec.rb +1 -2
  42. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +66 -66
  43. data/spec/vcr_cassettes/isobib_get_123.yml +16 -16
  44. data/spec/vcr_cassettes/isobib_get_123_1.yml +33 -33
  45. data/spec/vcr_cassettes/isobib_get_123_2001.yml +19 -19
  46. data/spec/vcr_cassettes/isobib_get_124.yml +19 -19
  47. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
  48. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +28 -28
  49. metadata +22 -12
  50. data/lib/asciidoctor-yaml/i18n-en.yaml +0 -20
  51. data/lib/asciidoctor-yaml/i18n-fr.yaml +0 -13
  52. data/lib/asciidoctor-yaml/i18n-zh-Hans.yaml +0 -15
  53. data/lib/asciidoctor/standoc/i18n.rb +0 -39
@@ -128,7 +128,8 @@ module Asciidoctor
128
128
  ::Nokogiri::XML::Builder.with fragment, &block
129
129
  fragment.to_xml(encoding: "US-ASCII", indent: 0).lines.map do |l|
130
130
  l.gsub(/>\n$/, ">").gsub(/\s*\n$/m, " ").gsub("–", "\u0096").
131
- gsub("—", "\u0097")
131
+ gsub("—", "\u0097").gsub("–", "\u0096").
132
+ gsub("—", "\u0097")
132
133
  end
133
134
  end
134
135
 
@@ -173,6 +174,22 @@ module Asciidoctor
173
174
 
174
175
  SUBCLAUSE_XPATH = "//clause[not(parent::sections)]"\
175
176
  "[not(ancestor::boilerplate)]".freeze
177
+
178
+ def isodoc(lang, script, i18nyaml = nil)
179
+ conv = html_converter(EmptyAttr.new)
180
+ i18n = conv.i18n_init(lang, script, i18nyaml)
181
+ conv.metadata_init(lang, script, i18n)
182
+ conv
183
+ end
184
+
185
+ class EmptyAttr
186
+ def attr(_x)
187
+ nil
188
+ end
189
+ def attributes
190
+ {}
191
+ end
192
+ end
176
193
  end
177
194
  end
178
195
  end
@@ -8,7 +8,8 @@ module Asciidoctor
8
8
  module Standoc
9
9
  module Validate
10
10
 
11
- SOURCELOCALITY = "./termsource/origin//locality[@type = 'clause']/referenceFrom".freeze
11
+ SOURCELOCALITY = "./termsource/origin//locality[@type = 'clause']/"\
12
+ "referenceFrom".freeze
12
13
 
13
14
  def init_iev
14
15
  return nil if @no_isobib
@@ -19,13 +20,16 @@ module Asciidoctor
19
20
 
20
21
  def iev_validate(xmldoc)
21
22
  xmldoc.xpath("//term").each do |t|
22
- /^IEC 60050-/.match(t&.at("./termsource/origin/@citeas")&.text) or next
23
- pref = t.xpath("./preferred").inject([]) { |m, x| m << x&.text&.downcase }
24
- locality = t.xpath(SOURCELOCALITY)&.text or next
23
+ /^IEC 60050-/.match(t&.at("./termsource/origin/@citeas")&.text) &&
24
+ loc = t.xpath(SOURCELOCALITY)&.text or next
25
25
  @iev = init_iev or return
26
- iev = @iev.fetch(locality, xmldoc&.at("//language")&.text || "en") or next
26
+ iev = @iev.fetch(loc, xmldoc&.at("//language")&.text || "en") or next
27
+ pref = t.xpath("./preferred").inject([]) do |m, x|
28
+ m << x&.text&.downcase
29
+ end
27
30
  pref.include?(iev.downcase) or
28
- @log.add("Bibliography", t, %(Term "#{pref[0]}" does not match IEV #{locality} "#{iev}"))
31
+ @log.add("Bibliography", t, %(Term "#{pref[0]}" does not match ) +
32
+ %(IEV #{loc} "#{iev}"))
29
33
  end
30
34
  end
31
35
 
@@ -35,20 +39,26 @@ module Asciidoctor
35
39
  iev_validate(doc.root)
36
40
  end
37
41
 
42
+ def repeat_id_validate1(ids, x)
43
+ if ids[x["id"]]
44
+ @log.add("Anchors", x, "Anchor #{x['id']} has already been used "\
45
+ "at line #{ids[x['id']]}")
46
+ raise StandardError.new "Error: multiple instances of same ID"
47
+ else
48
+ ids[x["id"]] = x.line
49
+ end
50
+ ids
51
+ end
52
+
38
53
  def repeat_id_validate(doc)
39
54
  ids = {}
40
- crash = false
41
- doc.xpath("//*[@id]").each do |x|
42
- if ids[x["id"]]
43
- @log.add("Anchors", x, "Anchor #{x['id']} has already been used at line #{ids[x['id']]}")
44
- crash = true
45
- else
46
- ids[x["id"]] = x.line
55
+ begin
56
+ doc.xpath("//*[@id]").each do |x|
57
+ ids = repeat_id_validate1(ids, x)
47
58
  end
48
- end
49
- if crash
59
+ rescue StandardError => e
50
60
  clean_exit
51
- abort("Cannot deal with multiple instances of same ID")
61
+ abort(e.message)
52
62
  end
53
63
  end
54
64
 
@@ -59,8 +69,10 @@ module Asciidoctor
59
69
  f.close
60
70
  errors = Jing.new(schema).validate(f.path)
61
71
  warn "Syntax Valid!" if errors.none?
62
- errors.each do |error|
63
- @log.add("Syntax", "XML Line #{"%06d" % error[:line]}:#{error[:column]}", error[:message])
72
+ errors.each do |e|
73
+ @log.add("Metanorma XML Syntax",
74
+ "XML Line #{"%06d" % e[:line]}:#{e[:column]}",
75
+ e[:message])
64
76
  end
65
77
  rescue Jing::Error => e
66
78
  clean_exit
@@ -22,7 +22,7 @@ module Asciidoctor
22
22
  def style_warning(node, msg, text = nil)
23
23
  w = msg
24
24
  w += ": #{text}" if text
25
- @log.add("Style Warning", node, w)
25
+ @log.add("Metanorma XML Style Warning", node, w)
26
26
  end
27
27
 
28
28
  def asset_title_style(root)
@@ -21,10 +21,6 @@ module Metanorma
21
21
  "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
22
22
  end
23
23
 
24
- def input_to_isodoc(file, filename)
25
- Metanorma::Input::Asciidoc.new.process(file, filename, @asciidoctor_backend)
26
- end
27
-
28
24
  def output(isodoc_node, inname, outname, format, options={})
29
25
  case format
30
26
  when :html
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Standoc
3
- VERSION = "1.4.2".freeze
3
+ VERSION = "1.5.2".freeze
4
4
  end
5
5
  end
@@ -28,9 +28,9 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency "asciidoctor", "~> 2.0.0"
30
30
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "isodoc", "~> 1.1.0"
31
+ spec.add_dependency "isodoc", "~> 1.2.0"
32
32
  spec.add_dependency "iev", "~> 0.2.1"
33
- spec.add_dependency "relaton", "~> 1.2.0"
33
+ spec.add_dependency "relaton", "~> 1.3.0"
34
34
  spec.add_dependency "relaton-iev", "~> 1.0.0"
35
35
  spec.add_dependency "sterile", "~> 1.0.14"
36
36
  spec.add_dependency "concurrent-ruby"
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency "mathml2asciimath"
40
40
 
41
41
  spec.add_development_dependency "byebug"
42
+ spec.add_development_dependency "sassc", "2.4.0"
42
43
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
43
44
  spec.add_development_dependency "guard", "~> 2.14"
44
45
  spec.add_development_dependency "guard-rspec", "~> 4.7"
@@ -102,7 +102,8 @@ RSpec.describe Asciidoctor::Standoc do
102
102
  :email_2: barney@rockhead.example.com
103
103
  :phone_2: 789
104
104
  :fax_2: 012
105
- :publisher: Hanna Barbera, Cartoon Network
105
+ :publisher: "Hanna Barbera", "Cartoon Network", "Ribose, Inc."
106
+ :copyright-holder: "Ribose, Inc.", Hanna Barbera
106
107
  :part-of: ABC
107
108
  :translated-from: DEF,GHI;JKL MNO,PQR
108
109
  :keywords: a, b, c
@@ -155,6 +156,12 @@ RSpec.describe Asciidoctor::Standoc do
155
156
  <date type="Jack">
156
157
  <on>1010-01-01</on>
157
158
  </date>
159
+ <contributor>
160
+ <role type="author"/>
161
+ <organization>
162
+ <name>Ribose, Inc.</name>
163
+ </organization>
164
+ </contributor>
158
165
  <contributor>
159
166
  <role type="author"/>
160
167
  <organization>
@@ -221,6 +228,12 @@ RSpec.describe Asciidoctor::Standoc do
221
228
  <name>Cartoon Network</name>
222
229
  </organization>
223
230
  </contributor>
231
+ <contributor>
232
+ <role type="publisher"/>
233
+ <organization>
234
+ <name>Ribose, Inc.</name>
235
+ </organization>
236
+ </contributor>
224
237
  <edition>2</edition>
225
238
  <version>
226
239
  <revision-date>2000-01-01</revision-date>
@@ -237,7 +250,7 @@ RSpec.describe Asciidoctor::Standoc do
237
250
  <from>2001</from>
238
251
  <owner>
239
252
  <organization>
240
- <name>Hanna Barbera</name>
253
+ <name>Ribose, Inc.</name>
241
254
  </organization>
242
255
  </owner>
243
256
  </copyright>
@@ -245,7 +258,7 @@ RSpec.describe Asciidoctor::Standoc do
245
258
  <from>2001</from>
246
259
  <owner>
247
260
  <organization>
248
- <name>Cartoon Network</name>
261
+ <name>Hanna Barbera</name>
249
262
  </organization>
250
263
  </owner>
251
264
  </copyright>
@@ -314,6 +327,7 @@ RSpec.describe Asciidoctor::Standoc do
314
327
  :doc-uri: E
315
328
  :relaton-uri: F
316
329
  :title-eo: Dokumenttitolo
330
+ :doctype: This is a DocType
317
331
 
318
332
  [abstract]
319
333
  == Abstract
@@ -409,11 +423,12 @@ RSpec.describe Asciidoctor::Standoc do
409
423
  </owner>
410
424
  </copyright>
411
425
  <ext>
412
- <doctype>article</doctype>
426
+ <doctype>this-is-a-doctype</doctype>
413
427
  </ext>
414
428
  </bibdata>
415
429
  <preface>
416
430
  <abstract id='_'>
431
+ <title>Abstract</title>
417
432
  <p id='_'>This is the abstract of the document</p>
418
433
  <p id='_'>This is the second paragraph of the abstract of the document.</p>
419
434
  </abstract>
@@ -451,7 +466,7 @@ RSpec.describe Asciidoctor::Standoc do
451
466
  :body-font: Zapf Chancery
452
467
  :header-font: Comic Sans
453
468
  :monospace-font: Andale Mono
454
- :htmlstylesheet: spec/assets/html.css
469
+ :htmlstylesheet: spec/assets/html.scss
455
470
  :htmlcoverpage: spec/assets/htmlcover.html
456
471
  :htmlintropage: spec/assets/htmlintro.html
457
472
  :scripts: spec/assets/scripts.html
@@ -483,7 +498,7 @@ RSpec.describe Asciidoctor::Standoc do
483
498
  :body-font: Zapf Chancery
484
499
  :header-font: Comic Sans
485
500
  :monospace-font: Andale Mono
486
- :wordstylesheet: spec/assets/word.css
501
+ :wordstylesheet: spec/assets/word.scss
487
502
  :wordcoverpage: spec/assets/wordcover.html
488
503
  :wordintropage: spec/assets/wordintro.html
489
504
  :header: spec/assets/header.html
@@ -96,7 +96,7 @@ RSpec.describe Asciidoctor::Standoc do
96
96
  </formula>
97
97
  <formula id="_" subsequence="A">
98
98
  <stem type="MathML">
99
- <math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
99
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
100
100
  <mrow>
101
101
  <mi>M</mi>
102
102
  <mo>=</mo>
@@ -361,6 +361,10 @@ RSpec.describe Asciidoctor::Standoc do
361
361
  #{ASCIIDOC_BLANK_HDR}
362
362
  == Terms and Definitions
363
363
 
364
+ NOTE: This is not a termnote
365
+
366
+ EXAMPLE: This is not a termexample
367
+
364
368
  [.nonterm]
365
369
  === Term1
366
370
 
@@ -371,6 +375,9 @@ RSpec.describe Asciidoctor::Standoc do
371
375
  <terms id="_" obligation="normative">
372
376
  <title>Terms and definitions</title>
373
377
  <p id="_">No terms and definitions are listed in this document.</p>
378
+ <note id='_'>
379
+ <p id='_'>This is not a termnote</p>
380
+ </note>
374
381
  <clause id="_" inline-header="false" obligation="normative">
375
382
  <title>Term1</title>
376
383
  <note id="_">
@@ -397,12 +404,12 @@ RSpec.describe Asciidoctor::Standoc do
397
404
  INPUT
398
405
  #{BLANK_HDR}
399
406
  <sections>
400
- <terms id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
407
+ <terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
401
408
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
402
409
  <term id="_">
403
410
  <preferred>Term1</preferred>
404
411
  </term>
405
- <definitions id="_">
412
+ <definitions id="_" obligation="normative" type="symbols">
406
413
  <title>Symbols</title>
407
414
  <note id="_">
408
415
  <p id="_">This is a note</p>
@@ -598,11 +605,11 @@ RSpec.describe Asciidoctor::Standoc do
598
605
  INPUT
599
606
  #{BLANK_HDR}
600
607
  <sections>
601
- <terms id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title>
608
+ <terms id="_" obligation="normative"><title>Terms, definitions and symbols</title>
602
609
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p><term id="_">
603
610
  <preferred>Term1</preferred>
604
611
  </term>
605
- <definitions id="_">
612
+ <definitions id="_" obligation="normative" type="symbols">
606
613
  <title>Symbols</title>
607
614
  <example id="_">
608
615
  <p id="_">This is an example</p>
@@ -679,7 +686,7 @@ RSpec.describe Asciidoctor::Standoc do
679
686
  INPUT
680
687
  #{BLANK_HDR}
681
688
  <preface><foreword id="_" obligation="informative">
682
- <title>Preamble</title>
689
+ <title>Foreword</title>
683
690
  <p id="_">This is a preamble</p>
684
691
  </foreword></preface><sections>
685
692
  <clause id="_" inline-header="false" obligation="normative">
@@ -1248,7 +1255,14 @@ RSpec.describe Asciidoctor::Standoc do
1248
1255
  <description><p id="_">I recommend <em>this</em>.</p>
1249
1256
  </description><specification exclude="false" type="tabular" keep-with-next="true" keep-lines-together="true"><p id="_">This is the object of the recommendation:</p><table id="_"> <tbody> <tr> <td align="left">Object</td> <td align="left">Value</td> </tr> <tr> <td align="left">Mission</td> <td align="left">Accomplished</td> </tr> </tbody></table></specification><description>
1250
1257
  <p id="_">As for the measurement targets,</p>
1251
- </description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mi>r</mi><mn>1</mn></mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
1258
+ </description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
1259
+ <mrow>
1260
+ <mi>r</mi>
1261
+ </mrow>
1262
+ <mrow>
1263
+ <mn>1</mn>
1264
+ </mrow>
1265
+ </mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
1252
1266
  <verification exclude="false"><p id="_">The following code will be run for verification:</p><sourcecode lang="CoreRoot" id="_">CoreRoot(success): HttpResponse
1253
1267
  if (success)
1254
1268
  recommendation(label: success-response)
@@ -158,7 +158,21 @@ RSpec.describe Asciidoctor::Standoc do
158
158
  <terms id="_" obligation="normative">
159
159
  <title>Terms and definitions</title>
160
160
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
161
- <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
161
+ <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
162
+ <mrow>
163
+ <mi>t</mi>
164
+ </mrow>
165
+ <mrow>
166
+ <mn>90</mn>
167
+ </mrow>
168
+ </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
169
+ <mrow>
170
+ <mi>t</mi>
171
+ </mrow>
172
+ <mrow>
173
+ <mn>91</mn>
174
+ </mrow>
175
+ </msub></math></stem></admitted>
162
176
  <definition><p id="_">Time</p></definition></term>
163
177
  </terms>
164
178
  </sections>
@@ -229,8 +243,22 @@ RSpec.describe Asciidoctor::Standoc do
229
243
  <terms id="_" obligation="normative">
230
244
  <title>Terms and definitions</title>
231
245
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
232
- <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
233
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
246
+ <term id="_"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
247
+ <mrow>
248
+ <mi>t</mi>
249
+ </mrow>
250
+ <mrow>
251
+ <mn>90</mn>
252
+ </mrow>
253
+ </msub></math></stem></preferred><definition><formula id="_">
254
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
255
+ <mrow>
256
+ <mi>t</mi>
257
+ </mrow>
258
+ <mrow>
259
+ <mi>A</mi>
260
+ </mrow>
261
+ </msub></math></stem>
234
262
  </formula>
235
263
  <p id="_">This paragraph is extraneous</p></definition>
236
264
  </term>
@@ -360,7 +388,7 @@ RSpec.describe Asciidoctor::Standoc do
360
388
  </p>
361
389
  </foreword></preface><sections>
362
390
  </sections><bibliography><references id="_" obligation="informative" normative="true">
363
- <title>Normative References</title>
391
+ <title>Normative references</title>
364
392
  #{NORM_REF_BOILERPLATE}
365
393
  <bibitem id="iso216" type="standard">
366
394
  <title format="text/plain">Reference</title>
@@ -438,7 +466,7 @@ RSpec.describe Asciidoctor::Standoc do
438
466
  </p>
439
467
  </foreword></preface><sections>
440
468
  </sections><bibliography><references id="_" obligation="informative" normative="true">
441
- <title>Normative References</title>
469
+ <title>Normative references</title>
442
470
  #{NORM_REF_BOILERPLATE}
443
471
  <bibitem id="iso216" type="standard">
444
472
  <title format="text/plain">Reference</title>
@@ -538,7 +566,7 @@ RSpec.describe Asciidoctor::Standoc do
538
566
  INPUT
539
567
  #{BLANK_HDR}
540
568
  <sections></sections>
541
- <bibliography><references id="_" obligation="informative" normative="true"><title>Normative References</title>
569
+ <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
542
570
  #{NORM_REF_BOILERPLATE}
543
571
  <bibitem id="iso216" type="standard">
544
572
  <title format="text/plain">Reference</title>
@@ -967,7 +995,7 @@ end
967
995
  </fn>
968
996
  </p>
969
997
  </clause></sections><bibliography><references id="_" obligation="informative" normative="true">
970
- <title>Normative References</title>
998
+ <title>Normative references</title>
971
999
  #{NORM_REF_BOILERPLATE}
972
1000
  <bibitem id="iso123" type="standard">
973
1001
  <title format="text/plain">Standard</title>
@@ -1198,7 +1226,7 @@ end
1198
1226
  </origin>
1199
1227
  </termsource>
1200
1228
  </term></terms></sections><bibliography><references id="_" obligation="informative" normative="true">
1201
- <title>Normative References</title>
1229
+ <title>Normative references</title>
1202
1230
  #{NORM_REF_BOILERPLATE}
1203
1231
  <bibitem type="standard" id="IEC60050-102">
1204
1232
  <fetched>#{Date.today}</fetched>
@@ -1359,7 +1387,14 @@ end
1359
1387
  #{BLANK_HDR}
1360
1388
  <sections>
1361
1389
  <p id="_">
1362
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
1390
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
1391
+ <mrow>
1392
+ <mn>1</mn>
1393
+ </mrow>
1394
+ <mrow>
1395
+ <mi>r</mi>
1396
+ </mrow>
1397
+ </mfrac></math></stem>
1363
1398
  </p>
1364
1399
  </sections>
1365
1400
  </standard-document>
@@ -1515,7 +1550,7 @@ OUTPUT
1515
1550
  <sections>
1516
1551
 
1517
1552
  </sections><bibliography><references id="_" obligation="informative" normative="true">
1518
- <title>Normative References</title><p id="_">There are no normative references in this document.</p>
1553
+ <title>Normative references</title><p id="_">There are no normative references in this document.</p>
1519
1554
  </references></bibliography>
1520
1555
  </standard-document>
1521
1556
  OUTPUT
@@ -1534,7 +1569,7 @@ OUTPUT
1534
1569
  <sections>
1535
1570
 
1536
1571
  </sections><bibliography><references id="_" obligation="informative" normative="true">
1537
- <title>Normative References</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
1572
+ <title>Normative references</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
1538
1573
  <bibitem id="a">
1539
1574
  <formattedref format="application/x-isodoc+xml">A</formattedref>
1540
1575
  <docidentifier>b</docidentifier>
@@ -1563,7 +1598,7 @@ it "inserts boilerplate before empty Normative References in French" do
1563
1598
  <sections>
1564
1599
 
1565
1600
  </sections><bibliography><references id="_" obligation="informative" normative="true">
1566
- <title>Normative References</title><p id="_">Le présent document ne contient aucune référence normative.</p>
1601
+ <title>Références normatives</title><p id="_">Le présent document ne contient aucune référence normative.</p>
1567
1602
  </references></bibliography>
1568
1603
  </standard-document>
1569
1604
  OUTPUT
@@ -1608,7 +1643,7 @@ it "removes bibdata bibitem IDs" do
1608
1643
  <sections> </sections>
1609
1644
  <bibliography>
1610
1645
  <references id='_' obligation='informative' normative="true">
1611
- <title>Normative References</title>
1646
+ <title>Normative references</title>
1612
1647
  <p id="_">There are no normative references in this document.</p>
1613
1648
  </references>
1614
1649
  </bibliography>
@@ -1669,12 +1704,28 @@ it "sorts symbols lists" do
1669
1704
  x_1_:: Definition 3
1670
1705
  x_m_:: Definition 4
1671
1706
  x:: Definition 5
1707
+ stem:[n]:: Definition 6
1708
+ m:: Definition 7
1672
1709
  INPUT
1673
1710
  #{BLANK_HDR}
1674
1711
  <sections>
1675
- <definitions id='L'>
1712
+ <definitions id='L' obligation="normative">
1676
1713
  <title>Symbols and abbreviated terms</title>
1677
1714
  <dl id='_'>
1715
+ <dt>m</dt>
1716
+ <dd>
1717
+ <p id='_'>Definition 7</p>
1718
+ </dd>
1719
+ <dt>
1720
+ <stem type='MathML'>
1721
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
1722
+ <mi>n</mi>
1723
+ </math>
1724
+ </stem>
1725
+ </dt>
1726
+ <dd>
1727
+ <p id='_'>Definition 6</p>
1728
+ </dd>
1678
1729
  <dt>x</dt>
1679
1730
  <dd>
1680
1731
  <p id='_'>Definition 5</p>
@@ -1717,7 +1768,7 @@ it "sorts symbols lists" do
1717
1768
  INPUT
1718
1769
  #{BLANK_HDR}
1719
1770
  <sections>
1720
- <definitions id='L'>
1771
+ <definitions id='L' obligation="normative">
1721
1772
  <title>Symbols and abbreviated terms</title>
1722
1773
  <dl id='_'>
1723
1774
  <dt>x</dt>
@@ -1727,8 +1778,12 @@ it "sorts symbols lists" do
1727
1778
  <dt><stem type='MathML'>
1728
1779
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
1729
1780
  <msub>
1730
- <mi>x</mi>
1731
- <mi>m</mi>
1781
+ <mrow>
1782
+ <mi>x</mi>
1783
+ </mrow>
1784
+ <mrow>
1785
+ <mi>m</mi>
1786
+ </mrow>
1732
1787
  </msub>
1733
1788
  </math>
1734
1789
  </stem></dt>
@@ -1738,8 +1793,12 @@ it "sorts symbols lists" do
1738
1793
  <dt><stem type='MathML'>
1739
1794
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
1740
1795
  <msub>
1741
- <mi>x</mi>
1742
- <mn>1</mn>
1796
+ <mrow>
1797
+ <mi>x</mi>
1798
+ </mrow>
1799
+ <mrow>
1800
+ <mn>1</mn>
1801
+ </mrow>
1743
1802
  </msub>
1744
1803
  </math>
1745
1804
  </stem></dt>
@@ -1872,6 +1931,9 @@ it "moves %beforeclause admonitions to right position" do
1872
1931
  INPUT
1873
1932
  #{BLANK_HDR}
1874
1933
  <preface>
1934
+ <note id='_'>
1935
+ <p id='_'>Note which is very important</p>
1936
+ </note>
1875
1937
  <foreword id='_' obligation='informative'>
1876
1938
  <title>Foreword</title>
1877
1939
  <p id='_'>Foreword</p>
@@ -1882,13 +1944,10 @@ INPUT
1882
1944
  </introduction>
1883
1945
  </preface>
1884
1946
  <sections>
1885
- <note id='_'>
1886
- <p id='_'>Note which is very important</p>
1887
- </note>
1888
1947
  <admonition id='_' type='important'>
1889
1948
  <p id='_'>Notice which is very important</p>
1890
1949
  </admonition>
1891
- <clause id='_' inline-header='false' obligation='normative'>
1950
+ <clause id='_' inline-header='false' obligation='normative' type="scope">
1892
1951
  <title>Scope</title>
1893
1952
  <p id='_'>Scope statement</p>
1894
1953
  </clause>
@@ -1899,6 +1958,1261 @@ OUTPUT
1899
1958
  end
1900
1959
 
1901
1960
 
1961
+ it "processes section names, with footnotes" do
1962
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1963
+ #{ASCIIDOC_BLANK_HDR}
1964
+ .Foreword.footnote:[A]
1965
+
1966
+ Text
1967
+
1968
+ [abstract]
1969
+ == Abstract.footnote:[A]
1970
+
1971
+ Text
1972
+
1973
+ [heading=introduction]
1974
+ == Introduction.footnote:[A]
1975
+
1976
+ === Introduction Subsection
1977
+
1978
+ [heading=acknowledgements]
1979
+ == Acknowledgements.footnote:[A]
1980
+
1981
+ [.preface]
1982
+ == Dedication
1983
+
1984
+ [heading=scope]
1985
+ == Scope.footnote:[A]
1986
+
1987
+ Text
1988
+
1989
+ [bibliography,heading=normative references]
1990
+ == Normative References.footnote:[A]
1991
+
1992
+ [bibliography,normative=true]
1993
+ == Normative References 2.footnote:[A]
1994
+
1995
+ [heading=terms and definitions]
1996
+ == Terms and Definitions.footnote:[A]
1997
+
1998
+ === Term1
1999
+
2000
+ [heading="terms and definitions"]
2001
+ == Terms, Definitions, Symbols and Abbreviated Terms.footnote:[A]
2002
+
2003
+ [.nonterm]
2004
+ === Introduction
2005
+
2006
+ ==== Intro 1
2007
+
2008
+ === Intro 2
2009
+
2010
+ [.nonterm]
2011
+ ==== Intro 3
2012
+
2013
+ === Intro 4
2014
+
2015
+ ==== Intro 5
2016
+
2017
+ ===== Term1
2018
+
2019
+ === Normal Terms
2020
+
2021
+ ==== Term2
2022
+
2023
+ [heading=symbols and abbreviated terms]
2024
+ === Symbols and Abbreviated Terms.footnote:[A]
2025
+
2026
+ [.nonterm]
2027
+ ==== General
2028
+
2029
+ [heading=symbols]
2030
+ ==== Symbols 1.footnote:[A]
2031
+
2032
+ [heading=abbreviated terms]
2033
+ == Abbreviated Terms.footnote:[A]
2034
+
2035
+ == Clause 4
2036
+
2037
+ === Introduction
2038
+
2039
+ === Clause 4.2
2040
+
2041
+ == Terms and Definitions
2042
+
2043
+ [appendix]
2044
+ == Annex.footnote:[A]
2045
+
2046
+ === Annex A.1
2047
+
2048
+ [bibliography,heading=bibliography]
2049
+ == Bibliography.footnote:[A]
2050
+
2051
+ [bibliography,normative=false]
2052
+ == Bibliography 2.footnote:[A]
2053
+
2054
+ === Bibliography Subsection
2055
+
2056
+ INPUT
2057
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2058
+ <bibdata type='standard'>
2059
+ <title language='en' format='text/plain'>Document title</title>
2060
+ <language>en</language>
2061
+ <script>Latn</script>
2062
+ <abstract>
2063
+ <p>Text</p>
2064
+ </abstract>
2065
+ <status>
2066
+ <stage>published</stage>
2067
+ </status>
2068
+ <copyright>
2069
+ <from>2020</from>
2070
+ </copyright>
2071
+ <ext>
2072
+ <doctype>article</doctype>
2073
+ </ext>
2074
+ </bibdata>
2075
+ <preface>
2076
+ <abstract id='_'>
2077
+ <title>Abstract</title>
2078
+ <p id='_'>Text</p>
2079
+ </abstract>
2080
+ <foreword id='_' obligation='informative'>
2081
+ <title>
2082
+ Foreword
2083
+ <fn reference='1'>
2084
+ <p id='_'>A</p>
2085
+ </fn>
2086
+ </title>
2087
+ <p id='_'>Text</p>
2088
+ </foreword>
2089
+ <introduction id='_' obligation='informative'>
2090
+ <title>Introduction</title>
2091
+ <clause id='_' inline-header='false' obligation='informative'>
2092
+ <title>Introduction Subsection</title>
2093
+ </clause>
2094
+ </introduction>
2095
+ <clause id='_' inline-header='false' obligation='informative'>
2096
+ <title>Dedication</title>
2097
+ </clause>
2098
+ <acknowledgements id='_' obligation='informative'>
2099
+ <title>
2100
+ Acknowledgements
2101
+ <fn reference='1'>
2102
+ <p id='_'>A</p>
2103
+ </fn>
2104
+ </title>
2105
+ </acknowledgements>
2106
+ </preface>
2107
+ <sections>
2108
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
2109
+ <title>
2110
+ Scope
2111
+ <fn reference='1'>
2112
+ <p id='_'>A</p>
2113
+ </fn>
2114
+ </title>
2115
+ <p id='_'>Text</p>
2116
+ </clause>
2117
+ <terms id='_' obligation='normative'>
2118
+ <title>
2119
+ Terms and definitions
2120
+ <fn reference='1'>
2121
+ <p id='_'>A</p>
2122
+ </fn>
2123
+ </title>
2124
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2125
+ <term id='_'>
2126
+ <preferred>Term1</preferred>
2127
+ </term>
2128
+ </terms>
2129
+ <clause id='_' inline-header='false' obligation='normative'>
2130
+ <title>
2131
+ Terms, Definitions, Symbols and Abbreviated Terms.
2132
+ <fn reference='1'>
2133
+ <p id='_'>A</p>
2134
+ </fn>
2135
+ </title>
2136
+ <clause id='_' inline-header='false' obligation='normative'>
2137
+ <title>Introduction</title>
2138
+ <clause id='_' inline-header='false' obligation='normative'>
2139
+ <title>Intro 1</title>
2140
+ </clause>
2141
+ </clause>
2142
+ <clause id='_' inline-header='false' obligation='normative'>
2143
+ <title>Intro 2</title>
2144
+ <clause id='_' inline-header='false' obligation='normative'>
2145
+ <title>Intro 3</title>
2146
+ </clause>
2147
+ </clause>
2148
+ <clause id='_' inline-header='false' obligation='normative'>
2149
+ <title>Intro 4</title>
2150
+ <clause id='_' inline-header='false' obligation='normative'>
2151
+ <title>Intro 5</title>
2152
+ <clause id='_' inline-header='false' obligation='normative'>
2153
+ <title>Term1</title>
2154
+ </clause>
2155
+ </clause>
2156
+ </clause>
2157
+ <clause id='_' inline-header='false' obligation='normative'>
2158
+ <title>Normal Terms</title>
2159
+ <clause id='_' inline-header='false' obligation='normative'>
2160
+ <title>Term2</title>
2161
+ </clause>
2162
+ </clause>
2163
+ <definitions id='_' obligation='normative'>
2164
+ <title>
2165
+ Symbols and abbreviated terms
2166
+ <fn reference='1'>
2167
+ <p id='_'>A</p>
2168
+ </fn>
2169
+ </title>
2170
+ <clause id='_' inline-header='false' obligation='normative'>
2171
+ <title>General</title>
2172
+ </clause>
2173
+ <definitions id='_' type='symbols' obligation='normative'>
2174
+ <title>
2175
+ Symbols
2176
+ <fn reference='1'>
2177
+ <p id='_'>A</p>
2178
+ </fn>
2179
+ </title>
2180
+ </definitions>
2181
+ </definitions>
2182
+ </clause>
2183
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
2184
+ <title>
2185
+ Abbreviated terms
2186
+ <fn reference='1'>
2187
+ <p id='_'>A</p>
2188
+ </fn>
2189
+ </title>
2190
+ </definitions>
2191
+ <clause id='_' inline-header='false' obligation='normative'>
2192
+ <title>Clause 4</title>
2193
+ <clause id='_' inline-header='false' obligation='normative'>
2194
+ <title>Introduction</title>
2195
+ </clause>
2196
+ <clause id='_' inline-header='false' obligation='normative'>
2197
+ <title>Clause 4.2</title>
2198
+ </clause>
2199
+ </clause>
2200
+ <clause id='_' inline-header='false' obligation='normative'>
2201
+ <title>Terms and Definitions</title>
2202
+ </clause>
2203
+ </sections>
2204
+ <annex id='_' inline-header='false' obligation='normative'>
2205
+ <title>
2206
+ Annex.
2207
+ <fn reference='1'>
2208
+ <p id='_'>A</p>
2209
+ </fn>
2210
+ </title>
2211
+ <clause id='_' inline-header='false' obligation='normative'>
2212
+ <title>Annex A.1</title>
2213
+ </clause>
2214
+ </annex>
2215
+ <bibliography>
2216
+ <references id='_' normative='true' obligation='informative'>
2217
+ <title>Normative references</title>
2218
+ <p id='_'>There are no normative references in this document.</p>
2219
+ </references>
2220
+ <references id='_' normative='false' obligation='informative'>
2221
+ <title>Bibliography</title>
2222
+ </references>
2223
+ <references id='_' normative='false' obligation='informative'>
2224
+ <title>Bibliography</title>
2225
+ </references>
2226
+ <clause id='_' obligation='informative'>
2227
+ <title>Bibliography</title>
2228
+ <references id='_' normative='false' obligation='informative'>
2229
+ <title>Bibliography Subsection</title>
2230
+ </references>
2231
+ </clause>
2232
+ </bibliography>
2233
+ </standard-document>
2234
+ OUTPUT
2235
+ end
2236
+
2237
+ it "processes section names, default to English" do
2238
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2239
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")}
2240
+ .Foreword
2241
+
2242
+ Text
2243
+
2244
+ [abstract]
2245
+ == Abstract
2246
+
2247
+ Text
2248
+
2249
+ [heading=introduction]
2250
+ == Introduction
2251
+
2252
+ === Introduction Subsection
2253
+
2254
+ [heading=acknowledgements]
2255
+ == Acknowledgements
2256
+
2257
+ [.preface]
2258
+ == Dedication
2259
+
2260
+ [heading=scope]
2261
+ == Scope
2262
+
2263
+ Text
2264
+
2265
+ [bibliography,heading=normative references]
2266
+ == Normative References
2267
+
2268
+ [bibliography,normative=true]
2269
+ == Normative References 2
2270
+
2271
+ [heading=terms and definitions]
2272
+ == Terms and Definitions
2273
+
2274
+ === Term1
2275
+
2276
+ [heading="terms and definitions"]
2277
+ == Terms, Definitions, Symbols and Abbreviated Terms
2278
+
2279
+ [.nonterm]
2280
+ === Introduction
2281
+
2282
+ ==== Intro 1
2283
+
2284
+ === Intro 2
2285
+
2286
+ [.nonterm]
2287
+ ==== Intro 3
2288
+
2289
+ === Intro 4
2290
+
2291
+ ==== Intro 5
2292
+
2293
+ ===== Term1
2294
+
2295
+ === Normal Terms
2296
+
2297
+ ==== Term2
2298
+
2299
+ [heading=symbols and abbreviated terms]
2300
+ === Symbols and Abbreviated Terms
2301
+
2302
+ [.nonterm]
2303
+ ==== General
2304
+
2305
+ [heading=symbols]
2306
+ ==== Symbols 1
2307
+
2308
+ [heading=abbreviated terms]
2309
+ == Abbreviated Terms
2310
+
2311
+ == Clause 4
2312
+
2313
+ === Introduction
2314
+
2315
+ === Clause 4.2
2316
+
2317
+ == Terms and Definitions
2318
+
2319
+ [appendix]
2320
+ == Annex
2321
+
2322
+ === Annex A.1
2323
+
2324
+ [bibliography,heading=bibliography]
2325
+ == Bibliography
2326
+
2327
+ [bibliography,normative=false]
2328
+ == Bibliography 2
2329
+
2330
+ === Bibliography Subsection
2331
+
2332
+ INPUT
2333
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2334
+ <bibdata type='standard'>
2335
+ <title language='en' format='text/plain'>Document title</title>
2336
+ <language>tlh</language>
2337
+ <script>Latn</script>
2338
+ <abstract>
2339
+ <p>Text</p>
2340
+ </abstract>
2341
+ <status>
2342
+ <stage>published</stage>
2343
+ </status>
2344
+ <copyright>
2345
+ <from>2020</from>
2346
+ </copyright>
2347
+ <ext>
2348
+ <doctype>article</doctype>
2349
+ </ext>
2350
+ </bibdata>
2351
+ <preface>
2352
+ <abstract id='_'>
2353
+ <title>Abstract</title>
2354
+ <p id='_'>Text</p>
2355
+ </abstract>
2356
+ <foreword id='_' obligation='informative'>
2357
+ <title>Foreword</title>
2358
+ <p id='_'>Text</p>
2359
+ </foreword>
2360
+ <introduction id='_' obligation='informative'>
2361
+ <title>Introduction</title>
2362
+ <clause id='_' inline-header='false' obligation='informative'>
2363
+ <title>Introduction Subsection</title>
2364
+ </clause>
2365
+ </introduction>
2366
+ <clause id='_' inline-header='false' obligation='informative'>
2367
+ <title>Dedication</title>
2368
+ </clause>
2369
+ <acknowledgements id='_' obligation='informative'>
2370
+ <title>Acknowledgements</title>
2371
+ </acknowledgements>
2372
+ </preface>
2373
+ <sections>
2374
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
2375
+ <title>Scope</title>
2376
+ <p id='_'>Text</p>
2377
+ </clause>
2378
+ <terms id='_' obligation='normative'>
2379
+ <title>Terms and definitions</title>
2380
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
2381
+ <term id='_'>
2382
+ <preferred>Term1</preferred>
2383
+ </term>
2384
+ </terms>
2385
+ <clause id='_' inline-header='false' obligation='normative'>
2386
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2387
+ <clause id='_' inline-header='false' obligation='normative'>
2388
+ <title>Introduction</title>
2389
+ <clause id='_' inline-header='false' obligation='normative'>
2390
+ <title>Intro 1</title>
2391
+ </clause>
2392
+ </clause>
2393
+ <clause id='_' inline-header='false' obligation='normative'>
2394
+ <title>Intro 2</title>
2395
+ <clause id='_' inline-header='false' obligation='normative'>
2396
+ <title>Intro 3</title>
2397
+ </clause>
2398
+ </clause>
2399
+ <clause id='_' inline-header='false' obligation='normative'>
2400
+ <title>Intro 4</title>
2401
+ <clause id='_' inline-header='false' obligation='normative'>
2402
+ <title>Intro 5</title>
2403
+ <clause id='_' inline-header='false' obligation='normative'>
2404
+ <title>Term1</title>
2405
+ </clause>
2406
+ </clause>
2407
+ </clause>
2408
+ <clause id='_' inline-header='false' obligation='normative'>
2409
+ <title>Normal Terms</title>
2410
+ <clause id='_' inline-header='false' obligation='normative'>
2411
+ <title>Term2</title>
2412
+ </clause>
2413
+ </clause>
2414
+ <definitions id='_' obligation='normative'>
2415
+ <title>Symbols and abbreviated terms</title>
2416
+ <clause id='_' inline-header='false' obligation='normative'>
2417
+ <title>General</title>
2418
+ </clause>
2419
+ <definitions id='_' type='symbols' obligation='normative'>
2420
+ <title>Symbols</title>
2421
+ </definitions>
2422
+ </definitions>
2423
+ </clause>
2424
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
2425
+ <title>Abbreviated terms</title>
2426
+ </definitions>
2427
+ <clause id='_' inline-header='false' obligation='normative'>
2428
+ <title>Clause 4</title>
2429
+ <clause id='_' inline-header='false' obligation='normative'>
2430
+ <title>Introduction</title>
2431
+ </clause>
2432
+ <clause id='_' inline-header='false' obligation='normative'>
2433
+ <title>Clause 4.2</title>
2434
+ </clause>
2435
+ </clause>
2436
+ <clause id='_' inline-header='false' obligation='normative'>
2437
+ <title>Terms and Definitions</title>
2438
+ </clause>
2439
+ </sections>
2440
+ <annex id='_' inline-header='false' obligation='normative'>
2441
+ <title>Annex</title>
2442
+ <clause id='_' inline-header='false' obligation='normative'>
2443
+ <title>Annex A.1</title>
2444
+ </clause>
2445
+ </annex>
2446
+ <bibliography>
2447
+ <references id='_' normative='true' obligation='informative'>
2448
+ <title>Normative references</title>
2449
+ <p id='_'>There are no normative references in this document.</p>
2450
+ </references>
2451
+ <references id='_' normative='false' obligation='informative'>
2452
+ <title>Bibliography</title>
2453
+ </references>
2454
+ <references id='_' normative='false' obligation='informative'>
2455
+ <title>Bibliography</title>
2456
+ </references>
2457
+ <clause id='_' obligation='informative'>
2458
+ <title>Bibliography</title>
2459
+ <references id='_' normative='false' obligation='informative'>
2460
+ <title>Bibliography Subsection</title>
2461
+ </references>
2462
+ </clause>
2463
+ </bibliography>
2464
+ </standard-document>
2465
+ OUTPUT
2466
+ end
2467
+
2468
+ it "processes section names, French" do
2469
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2470
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")}
2471
+ .Foreword
2472
+
2473
+ Text
2474
+
2475
+ [abstract]
2476
+ == Abstract
2477
+
2478
+ Text
2479
+
2480
+ [heading=introduction]
2481
+ == Introduction
2482
+
2483
+ === Introduction Subsection
2484
+
2485
+ [heading=acknowledgements]
2486
+ == Acknowledgements
2487
+
2488
+ [.preface]
2489
+ == Dedication
2490
+
2491
+ [heading=scope]
2492
+ == Scope
2493
+
2494
+ Text
2495
+
2496
+ [bibliography,heading=normative references]
2497
+ == Normative References
2498
+
2499
+ [bibliography,normative=true]
2500
+ == Normative References 2
2501
+
2502
+ [heading=terms and definitions]
2503
+ == Terms and Definitions
2504
+
2505
+ === Term1
2506
+
2507
+ [heading="terms and definitions"]
2508
+ == Terms, Definitions, Symbols and Abbreviated Terms
2509
+
2510
+ [.nonterm]
2511
+ === Introduction
2512
+
2513
+ ==== Intro 1
2514
+
2515
+ === Intro 2
2516
+
2517
+ [.nonterm]
2518
+ ==== Intro 3
2519
+
2520
+ === Intro 4
2521
+
2522
+ ==== Intro 5
2523
+
2524
+ ===== Term1
2525
+
2526
+ === Normal Terms
2527
+
2528
+ ==== Term2
2529
+
2530
+ [heading=symbols and abbreviated terms]
2531
+ === Symbols and Abbreviated Terms
2532
+
2533
+ [.nonterm]
2534
+ ==== General
2535
+
2536
+ [heading=symbols]
2537
+ ==== Symbols 1
2538
+
2539
+ [heading=abbreviated terms]
2540
+ == Abbreviated Terms
2541
+
2542
+ == Clause 4
2543
+
2544
+ === Introduction
2545
+
2546
+ === Clause 4.2
2547
+
2548
+ == Terms and Definitions
2549
+
2550
+ [appendix]
2551
+ == Annex
2552
+
2553
+ === Annex A.1
2554
+
2555
+ [bibliography,heading=bibliography]
2556
+ == Bibliography
2557
+
2558
+ [bibliography,normative=false]
2559
+ == Bibliography 2
2560
+
2561
+ === Bibliography Subsection
2562
+
2563
+ INPUT
2564
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2565
+ <bibdata type='standard'>
2566
+ <title language='en' format='text/plain'>Document title</title>
2567
+ <language>fr</language>
2568
+ <script>Latn</script>
2569
+ <abstract>
2570
+ <p>Text</p>
2571
+ </abstract>
2572
+ <status>
2573
+ <stage>published</stage>
2574
+ </status>
2575
+ <copyright>
2576
+ <from>2020</from>
2577
+ </copyright>
2578
+ <ext>
2579
+ <doctype>article</doctype>
2580
+ </ext>
2581
+ </bibdata>
2582
+ <preface>
2583
+ <abstract id='_'>
2584
+ <title>Résumé</title>
2585
+ <p id='_'>Text</p>
2586
+ </abstract>
2587
+ <foreword id='_' obligation='informative'>
2588
+ <title>Avant-propos</title>
2589
+ <p id='_'>Text</p>
2590
+ </foreword>
2591
+ <introduction id='_' obligation='informative'>
2592
+ <title>Introduction</title>
2593
+ <clause id='_' inline-header='false' obligation='informative'>
2594
+ <title>Introduction Subsection</title>
2595
+ </clause>
2596
+ </introduction>
2597
+ <clause id='_' inline-header='false' obligation='informative'>
2598
+ <title>Dedication</title>
2599
+ </clause>
2600
+ <acknowledgements id='_' obligation='informative'>
2601
+ <title>Remerciements</title>
2602
+ </acknowledgements>
2603
+ </preface>
2604
+ <sections>
2605
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
2606
+ <title>Domaine d’application</title>
2607
+ <p id='_'>Text</p>
2608
+ </clause>
2609
+ <terms id='_' obligation='normative'>
2610
+ <title>Terms et définitions</title>
2611
+ <p id='_'>
2612
+ Pour les besoins du présent document, les termes et définitions suivants
2613
+ s’appliquent.
2614
+ </p>
2615
+ <term id='_'>
2616
+ <preferred>Term1</preferred>
2617
+ </term>
2618
+ </terms>
2619
+ <clause id='_' inline-header='false' obligation='normative'>
2620
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2621
+ <clause id='_' inline-header='false' obligation='normative'>
2622
+ <title>Introduction</title>
2623
+ <clause id='_' inline-header='false' obligation='normative'>
2624
+ <title>Intro 1</title>
2625
+ </clause>
2626
+ </clause>
2627
+ <clause id='_' inline-header='false' obligation='normative'>
2628
+ <title>Intro 2</title>
2629
+ <clause id='_' inline-header='false' obligation='normative'>
2630
+ <title>Intro 3</title>
2631
+ </clause>
2632
+ </clause>
2633
+ <clause id='_' inline-header='false' obligation='normative'>
2634
+ <title>Intro 4</title>
2635
+ <clause id='_' inline-header='false' obligation='normative'>
2636
+ <title>Intro 5</title>
2637
+ <clause id='_' inline-header='false' obligation='normative'>
2638
+ <title>Term1</title>
2639
+ </clause>
2640
+ </clause>
2641
+ </clause>
2642
+ <clause id='_' inline-header='false' obligation='normative'>
2643
+ <title>Normal Terms</title>
2644
+ <clause id='_' inline-header='false' obligation='normative'>
2645
+ <title>Term2</title>
2646
+ </clause>
2647
+ </clause>
2648
+ <definitions id='_' obligation='normative'>
2649
+ <title>Symbols and abbreviated terms</title>
2650
+ <clause id='_' inline-header='false' obligation='normative'>
2651
+ <title>General</title>
2652
+ </clause>
2653
+ <definitions id='_' type='symbols' obligation='normative'>
2654
+ <title>Symboles</title>
2655
+ </definitions>
2656
+ </definitions>
2657
+ </clause>
2658
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
2659
+ <title>Termes abrégés</title>
2660
+ </definitions>
2661
+ <clause id='_' inline-header='false' obligation='normative'>
2662
+ <title>Clause 4</title>
2663
+ <clause id='_' inline-header='false' obligation='normative'>
2664
+ <title>Introduction</title>
2665
+ </clause>
2666
+ <clause id='_' inline-header='false' obligation='normative'>
2667
+ <title>Clause 4.2</title>
2668
+ </clause>
2669
+ </clause>
2670
+ <clause id='_' inline-header='false' obligation='normative'>
2671
+ <title>Terms and Definitions</title>
2672
+ </clause>
2673
+ </sections>
2674
+ <annex id='_' inline-header='false' obligation='normative'>
2675
+ <title>Annex</title>
2676
+ <clause id='_' inline-header='false' obligation='normative'>
2677
+ <title>Annex A.1</title>
2678
+ </clause>
2679
+ </annex>
2680
+ <bibliography>
2681
+ <references id='_' normative='true' obligation='informative'>
2682
+ <title>Références normatives</title>
2683
+ <p id='_'>Le présent document ne contient aucune référence normative.</p>
2684
+ </references>
2685
+ <references id='_' normative='false' obligation='informative'>
2686
+ <title>Bibliographie</title>
2687
+ </references>
2688
+ <references id='_' normative='false' obligation='informative'>
2689
+ <title>Bibliography</title>
2690
+ </references>
2691
+ <clause id='_' obligation='informative'>
2692
+ <title>Bibliography</title>
2693
+ <references id='_' normative='false' obligation='informative'>
2694
+ <title>Bibliography Subsection</title>
2695
+ </references>
2696
+ </clause>
2697
+ </bibliography>
2698
+ </standard-document>
2699
+ OUTPUT
2700
+ end
2701
+
2702
+ it "processes section names, Simplified Chinese" do
2703
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2704
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")}
2705
+ .Foreword
2706
+
2707
+ Text
2708
+
2709
+ [abstract]
2710
+ == Abstract
2711
+
2712
+ Text
2713
+
2714
+ [heading=introduction]
2715
+ == Introduction
2716
+
2717
+ === Introduction Subsection
2718
+
2719
+ [heading=acknowledgements]
2720
+ == Acknowledgements
2721
+
2722
+ [.preface]
2723
+ == Dedication
2724
+
2725
+ [heading=scope]
2726
+ == Scope
2727
+
2728
+ Text
2729
+
2730
+ [bibliography,heading=normative references]
2731
+ == Normative References
2732
+
2733
+ [bibliography,normative=true]
2734
+ == Normative References 2
2735
+
2736
+ [heading=terms and definitions]
2737
+ == Terms and Definitions
2738
+
2739
+ === Term1
2740
+
2741
+ [heading="terms and definitions"]
2742
+ == Terms, Definitions, Symbols and Abbreviated Terms
2743
+
2744
+ [.nonterm]
2745
+ === Introduction
2746
+
2747
+ ==== Intro 1
2748
+
2749
+ === Intro 2
2750
+
2751
+ [.nonterm]
2752
+ ==== Intro 3
2753
+
2754
+ === Intro 4
2755
+
2756
+ ==== Intro 5
2757
+
2758
+ ===== Term1
2759
+
2760
+ === Normal Terms
2761
+
2762
+ ==== Term2
2763
+
2764
+ [heading=symbols and abbreviated terms]
2765
+ === Symbols and Abbreviated Terms
2766
+
2767
+ [.nonterm]
2768
+ ==== General
2769
+
2770
+ [heading=symbols]
2771
+ ==== Symbols 1
2772
+
2773
+ [heading=abbreviated terms]
2774
+ == Abbreviated Terms
2775
+
2776
+ == Clause 4
2777
+
2778
+ === Introduction
2779
+
2780
+ === Clause 4.2
2781
+
2782
+ == Terms and Definitions
2783
+
2784
+ [appendix]
2785
+ == Annex
2786
+
2787
+ === Annex A.1
2788
+
2789
+ [bibliography,heading=bibliography]
2790
+ == Bibliography
2791
+
2792
+ [bibliography,normative=false]
2793
+ == Bibliography 2
2794
+
2795
+ === Bibliography Subsection
2796
+
2797
+ INPUT
2798
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
2799
+ <bibdata type='standard'>
2800
+ <title language='en' format='text/plain'>Document title</title>
2801
+ <language>zh</language>
2802
+ <script>Hans</script>
2803
+ <abstract>
2804
+ <p>Text</p>
2805
+ </abstract>
2806
+ <status>
2807
+ <stage>published</stage>
2808
+ </status>
2809
+ <copyright>
2810
+ <from>2020</from>
2811
+ </copyright>
2812
+ <ext>
2813
+ <doctype>article</doctype>
2814
+ </ext>
2815
+ </bibdata>
2816
+ <preface>
2817
+ <abstract id='_'>
2818
+ <title>摘要</title>
2819
+ <p id='_'>Text</p>
2820
+ </abstract>
2821
+ <foreword id='_' obligation='informative'>
2822
+ <title>前言</title>
2823
+ <p id='_'>Text</p>
2824
+ </foreword>
2825
+ <introduction id='_' obligation='informative'>
2826
+ <title>引言</title>
2827
+ <clause id='_' inline-header='false' obligation='informative'>
2828
+ <title>Introduction Subsection</title>
2829
+ </clause>
2830
+ </introduction>
2831
+ <clause id='_' inline-header='false' obligation='informative'>
2832
+ <title>Dedication</title>
2833
+ </clause>
2834
+ <acknowledgements id='_' obligation='informative'>
2835
+ <title>致謝</title>
2836
+ </acknowledgements>
2837
+ </preface>
2838
+ <sections>
2839
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
2840
+ <title>范围</title>
2841
+ <p id='_'>Text</p>
2842
+ </clause>
2843
+ <terms id='_' obligation='normative'>
2844
+ <title>术语和定义</title>
2845
+ <p id='_'>下列术语和定义适用于本文件。</p>
2846
+ <term id='_'>
2847
+ <preferred>Term1</preferred>
2848
+ </term>
2849
+ </terms>
2850
+ <clause id='_' inline-header='false' obligation='normative'>
2851
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
2852
+ <clause id='_' inline-header='false' obligation='normative'>
2853
+ <title>Introduction</title>
2854
+ <clause id='_' inline-header='false' obligation='normative'>
2855
+ <title>Intro 1</title>
2856
+ </clause>
2857
+ </clause>
2858
+ <clause id='_' inline-header='false' obligation='normative'>
2859
+ <title>Intro 2</title>
2860
+ <clause id='_' inline-header='false' obligation='normative'>
2861
+ <title>Intro 3</title>
2862
+ </clause>
2863
+ </clause>
2864
+ <clause id='_' inline-header='false' obligation='normative'>
2865
+ <title>Intro 4</title>
2866
+ <clause id='_' inline-header='false' obligation='normative'>
2867
+ <title>Intro 5</title>
2868
+ <clause id='_' inline-header='false' obligation='normative'>
2869
+ <title>Term1</title>
2870
+ </clause>
2871
+ </clause>
2872
+ </clause>
2873
+ <clause id='_' inline-header='false' obligation='normative'>
2874
+ <title>Normal Terms</title>
2875
+ <clause id='_' inline-header='false' obligation='normative'>
2876
+ <title>Term2</title>
2877
+ </clause>
2878
+ </clause>
2879
+ <definitions id='_' obligation='normative'>
2880
+ <title>符号、代号和缩略语</title>
2881
+ <clause id='_' inline-header='false' obligation='normative'>
2882
+ <title>General</title>
2883
+ </clause>
2884
+ <definitions id='_' type='symbols' obligation='normative'>
2885
+ <title>符号</title>
2886
+ </definitions>
2887
+ </definitions>
2888
+ </clause>
2889
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
2890
+ <title>代号和缩略语</title>
2891
+ </definitions>
2892
+ <clause id='_' inline-header='false' obligation='normative'>
2893
+ <title>Clause 4</title>
2894
+ <clause id='_' inline-header='false' obligation='normative'>
2895
+ <title>Introduction</title>
2896
+ </clause>
2897
+ <clause id='_' inline-header='false' obligation='normative'>
2898
+ <title>Clause 4.2</title>
2899
+ </clause>
2900
+ </clause>
2901
+ <clause id='_' inline-header='false' obligation='normative'>
2902
+ <title>Terms and Definitions</title>
2903
+ </clause>
2904
+ </sections>
2905
+ <annex id='_' inline-header='false' obligation='normative'>
2906
+ <title>Annex</title>
2907
+ <clause id='_' inline-header='false' obligation='normative'>
2908
+ <title>Annex A.1</title>
2909
+ </clause>
2910
+ </annex>
2911
+ <bibliography>
2912
+ <references id='_' normative='true' obligation='informative'>
2913
+ <title>规范性引用文件</title>
2914
+ <p id='_'>本文件并没有规范性引用文件。</p>
2915
+ </references>
2916
+ <references id='_' normative='false' obligation='informative'>
2917
+ <title>参考文献</title>
2918
+ </references>
2919
+ <references id='_' normative='false' obligation='informative'>
2920
+ <title>Bibliography</title>
2921
+ </references>
2922
+ <clause id='_' obligation='informative'>
2923
+ <title>Bibliography</title>
2924
+ <references id='_' normative='false' obligation='informative'>
2925
+ <title>Bibliography Subsection</title>
2926
+ </references>
2927
+ </clause>
2928
+ </bibliography>
2929
+ </standard-document>
2930
+ OUTPUT
2931
+ end
2932
+
2933
+ it "processes section names, internationalisation file" do
2934
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2935
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")}
2936
+ .Foreword
2937
+
2938
+ Text
2939
+
2940
+ [abstract]
2941
+ == Abstract
2942
+
2943
+ Text
2944
+
2945
+ [heading=introduction]
2946
+ == Introduction
2947
+
2948
+ === Introduction Subsection
2949
+
2950
+ [heading=acknowledgements]
2951
+ == Acknowledgements
2952
+
2953
+ [.preface]
2954
+ == Dedication
2955
+
2956
+ [heading=scope]
2957
+ == Scope
2958
+
2959
+ Text
2960
+
2961
+ [bibliography,heading=normative references]
2962
+ == Normative References
2963
+
2964
+ [bibliography,normative=true]
2965
+ == Normative References 2
2966
+
2967
+ [heading=terms and definitions]
2968
+ == Terms and Definitions
2969
+
2970
+ === Term1
2971
+
2972
+ [heading="terms and definitions"]
2973
+ == Terms, Definitions, Symbols and Abbreviated Terms
2974
+
2975
+ [.nonterm]
2976
+ === Introduction
2977
+
2978
+ ==== Intro 1
2979
+
2980
+ === Intro 2
2981
+
2982
+ [.nonterm]
2983
+ ==== Intro 3
2984
+
2985
+ === Intro 4
2986
+
2987
+ ==== Intro 5
2988
+
2989
+ ===== Term1
2990
+
2991
+ === Normal Terms
2992
+
2993
+ ==== Term2
2994
+
2995
+ [heading=symbols and abbreviated terms]
2996
+ === Symbols and Abbreviated Terms
2997
+
2998
+ [.nonterm]
2999
+ ==== General
3000
+
3001
+ [heading=symbols]
3002
+ ==== Symbols 1
3003
+
3004
+ [heading=abbreviated terms]
3005
+ == Abbreviated Terms
3006
+
3007
+ == Clause 4
3008
+
3009
+ === Introduction
3010
+
3011
+ === Clause 4.2
3012
+
3013
+ == Terms and Definitions
3014
+
3015
+ [appendix]
3016
+ == Annex
3017
+
3018
+ === Annex A.1
3019
+
3020
+ [bibliography,heading=bibliography]
3021
+ == Bibliography
3022
+
3023
+ [bibliography,normative=false]
3024
+ == Bibliography 2
3025
+
3026
+ === Bibliography Subsection
3027
+
3028
+ INPUT
3029
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
3030
+ <bibdata type='standard'>
3031
+ <title language='en' format='text/plain'>Document title</title>
3032
+ <language>en</language>
3033
+ <script>Latn</script>
3034
+ <abstract>
3035
+ <p>Text</p>
3036
+ </abstract>
3037
+ <status>
3038
+ <stage>published</stage>
3039
+ </status>
3040
+ <copyright>
3041
+ <from>2020</from>
3042
+ </copyright>
3043
+ <ext>
3044
+ <doctype>article</doctype>
3045
+ </ext>
3046
+ </bibdata>
3047
+ <preface>
3048
+ <abstract id='_'>
3049
+ <title>Abstract</title>
3050
+ <p id='_'>Text</p>
3051
+ </abstract>
3052
+ <foreword id='_' obligation='informative'>
3053
+ <title>Antaŭparolo</title>
3054
+ <p id='_'>Text</p>
3055
+ </foreword>
3056
+ <introduction id='_' obligation='informative'>
3057
+ <title>Enkonduko</title>
3058
+ <clause id='_' inline-header='false' obligation='informative'>
3059
+ <title>Introduction Subsection</title>
3060
+ </clause>
3061
+ </introduction>
3062
+ <clause id='_' inline-header='false' obligation='informative'>
3063
+ <title>Dedication</title>
3064
+ </clause>
3065
+ <acknowledgements id='_' obligation='informative'>
3066
+ <title>Acknowledgements</title>
3067
+ </acknowledgements>
3068
+ </preface>
3069
+ <sections>
3070
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
3071
+ <title>Amplekso</title>
3072
+ <p id='_'>Text</p>
3073
+ </clause>
3074
+ <terms id='_' obligation='normative'>
3075
+ <title>Terms and definitions</title>
3076
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
3077
+ <term id='_'>
3078
+ <preferred>Term1</preferred>
3079
+ </term>
3080
+ </terms>
3081
+ <clause id='_' inline-header='false' obligation='normative'>
3082
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
3083
+ <clause id='_' inline-header='false' obligation='normative'>
3084
+ <title>Introduction</title>
3085
+ <clause id='_' inline-header='false' obligation='normative'>
3086
+ <title>Intro 1</title>
3087
+ </clause>
3088
+ </clause>
3089
+ <clause id='_' inline-header='false' obligation='normative'>
3090
+ <title>Intro 2</title>
3091
+ <clause id='_' inline-header='false' obligation='normative'>
3092
+ <title>Intro 3</title>
3093
+ </clause>
3094
+ </clause>
3095
+ <clause id='_' inline-header='false' obligation='normative'>
3096
+ <title>Intro 4</title>
3097
+ <clause id='_' inline-header='false' obligation='normative'>
3098
+ <title>Intro 5</title>
3099
+ <clause id='_' inline-header='false' obligation='normative'>
3100
+ <title>Term1</title>
3101
+ </clause>
3102
+ </clause>
3103
+ </clause>
3104
+ <clause id='_' inline-header='false' obligation='normative'>
3105
+ <title>Normal Terms</title>
3106
+ <clause id='_' inline-header='false' obligation='normative'>
3107
+ <title>Term2</title>
3108
+ </clause>
3109
+ </clause>
3110
+ <definitions id='_' obligation='normative'>
3111
+ <title>Symbols and abbreviated terms</title>
3112
+ <clause id='_' inline-header='false' obligation='normative'>
3113
+ <title>General</title>
3114
+ </clause>
3115
+ <definitions id='_' type='symbols' obligation='normative'>
3116
+ <title>Simboloj kai mallongigitaj terminoj</title>
3117
+ </definitions>
3118
+ </definitions>
3119
+ </clause>
3120
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
3121
+ <title>Abbreviated terms</title>
3122
+ </definitions>
3123
+ <clause id='_' inline-header='false' obligation='normative'>
3124
+ <title>Clause 4</title>
3125
+ <clause id='_' inline-header='false' obligation='normative'>
3126
+ <title>Introduction</title>
3127
+ </clause>
3128
+ <clause id='_' inline-header='false' obligation='normative'>
3129
+ <title>Clause 4.2</title>
3130
+ </clause>
3131
+ </clause>
3132
+ <clause id='_' inline-header='false' obligation='normative'>
3133
+ <title>Terms and Definitions</title>
3134
+ </clause>
3135
+ </sections>
3136
+ <annex id='_' inline-header='false' obligation='normative'>
3137
+ <title>Annex</title>
3138
+ <clause id='_' inline-header='false' obligation='normative'>
3139
+ <title>Annex A.1</title>
3140
+ </clause>
3141
+ </annex>
3142
+ <bibliography>
3143
+ <references id='_' normative='true' obligation='informative'>
3144
+ <title>Normaj citaĵoj</title>
3145
+ <p id='_'>There are no normative references in this document.</p>
3146
+ </references>
3147
+ <references id='_' normative='false' obligation='informative'>
3148
+ <title>Bibliografio</title>
3149
+ </references>
3150
+ <references id='_' normative='false' obligation='informative'>
3151
+ <title>Bibliography</title>
3152
+ </references>
3153
+ <clause id='_' obligation='informative'>
3154
+ <title>Bibliography</title>
3155
+ <references id='_' normative='false' obligation='informative'>
3156
+ <title>Bibliography Subsection</title>
3157
+ </references>
3158
+ </clause>
3159
+ </bibliography>
3160
+ </standard-document>
3161
+ OUTPUT
3162
+ end
3163
+
3164
+ it "fixes illegal anchors" do
3165
+ input = <<~INPUT
3166
+ #{ASCIIDOC_BLANK_HDR}
3167
+
3168
+ [[a:b]]
3169
+ == A
3170
+ <</:ab>>
3171
+ <<:>>
3172
+ <<1>>
3173
+ <<1:>>
3174
+ <<1#b>>
3175
+ <<:a#b:>>
3176
+
3177
+ INPUT
3178
+ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
3179
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc'>
3180
+ <bibdata type='standard'>
3181
+ <title language='en' format='text/plain'>Document title</title>
3182
+ <language>en</language>
3183
+ <script>Latn</script>
3184
+ <status>
3185
+ <stage>published</stage>
3186
+ </status>
3187
+ <copyright>
3188
+ <from>2020</from>
3189
+ </copyright>
3190
+ <ext>
3191
+ <doctype>article</doctype>
3192
+ </ext>
3193
+ </bibdata>
3194
+ <sections>
3195
+ <clause id='a_b' inline-header='false' obligation='normative'>
3196
+ <title>A</title>
3197
+ <xref target='__ab'/>
3198
+ <xref target='_'/>
3199
+ <xref target='_1'/>
3200
+ <xref target='_1_'/>
3201
+ <xref target='1#b'/>
3202
+ <xref target='_a#b_'/>
3203
+ </clause>
3204
+ </sections>
3205
+ </standard-document>
3206
+ OUTPUT
3207
+ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b}).to_stderr
3208
+ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="__ab"/> from /:ab}).to_stderr
3209
+ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_"/> from :}).to_stderr
3210
+ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1"/> from 1}).to_stderr
3211
+ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1_"/> from 1:}).to_stderr
3212
+ expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_a#b_"/> from :a#b:}).to_stderr
3213
+ end
3214
+
3215
+
1902
3216
  private
1903
3217
 
1904
3218
  def mock_iecbib_get_iec60050_103_01