metanorma-standoc 1.10.0 → 1.10.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/standoc/base.rb +0 -1
  3. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  4. data/lib/asciidoctor/standoc/cleanup.rb +62 -2
  5. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
  6. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -2
  7. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
  8. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
  9. data/lib/asciidoctor/standoc/cleanup_section.rb +0 -1
  10. data/lib/asciidoctor/standoc/converter.rb +3 -0
  11. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +22 -21
  12. data/lib/asciidoctor/standoc/front.rb +0 -1
  13. data/lib/asciidoctor/standoc/front_contributor.rb +0 -1
  14. data/lib/asciidoctor/standoc/isodoc.rng +44 -7
  15. data/lib/asciidoctor/standoc/macros.rb +25 -5
  16. data/lib/asciidoctor/standoc/macros_plantuml.rb +3 -3
  17. data/lib/asciidoctor/standoc/macros_terms.rb +34 -7
  18. data/lib/asciidoctor/standoc/ref.rb +60 -56
  19. data/lib/asciidoctor/standoc/section.rb +19 -12
  20. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +59 -18
  21. data/lib/asciidoctor/standoc/utils.rb +0 -1
  22. data/lib/asciidoctor/standoc/validate.rb +4 -3
  23. data/lib/isodoc/html/html_titlepage.html +81 -0
  24. data/lib/isodoc/html/htmlstyle.css +983 -0
  25. data/lib/isodoc/html/htmlstyle.scss +714 -0
  26. data/lib/isodoc/html/scripts.html +71 -0
  27. data/lib/metanorma/standoc/processor.rb +16 -7
  28. data/lib/metanorma/standoc/version.rb +1 -1
  29. data/metanorma-standoc.gemspec +1 -1
  30. data/spec/asciidoctor/blocks_spec.rb +2 -2
  31. data/spec/asciidoctor/cleanup_sections_spec.rb +899 -864
  32. data/spec/asciidoctor/cleanup_spec.rb +64 -14
  33. data/spec/asciidoctor/macros_json2text_spec.rb +1 -1
  34. data/spec/asciidoctor/macros_plantuml_spec.rb +165 -104
  35. data/spec/asciidoctor/macros_spec.rb +396 -75
  36. data/spec/asciidoctor/validate_spec.rb +12 -2
  37. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +34 -34
  38. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
  39. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  40. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  41. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  42. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  43. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  44. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  45. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  46. metadata +8 -4
@@ -0,0 +1,71 @@
1
+ <script>
2
+ $("#toc").on('click', 'li', function(e) {
3
+ $(this).parent().find('li.toc-active').removeClass('toc-active');
4
+ $(this).addClass('toc-active');
5
+ });
6
+ </script>
7
+
8
+ <script>
9
+ //TOC toggle animation
10
+ $('#toggle').on('click', function(){
11
+ if( $('nav').is(':visible') ) {
12
+ $('nav').animate({ 'left': '-353px' }, 'slow', function(){
13
+ $('nav').hide();
14
+ });
15
+ $('.container').animate({ 'padding-left': '31px' }, 'slow');
16
+ }
17
+ else {
18
+ $('nav').show();
19
+ $('nav').animate({ 'left': '0px' }, 'slow');
20
+ $('.container').animate({ 'padding-left': '360px' }, 'slow');
21
+ }
22
+ });
23
+ </script>
24
+
25
+ <script>
26
+ // Scroll to top button
27
+ window.onscroll = function() {scrollFunction()};
28
+
29
+ function scrollFunction() {
30
+ if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
31
+ document.getElementById("myBtn").style.display = "block";
32
+ } else {
33
+ document.getElementById("myBtn").style.display = "none";
34
+ }
35
+ }
36
+
37
+ // When the user clicks on the button, scroll to the top of the document
38
+ function topFunction() {
39
+ document.body.scrollTop = 0;
40
+ document.documentElement.scrollTop = 0;
41
+ }
42
+ </script>
43
+
44
+ <script>
45
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
46
+ //
47
+ // AnchorJS - v4.2.2 - 2020-04-20
48
+ // https://www.bryanbraun.com/anchorjs/
49
+ // Copyright (c) 2020 Bryan Braun; Licensed MIT
50
+ //
51
+ // @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
52
+ !function(A,e){"use strict";"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){"use strict";return function(A){function f(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.ariaLabel=A.hasOwnProperty("ariaLabel")?A.ariaLabel:"Anchor",A.class=A.hasOwnProperty("class")?A.class:"",A.base=A.hasOwnProperty("base")?A.base:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64,A.titleText=A.hasOwnProperty("titleText")?A.titleText:""}function p(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}this.options=A||{},this.elements=[],f(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var e,t,i,n,o,s,a,r,c,h,l,u,d=[];if(f(this.options),"touch"===(l=this.options.visible)&&(l=this.isTouchDevice()?"always":"hover"),0===(e=p(A=A||"h2, h3, h4, h5, h6")).length)return this;for(!function(){if(null!==document.head.querySelector("style.anchorjs"))return;var A,e=document.createElement("style");e.className="anchorjs",e.appendChild(document.createTextNode("")),void 0===(A=document.head.querySelector('[rel="stylesheet"],style'))?document.head.appendChild(e):document.head.insertBefore(e,A);e.sheet.insertRule(".anchorjs-link{opacity:0;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}",e.sheet.cssRules.length),e.sheet.insertRule(":hover>.anchorjs-link,.anchorjs-link:focus{opacity:1}",e.sheet.cssRules.length),e.sheet.insertRule("[data-anchorjs-icon]::after{content:attr(data-anchorjs-icon)}",e.sheet.cssRules.length),e.sheet.insertRule('@font-face{font-family:anchorjs-icons;src:url(data:n/a;base64,AAEAAAALAIAAAwAwT1MvMg8yG2cAAAE4AAAAYGNtYXDp3gC3AAABpAAAAExnYXNwAAAAEAAAA9wAAAAIZ2x5ZlQCcfwAAAH4AAABCGhlYWQHFvHyAAAAvAAAADZoaGVhBnACFwAAAPQAAAAkaG10eASAADEAAAGYAAAADGxvY2EACACEAAAB8AAAAAhtYXhwAAYAVwAAARgAAAAgbmFtZQGOH9cAAAMAAAAAunBvc3QAAwAAAAADvAAAACAAAQAAAAEAAHzE2p9fDzz1AAkEAAAAAADRecUWAAAAANQA6R8AAAAAAoACwAAAAAgAAgAAAAAAAAABAAADwP/AAAACgAAA/9MCrQABAAAAAAAAAAAAAAAAAAAAAwABAAAAAwBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAMCQAGQAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAAAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAQAAg//0DwP/AAEADwABAAAAAAQAAAAAAAAAAAAAAIAAAAAAAAAIAAAACgAAxAAAAAwAAAAMAAAAcAAEAAwAAABwAAwABAAAAHAAEADAAAAAIAAgAAgAAACDpy//9//8AAAAg6cv//f///+EWNwADAAEAAAAAAAAAAAAAAAAACACEAAEAAAAAAAAAAAAAAAAxAAACAAQARAKAAsAAKwBUAAABIiYnJjQ3NzY2MzIWFxYUBwcGIicmNDc3NjQnJiYjIgYHBwYUFxYUBwYGIwciJicmNDc3NjIXFhQHBwYUFxYWMzI2Nzc2NCcmNDc2MhcWFAcHBgYjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAAADACWAAEAAAAAAAEACAAAAAEAAAAAAAIAAwAIAAEAAAAAAAMACAAAAAEAAAAAAAQACAAAAAEAAAAAAAUAAQALAAEAAAAAAAYACAAAAAMAAQQJAAEAEAAMAAMAAQQJAAIABgAcAAMAAQQJAAMAEAAMAAMAAQQJAAQAEAAMAAMAAQQJAAUAAgAiAAMAAQQJAAYAEAAMYW5jaG9yanM0MDBAAGEAbgBjAGgAbwByAGoAcwA0ADAAMABAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAH//wAP) format("truetype")}',e.sheet.cssRules.length)}(),t=document.querySelectorAll("[id]"),i=[].map.call(t,function(A){return A.id}),o=0;o<e.length;o++)if(this.hasAnchorJSLink(e[o]))d.push(o);else{if(e[o].hasAttribute("id"))n=e[o].getAttribute("id");else if(e[o].hasAttribute("data-anchor-id"))n=e[o].getAttribute("data-anchor-id");else{for(c=r=this.urlify(e[o].textContent),a=0;void 0!==s&&(c=r+"-"+a),a+=1,-1!==(s=i.indexOf(c)););s=void 0,i.push(c),e[o].setAttribute("id",c),n=c}(h=document.createElement("a")).className="anchorjs-link "+this.options.class,h.setAttribute("aria-label",this.options.ariaLabel),h.setAttribute("data-anchorjs-icon",this.options.icon),this.options.titleText&&(h.title=this.options.titleText),u=document.querySelector("base")?window.location.pathname+window.location.search:"",u=this.options.base||u,h.href=u+"#"+n,"always"===l&&(h.style.opacity="1"),""===this.options.icon&&(h.style.font="1em/1 anchorjs-icons","left"===this.options.placement&&(h.style.lineHeight="inherit")),"left"===this.options.placement?(h.style.position="absolute",h.style.marginLeft="-1em",h.style.paddingRight="0.5em",e[o].insertBefore(h,e[o].firstChild)):(h.style.paddingLeft="0.375em",e[o].appendChild(h))}for(o=0;o<d.length;o++)e.splice(d[o]-o,1);return this.elements=this.elements.concat(e),this},this.remove=function(A){for(var e,t,i=p(A),n=0;n<i.length;n++)(t=i[n].querySelector(".anchorjs-link"))&&(-1!==(e=this.elements.indexOf(i[n]))&&this.elements.splice(e,1),i[n].removeChild(t));return this},this.removeAll=function(){this.remove(this.elements)},this.urlify=function(A){return this.options.truncate||f(this.options),A.trim().replace(/\'/gi,"").replace(/[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\\n\t\b\v]/g,"-").replace(/-{2,}/g,"-").substring(0,this.options.truncate).replace(/^-+|-+$/gm,"").toLowerCase()},this.hasAnchorJSLink=function(A){var e=A.firstChild&&-1<(" "+A.firstChild.className+" ").indexOf(" anchorjs-link "),t=A.lastChild&&-1<(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ");return e||t||!1}}});
53
+ // @license-end
54
+ </script>
55
+ <script>
56
+ /*
57
+ $(document).ready(function() {
58
+ $('[id^=toc]').each(function ()
59
+ {
60
+ var currentToc = $(this);
61
+ var url = window.location.href;
62
+ currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' </a>");
63
+ });
64
+ });
65
+ */
66
+ anchors.options = {
67
+ placement: 'left'
68
+ };
69
+ anchors.add('h1, h2, h3, h4');
70
+ </script>
71
+
@@ -3,8 +3,7 @@ require "metanorma/processor"
3
3
  module Metanorma
4
4
  module Standoc
5
5
  class Processor < Metanorma::Processor
6
-
7
- def initialize
6
+ def initialize # rubocop:disable Lint/MissingSuper
8
7
  @short = :standoc
9
8
  @input_format = :asciidoc
10
9
  @asciidoctor_backend = :standoc
@@ -13,7 +12,7 @@ module Metanorma
13
12
  def output_formats
14
13
  super.merge(
15
14
  html: "html",
16
- doc: "doc"
15
+ doc: "doc",
17
16
  )
18
17
  end
19
18
 
@@ -21,14 +20,24 @@ module Metanorma
21
20
  "Metanorma::Standoc #{Metanorma::Standoc::VERSION}/IsoDoc #{IsoDoc::VERSION}"
22
21
  end
23
22
 
24
- def output(isodoc_node, inname, outname, format, options={})
23
+ def html_path(file)
24
+ File.join(File.dirname(__FILE__), "..", "..", "isodoc", "html", file)
25
+ end
26
+
27
+ def output(isodoc_node, inname, outname, format, options = {})
25
28
  case format
26
29
  when :html
27
- IsoDoc::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
30
+ options = options
31
+ .merge(htmlstylesheet: html_path("htmlstyle.scss"),
32
+ htmlcoverpage: html_path("html_titlepage.html"))
33
+ IsoDoc::HtmlConvert.new(options)
34
+ .convert(inname, isodoc_node, nil, outname)
28
35
  when :doc
29
- IsoDoc::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
36
+ IsoDoc::WordConvert.new(options)
37
+ .convert(inname, isodoc_node, nil, outname)
30
38
  when :presentation
31
- IsoDoc::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
39
+ IsoDoc::PresentationXMLConvert.new(options)
40
+ .convert(inname, isodoc_node, nil, outname)
32
41
  else
33
42
  super
34
43
  end
@@ -19,6 +19,6 @@ module Metanorma
19
19
  end
20
20
 
21
21
  module Standoc
22
- VERSION = "1.10.0".freeze
22
+ VERSION = "1.10.3.1".freeze
23
23
  end
24
24
  end
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "metanorma-plugin-lutaml"
34
34
  spec.add_dependency "ruby-jing"
35
35
  # relaton-cli not just relaton, to avoid circular reference in metanorma
36
- spec.add_dependency "asciimath2unitsml", "~> 0.3.0"
36
+ spec.add_dependency "asciimath2unitsml", "~> 0.4.0"
37
37
  spec.add_dependency "concurrent-ruby"
38
38
  spec.add_dependency "latexmath"
39
39
  spec.add_dependency "mathml2asciimath"
@@ -103,11 +103,11 @@ RSpec.describe Asciidoctor::Standoc do
103
103
  <mi>r</mi>
104
104
  <mo>=</mo>
105
105
  <mn>1</mn>
106
- <mi>%</mi>
106
+ <mo>%</mo>
107
107
  <mi>r</mi>
108
108
  <mo>=</mo>
109
109
  <mn>1</mn>
110
- <mi>%</mi>
110
+ <mo>%</mo>
111
111
  </math>
112
112
  </stem>
113
113
  </formula>
@@ -4,7 +4,7 @@ require "fileutils"
4
4
 
5
5
  RSpec.describe Asciidoctor::Standoc do
6
6
  it "appends any initial user-supplied text to boilerplate in terms and definitions" do
7
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
+ input = <<~INPUT
8
8
  #{ASCIIDOC_BLANK_HDR}
9
9
  == Terms and Definitions
10
10
 
@@ -16,27 +16,30 @@ RSpec.describe Asciidoctor::Standoc do
16
16
 
17
17
  This paragraph is extraneous
18
18
  INPUT
19
- #{BLANK_HDR}
20
- <sections>
21
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
22
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
23
- <p id='_'>I am boilerplate</p>
24
- <ul id='_'>
25
- <li>
26
- <p id='_'>So am I</p>
27
- </li>
28
- </ul>
29
- <term id="term-time">
30
- <preferred>Time</preferred>
31
- <definition><p id="_">This paragraph is extraneous</p></definition>
32
- </term></terms>
33
- </sections>
34
- </standard-document>
19
+ output = <<~OUTPUT
20
+ #{BLANK_HDR}
21
+ <sections>
22
+ <terms id="_" obligation="normative"><title>Terms and definitions</title>
23
+ <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
24
+ <p id='_'>I am boilerplate</p>
25
+ <ul id='_'>
26
+ <li>
27
+ <p id='_'>So am I</p>
28
+ </li>
29
+ </ul>
30
+ <term id="term-time">
31
+ <preferred>Time</preferred>
32
+ <definition><p id="_">This paragraph is extraneous</p></definition>
33
+ </term></terms>
34
+ </sections>
35
+ </standard-document>
35
36
  OUTPUT
37
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
38
+ .to be_equivalent_to xmlpp(output)
36
39
  end
37
40
 
38
41
  it "removes initial extraneous material from Normative References" do
39
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
42
+ input = <<~INPUT
40
43
  #{ASCIIDOC_BLANK_HDR}
41
44
  [bibliography]
42
45
  == Normative References
@@ -47,6 +50,7 @@ RSpec.describe Asciidoctor::Standoc do
47
50
 
48
51
  This is also extraneous information
49
52
  INPUT
53
+ output = <<~OUTPUT
50
54
  #{BLANK_HDR}
51
55
  <sections></sections>
52
56
  <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
@@ -67,10 +71,12 @@ RSpec.describe Asciidoctor::Standoc do
67
71
  </bibliography>
68
72
  </standard-document>
69
73
  OUTPUT
74
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
75
+ .to be_equivalent_to xmlpp(output)
70
76
  end
71
77
 
72
78
  it "preserves user-supplied boilerplate in Normative References" do
73
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
79
+ input = <<~INPUT
74
80
  #{ASCIIDOC_BLANK_HDR}
75
81
  [bibliography]
76
82
  == Normative References
@@ -84,6 +90,7 @@ RSpec.describe Asciidoctor::Standoc do
84
90
 
85
91
  This is also extraneous information
86
92
  INPUT
93
+ output = <<~OUTPUT
87
94
  #{BLANK_HDR}
88
95
  <sections></sections>
89
96
  <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
@@ -104,10 +111,12 @@ RSpec.describe Asciidoctor::Standoc do
104
111
  </bibliography>
105
112
  </standard-document>
106
113
  OUTPUT
114
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
115
+ .to be_equivalent_to xmlpp(output)
107
116
  end
108
117
 
109
118
  it "sorts references with their notes in Bibliography" do
110
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
119
+ input = <<~INPUT
111
120
  #{ASCIIDOC_BLANK_HDR}
112
121
  [bibliography]
113
122
  == Bibliography
@@ -130,6 +139,7 @@ RSpec.describe Asciidoctor::Standoc do
130
139
 
131
140
  This is also extraneous information
132
141
  INPUT
142
+ output = <<~OUTPUT
133
143
  #{BLANK_HDR}
134
144
  <sections> </sections>
135
145
  <bibliography>
@@ -178,10 +188,12 @@ RSpec.describe Asciidoctor::Standoc do
178
188
  </bibliography>
179
189
  </standard-document>
180
190
  OUTPUT
181
- end
191
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
192
+ .to be_equivalent_to xmlpp(output)
193
+ end
182
194
 
183
195
  it "defaults section obligations" do
184
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
196
+ input = <<~INPUT
185
197
  #{ASCIIDOC_BLANK_HDR}
186
198
 
187
199
  == Clause
@@ -192,150 +204,159 @@ end
192
204
 
193
205
  Text
194
206
  INPUT
195
- #{BLANK_HDR}
196
- <sections><clause id="_" inline-header="false" obligation="normative">
197
- <title>Clause</title>
198
- <p id="_">Text</p>
199
- </clause>
200
- </sections><annex id="_" inline-header="false" obligation="normative">
201
- <title>Clause</title>
202
- <p id="_">Text</p>
203
- </annex>
204
- </standard-document>
207
+ output = <<~OUTPUT
208
+ #{BLANK_HDR}
209
+ <sections><clause id="_" inline-header="false" obligation="normative">
210
+ <title>Clause</title>
211
+ <p id="_">Text</p>
212
+ </clause>
213
+ </sections><annex id="_" inline-header="false" obligation="normative">
214
+ <title>Clause</title>
215
+ <p id="_">Text</p>
216
+ </annex>
217
+ </standard-document>
205
218
  OUTPUT
219
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
220
+ .to be_equivalent_to xmlpp(output)
206
221
  end
207
222
 
208
223
  it "extends clause levels past 5" do
209
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
210
- #{ASCIIDOC_BLANK_HDR}
224
+ input = <<~INPUT
225
+ #{ASCIIDOC_BLANK_HDR}
211
226
 
212
- == Clause1
227
+ == Clause1
213
228
 
214
- === Clause2
229
+ === Clause2
215
230
 
216
- ==== Clause3
231
+ ==== Clause3
217
232
 
218
- ===== Clause4
233
+ ===== Clause4
219
234
 
220
- ====== Clause 5
235
+ ====== Clause 5
221
236
 
222
- [level=6]
223
- ====== Clause 6
237
+ [level=6]
238
+ ====== Clause 6
224
239
 
225
- [level=7]
226
- ====== Clause 7A
240
+ [level=7]
241
+ ====== Clause 7A
227
242
 
228
- [level=7]
229
- ====== Clause 7B
243
+ [level=7]
244
+ ====== Clause 7B
230
245
 
231
- [level=6]
232
- ====== Clause 6B
246
+ [level=6]
247
+ ====== Clause 6B
233
248
 
234
- ====== Clause 5B
249
+ ====== Clause 5B
235
250
 
236
251
  INPUT
237
- #{BLANK_HDR}
238
- <sections>
239
- <clause id="_" inline-header="false" obligation="normative">
240
- <title>Clause1</title>
241
- <clause id="_" inline-header="false" obligation="normative">
242
- <title>Clause2</title>
243
- <clause id="_" inline-header="false" obligation="normative">
244
- <title>Clause3</title>
245
- <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
246
- <title>Clause 5</title>
247
- <clause id="_" inline-header="false" obligation="normative">
248
- <title>Clause 6</title>
249
- <clause id="_" inline-header="false" obligation="normative">
250
- <title>Clause 7A</title>
251
- </clause><clause id="_" inline-header="false" obligation="normative">
252
- <title>Clause 7B</title>
253
- </clause></clause><clause id="_" inline-header="false" obligation="normative">
254
- <title>Clause 6B</title>
255
- </clause></clause>
256
-
257
-
258
-
259
-
260
- <clause id="_" inline-header="false" obligation="normative">
261
- <title>Clause 5B</title>
262
- </clause></clause>
263
- </clause>
264
- </clause>
265
- </clause>
266
- </sections>
267
- </standard-document>
252
+ output = <<~OUTPUT
253
+ #{BLANK_HDR}
254
+ <sections>
255
+ <clause id="_" inline-header="false" obligation="normative">
256
+ <title>Clause1</title>
257
+ <clause id="_" inline-header="false" obligation="normative">
258
+ <title>Clause2</title>
259
+ <clause id="_" inline-header="false" obligation="normative">
260
+ <title>Clause3</title>
261
+ <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
262
+ <title>Clause 5</title>
263
+ <clause id="_" inline-header="false" obligation="normative">
264
+ <title>Clause 6</title>
265
+ <clause id="_" inline-header="false" obligation="normative">
266
+ <title>Clause 7A</title>
267
+ </clause><clause id="_" inline-header="false" obligation="normative">
268
+ <title>Clause 7B</title>
269
+ </clause></clause><clause id="_" inline-header="false" obligation="normative">
270
+ <title>Clause 6B</title>
271
+ </clause></clause>
272
+ <clause id="_" inline-header="false" obligation="normative">
273
+ <title>Clause 5B</title>
274
+ </clause></clause>
275
+ </clause>
276
+ </clause>
277
+ </clause>
278
+ </sections>
279
+ </standard-document>
268
280
  OUTPUT
281
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
282
+ .to be_equivalent_to xmlpp(output)
269
283
  end
270
284
 
271
- it "inserts boilerplate before empty Normative References" do
272
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
285
+ it "inserts boilerplate before empty Normative References" do
286
+ input = <<~INPUT
273
287
  #{ASCIIDOC_BLANK_HDR}
274
288
 
275
289
  [bibliography]
276
290
  == Normative References
277
291
 
278
- INPUT
279
- #{BLANK_HDR}
280
- <sections>
281
-
282
- </sections><bibliography><references id="_" obligation="informative" normative="true">
283
- <title>Normative references</title><p id="_">There are no normative references in this document.</p>
284
- </references></bibliography>
285
- </standard-document>
286
- OUTPUT
287
- end
292
+ INPUT
293
+ output = <<~OUTPUT
294
+ #{BLANK_HDR}
295
+ <sections>
296
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
297
+ <title>Normative references</title><p id="_">There are no normative references in this document.</p>
298
+ </references></bibliography>
299
+ </standard-document>
300
+ OUTPUT
301
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
302
+ .to be_equivalent_to xmlpp(output)
303
+ end
288
304
 
289
- it "inserts boilerplate before non-empty Normative References" do
290
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
305
+ it "inserts boilerplate before non-empty Normative References" do
306
+ input = <<~INPUT
291
307
  #{ASCIIDOC_BLANK_HDR}
292
308
 
293
309
  [bibliography]
294
310
  == Normative References
295
311
  * [[[a,b]]] A
296
312
 
297
- INPUT
298
- #{BLANK_HDR}
299
- <sections>
313
+ INPUT
314
+ output = <<~OUTPUT
315
+ #{BLANK_HDR}
316
+ <sections>
300
317
 
301
- </sections><bibliography><references id="_" obligation="informative" normative="true">
302
- <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>
303
- <bibitem id="a">
304
- <formattedref format="application/x-isodoc+xml">A</formattedref>
305
- <docidentifier>b</docidentifier>
306
- </bibitem>
307
- </references></bibliography>
308
- </standard-document>
318
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
319
+ <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>
320
+ <bibitem id="a">
321
+ <formattedref format="application/x-isodoc+xml">A</formattedref>
322
+ <docidentifier>b</docidentifier>
323
+ </bibitem>
324
+ </references></bibliography>
325
+ </standard-document>
309
326
 
310
- OUTPUT
311
- end
327
+ OUTPUT
328
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
329
+ .to be_equivalent_to xmlpp(output)
330
+ end
312
331
 
313
- it "inserts boilerplate before empty Normative References in French" do
314
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
315
- = Document title
316
- Author
317
- :docfile: test.adoc
318
- :nodoc:
319
- :novalid:
320
- :no-isobib:
321
- :language: fr
332
+ it "inserts boilerplate before empty Normative References in French" do
333
+ input = <<~INPUT
334
+ = Document title
335
+ Author
336
+ :docfile: test.adoc
337
+ :nodoc:
338
+ :novalid:
339
+ :no-isobib:
340
+ :language: fr
322
341
 
323
- [bibliography]
324
- == Normative References
342
+ [bibliography]
343
+ == Normative References
325
344
 
326
345
  INPUT
327
- #{BLANK_HDR.sub(/<language>en/, "<language>fr")}
328
- <sections>
329
-
330
- </sections><bibliography><references id="_" obligation="informative" normative="true">
331
- <title>Références normatives</title><p id="_">Le présent document ne contient aucune référence normative.</p>
332
- </references></bibliography>
333
- </standard-document>
334
- OUTPUT
335
- end
336
-
337
- it "processes section names, with footnotes" do
338
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
346
+ output = <<~OUTPUT
347
+ #{BLANK_HDR.sub(/<language>en/, '<language>fr')}
348
+ <sections>
349
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
350
+ <title>Références normatives</title><p id="_">Le présent document ne contient aucune référence normative.</p>
351
+ </references></bibliography>
352
+ </standard-document>
353
+ OUTPUT
354
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
355
+ .to be_equivalent_to xmlpp(output)
356
+ end
357
+
358
+ it "processes section names, with footnotes" do
359
+ input = <<~INPUT
339
360
  #{ASCIIDOC_BLANK_HDR}
340
361
  .Foreword.footnote:[A]
341
362
 
@@ -353,7 +374,7 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equiv
353
374
 
354
375
  [heading=acknowledgements]
355
376
  == Acknowledgements.footnote:[A]
356
-
377
+
357
378
  [.preface]
358
379
  == Dedication
359
380
 
@@ -429,205 +450,208 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equiv
429
450
 
430
451
  === Bibliography Subsection
431
452
 
432
- INPUT
433
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
434
- <bibdata type='standard'>
435
- <title language='en' format='text/plain'>Document title</title>
436
- <language>en</language>
437
- <script>Latn</script>
438
- <abstract>
439
- <p>Text</p>
440
- </abstract>
441
- <status>
442
- <stage>published</stage>
443
- </status>
444
- <copyright>
445
- <from>#{Time.now.year}</from>
446
- </copyright>
447
- <ext>
448
- <doctype>article</doctype>
449
- </ext>
450
- </bibdata>
451
- <preface>
452
- <abstract id='_'>
453
- <title>Abstract</title>
454
- <p id='_'>Text</p>
455
- </abstract>
456
- <foreword id='_' obligation='informative'>
457
- <title>
458
- Foreword
459
- <fn reference='1'>
460
- <p id='_'>A</p>
461
- </fn>
462
- </title>
463
- <p id='_'>Text</p>
464
- </foreword>
465
- <introduction id='_' obligation='informative'>
466
- <title>Introduction</title>
467
- <clause id='_' inline-header='false' obligation='informative'>
468
- <title>Introduction Subsection</title>
469
- </clause>
470
- </introduction>
471
- <clause id='_' inline-header='false' obligation='informative'>
472
- <title>Dedication</title>
473
- </clause>
474
- <acknowledgements id='_' obligation='informative'>
475
- <title>
476
- Acknowledgements
477
- <fn reference='1'>
478
- <p id='_'>A</p>
479
- </fn>
480
- </title>
481
- </acknowledgements>
482
- </preface>
483
- <sections>
484
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
485
- <title>
486
- Scope
487
- <fn reference='1'>
488
- <p id='_'>A</p>
489
- </fn>
490
- </title>
491
- <p id='_'>Text</p>
492
- </clause>
493
- <terms id='_' obligation='normative'>
494
- <title>
495
- Terms and definitions
496
- <fn reference='1'>
497
- <p id='_'>A</p>
498
- </fn>
499
- </title>
500
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
501
- <term id='term-term1'>
502
- <preferred>Term1</preferred>
503
- </term>
504
- </terms>
505
- <clause id='_' inline-header='false' obligation='normative'>
506
- <title>
507
- Terms, Definitions, Symbols and Abbreviated Terms.
508
- <fn reference='1'>
509
- <p id='_'>A</p>
510
- </fn>
511
- </title>
512
- <clause id='_' inline-header='false' obligation='normative'>
513
- <title>Introduction</title>
514
- <clause id='_' inline-header='false' obligation='normative'>
515
- <title>Intro 1</title>
516
- </clause>
517
- </clause>
518
- <clause id='_' inline-header='false' obligation='normative'>
519
- <title>Intro 2</title>
520
- <clause id='_' inline-header='false' obligation='normative'>
521
- <title>Intro 3</title>
522
- </clause>
523
- </clause>
524
- <clause id='_' inline-header='false' obligation='normative'>
525
- <title>Intro 4</title>
526
- <clause id='_' inline-header='false' obligation='normative'>
527
- <title>Intro 5</title>
453
+ INPUT
454
+ output = <<~OUTPUT
455
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
456
+ <bibdata type='standard'>
457
+ <title language='en' format='text/plain'>Document title</title>
458
+ <language>en</language>
459
+ <script>Latn</script>
460
+ <abstract>
461
+ <p>Text</p>
462
+ </abstract>
463
+ <status>
464
+ <stage>published</stage>
465
+ </status>
466
+ <copyright>
467
+ <from>#{Time.now.year}</from>
468
+ </copyright>
469
+ <ext>
470
+ <doctype>article</doctype>
471
+ </ext>
472
+ </bibdata>
473
+ <preface>
474
+ <abstract id='_'>
475
+ <title>Abstract</title>
476
+ <p id='_'>Text</p>
477
+ </abstract>
478
+ <foreword id='_' obligation='informative'>
479
+ <title>
480
+ Foreword
481
+ <fn reference='1'>
482
+ <p id='_'>A</p>
483
+ </fn>
484
+ </title>
485
+ <p id='_'>Text</p>
486
+ </foreword>
487
+ <introduction id='_' obligation='informative'>
488
+ <title>Introduction</title>
489
+ <clause id='_' inline-header='false' obligation='informative'>
490
+ <title>Introduction Subsection</title>
491
+ </clause>
492
+ </introduction>
493
+ <clause id='_' inline-header='false' obligation='informative'>
494
+ <title>Dedication</title>
495
+ </clause>
496
+ <acknowledgements id='_' obligation='informative'>
497
+ <title>
498
+ Acknowledgements
499
+ <fn reference='1'>
500
+ <p id='_'>A</p>
501
+ </fn>
502
+ </title>
503
+ </acknowledgements>
504
+ </preface>
505
+ <sections>
506
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
507
+ <title>
508
+ Scope
509
+ <fn reference='1'>
510
+ <p id='_'>A</p>
511
+ </fn>
512
+ </title>
513
+ <p id='_'>Text</p>
514
+ </clause>
515
+ <terms id='_' obligation='normative'>
516
+ <title>
517
+ Terms and definitions
518
+ <fn reference='1'>
519
+ <p id='_'>A</p>
520
+ </fn>
521
+ </title>
522
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
523
+ <term id='term-term1'>
524
+ <preferred>Term1</preferred>
525
+ </term>
526
+ </terms>
528
527
  <clause id='_' inline-header='false' obligation='normative'>
529
- <title>Term1</title>
528
+ <title>
529
+ Terms, Definitions, Symbols and Abbreviated Terms.
530
+ <fn reference='1'>
531
+ <p id='_'>A</p>
532
+ </fn>
533
+ </title>
534
+ <clause id='_' inline-header='false' obligation='normative'>
535
+ <title>Introduction</title>
536
+ <clause id='_' inline-header='false' obligation='normative'>
537
+ <title>Intro 1</title>
538
+ </clause>
539
+ </clause>
540
+ <clause id='_' inline-header='false' obligation='normative'>
541
+ <title>Intro 2</title>
542
+ <clause id='_' inline-header='false' obligation='normative'>
543
+ <title>Intro 3</title>
544
+ </clause>
545
+ </clause>
546
+ <clause id='_' inline-header='false' obligation='normative'>
547
+ <title>Intro 4</title>
548
+ <clause id='_' inline-header='false' obligation='normative'>
549
+ <title>Intro 5</title>
550
+ <clause id='_' inline-header='false' obligation='normative'>
551
+ <title>Term1</title>
552
+ </clause>
553
+ </clause>
554
+ </clause>
555
+ <clause id='_' inline-header='false' obligation='normative'>
556
+ <title>Normal Terms</title>
557
+ <clause id='_' inline-header='false' obligation='normative'>
558
+ <title>Term2</title>
559
+ </clause>
560
+ </clause>
561
+ <definitions id='_' obligation='normative'>
562
+ <title>
563
+ Symbols and abbreviated terms
564
+ <fn reference='1'>
565
+ <p id='_'>A</p>
566
+ </fn>
567
+ </title>
568
+ <clause id='_' inline-header='false' obligation='normative'>
569
+ <title>General</title>
570
+ </clause>
571
+ <definitions id='_' type='symbols' obligation='normative'>
572
+ <title>
573
+ Symbols
574
+ <fn reference='1'>
575
+ <p id='_'>A</p>
576
+ </fn>
577
+ </title>
578
+ </definitions>
579
+ </definitions>
530
580
  </clause>
531
- </clause>
532
- </clause>
533
- <clause id='_' inline-header='false' obligation='normative'>
534
- <title>Normal Terms</title>
535
- <clause id='_' inline-header='false' obligation='normative'>
536
- <title>Term2</title>
537
- </clause>
538
- </clause>
539
- <definitions id='_' obligation='normative'>
540
- <title>
541
- Symbols and abbreviated terms
542
- <fn reference='1'>
543
- <p id='_'>A</p>
544
- </fn>
545
- </title>
546
- <clause id='_' inline-header='false' obligation='normative'>
547
- <title>General</title>
548
- </clause>
549
- <definitions id='_' type='symbols' obligation='normative'>
581
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
582
+ <title>
583
+ Abbreviated terms
584
+ <fn reference='1'>
585
+ <p id='_'>A</p>
586
+ </fn>
587
+ </title>
588
+ </definitions>
589
+ <clause id='_' inline-header='false' obligation='normative'>
590
+ <title>Clause 4</title>
591
+ <clause id='_' inline-header='false' obligation='normative'>
592
+ <title>Introduction</title>
593
+ </clause>
594
+ <clause id='_' inline-header='false' obligation='normative'>
595
+ <title>Clause 4.2</title>
596
+ </clause>
597
+ </clause>
598
+ <clause id='_' inline-header='false' obligation='normative'>
599
+ <title>Terms and Definitions</title>
600
+ </clause>
601
+ </sections>
602
+ <annex id='_' inline-header='false' obligation='normative'>
550
603
  <title>
551
- Symbols
604
+ Annex.
552
605
  <fn reference='1'>
553
606
  <p id='_'>A</p>
554
607
  </fn>
555
608
  </title>
556
- </definitions>
557
- </definitions>
558
- </clause>
559
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
560
- <title>
561
- Abbreviated terms
562
- <fn reference='1'>
563
- <p id='_'>A</p>
564
- </fn>
565
- </title>
566
- </definitions>
567
- <clause id='_' inline-header='false' obligation='normative'>
568
- <title>Clause 4</title>
569
- <clause id='_' inline-header='false' obligation='normative'>
570
- <title>Introduction</title>
571
- </clause>
572
- <clause id='_' inline-header='false' obligation='normative'>
573
- <title>Clause 4.2</title>
574
- </clause>
575
- </clause>
576
- <clause id='_' inline-header='false' obligation='normative'>
577
- <title>Terms and Definitions</title>
578
- </clause>
579
- </sections>
580
- <annex id='_' inline-header='false' obligation='normative'>
581
- <title>
582
- Annex.
583
- <fn reference='1'>
584
- <p id='_'>A</p>
585
- </fn>
586
- </title>
587
- <clause id='_' inline-header='false' obligation='normative'>
588
- <title>Annex A.1</title>
589
- </clause>
590
- </annex>
591
- <bibliography>
592
- <references id='_' normative='true' obligation='informative'>
593
- <title>Normative references
594
- <fn reference='1'>
595
- <p id='_'>A</p>
596
- </fn>
597
- </title>
598
- <p id='_'>There are no normative references in this document.</p>
599
- </references>
600
- <references id='_' normative='true' obligation='informative'>
601
- <title>Normative References 2.
602
- <fn reference='1'>
603
- <p id='_'>A</p>
604
- </fn>
605
- </title>
606
- </references>
607
- <references id='_' normative='false' obligation='informative'>
608
- <title>Bibliography
609
- <fn reference='1'>
610
- <p id='_'>A</p>
611
- </fn>
612
- </title>
613
- </references>
614
- <clause id='_' obligation='informative'>
615
- <title>Bibliography 2.
616
- <fn reference='1'>
617
- <p id='_'>A</p>
618
- </fn>
619
- </title>
620
- <references id='_' normative='false' obligation='informative'>
621
- <title>Bibliography Subsection</title>
622
- </references>
623
- </clause>
624
- </bibliography>
625
- </standard-document>
626
- OUTPUT
627
- end
609
+ <clause id='_' inline-header='false' obligation='normative'>
610
+ <title>Annex A.1</title>
611
+ </clause>
612
+ </annex>
613
+ <bibliography>
614
+ <references id='_' normative='true' obligation='informative'>
615
+ <title>Normative references
616
+ <fn reference='1'>
617
+ <p id='_'>A</p>
618
+ </fn>
619
+ </title>
620
+ <p id='_'>There are no normative references in this document.</p>
621
+ </references>
622
+ <references id='_' normative='true' obligation='informative'>
623
+ <title>Normative References 2.
624
+ <fn reference='1'>
625
+ <p id='_'>A</p>
626
+ </fn>
627
+ </title>
628
+ </references>
629
+ <references id='_' normative='false' obligation='informative'>
630
+ <title>Bibliography
631
+ <fn reference='1'>
632
+ <p id='_'>A</p>
633
+ </fn>
634
+ </title>
635
+ </references>
636
+ <clause id='_' obligation='informative'>
637
+ <title>Bibliography 2.
638
+ <fn reference='1'>
639
+ <p id='_'>A</p>
640
+ </fn>
641
+ </title>
642
+ <references id='_' normative='false' obligation='informative'>
643
+ <title>Bibliography Subsection</title>
644
+ </references>
645
+ </clause>
646
+ </bibliography>
647
+ </standard-document>
648
+ OUTPUT
649
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
650
+ .to be_equivalent_to xmlpp(output)
651
+ end
628
652
 
629
- it "processes section names, default to English" do
630
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
653
+ it "processes section names, default to English" do
654
+ input = <<~INPUT
631
655
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: tlh\n:script: Latn\n:nodoc:")}
632
656
  .Foreword
633
657
 
@@ -721,144 +745,147 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equiv
721
745
 
722
746
  === Bibliography Subsection
723
747
 
724
- INPUT
725
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
726
- <bibdata type='standard'>
727
- <title language='en' format='text/plain'>Document title</title>
728
- <language>tlh</language>
729
- <script>Latn</script>
730
- <abstract>
731
- <p>Text</p>
732
- </abstract>
733
- <status>
734
- <stage>published</stage>
735
- </status>
736
- <copyright>
737
- <from>#{Time.now.year}</from>
738
- </copyright>
739
- <ext>
740
- <doctype>article</doctype>
741
- </ext>
742
- </bibdata>
743
- <preface>
744
- <abstract id='_'>
745
- <title>Abstract</title>
746
- <p id='_'>Text</p>
747
- </abstract>
748
- <foreword id='_' obligation='informative'>
749
- <title>Foreword</title>
750
- <p id='_'>Text</p>
751
- </foreword>
752
- <introduction id='_' obligation='informative'>
753
- <title>Introduction</title>
754
- <clause id='_' inline-header='false' obligation='informative'>
755
- <title>Introduction Subsection</title>
756
- </clause>
757
- </introduction>
758
- <clause id='_' inline-header='false' obligation='informative'>
759
- <title>Dedication</title>
760
- </clause>
761
- <acknowledgements id='_' obligation='informative'>
762
- <title>Acknowledgements</title>
763
- </acknowledgements>
764
- </preface>
765
- <sections>
766
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
767
- <title>Scope</title>
768
- <p id='_'>Text</p>
769
- </clause>
770
- <terms id='_' obligation='normative'>
771
- <title>Terms and definitions</title>
772
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
773
- <term id='term-term1'>
774
- <preferred>Term1</preferred>
775
- </term>
776
- </terms>
777
- <clause id='_' inline-header='false' obligation='normative'>
778
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
779
- <clause id='_' inline-header='false' obligation='normative'>
780
- <title>Introduction</title>
781
- <clause id='_' inline-header='false' obligation='normative'>
782
- <title>Intro 1</title>
783
- </clause>
784
- </clause>
785
- <clause id='_' inline-header='false' obligation='normative'>
786
- <title>Intro 2</title>
787
- <clause id='_' inline-header='false' obligation='normative'>
788
- <title>Intro 3</title>
789
- </clause>
790
- </clause>
791
- <clause id='_' inline-header='false' obligation='normative'>
792
- <title>Intro 4</title>
793
- <clause id='_' inline-header='false' obligation='normative'>
794
- <title>Intro 5</title>
748
+ INPUT
749
+ output = <<~OUTPUT
750
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
751
+ <bibdata type='standard'>
752
+ <title language='en' format='text/plain'>Document title</title>
753
+ <language>tlh</language>
754
+ <script>Latn</script>
755
+ <abstract>
756
+ <p>Text</p>
757
+ </abstract>
758
+ <status>
759
+ <stage>published</stage>
760
+ </status>
761
+ <copyright>
762
+ <from>#{Time.now.year}</from>
763
+ </copyright>
764
+ <ext>
765
+ <doctype>article</doctype>
766
+ </ext>
767
+ </bibdata>
768
+ <preface>
769
+ <abstract id='_'>
770
+ <title>Abstract</title>
771
+ <p id='_'>Text</p>
772
+ </abstract>
773
+ <foreword id='_' obligation='informative'>
774
+ <title>Foreword</title>
775
+ <p id='_'>Text</p>
776
+ </foreword>
777
+ <introduction id='_' obligation='informative'>
778
+ <title>Introduction</title>
779
+ <clause id='_' inline-header='false' obligation='informative'>
780
+ <title>Introduction Subsection</title>
781
+ </clause>
782
+ </introduction>
783
+ <clause id='_' inline-header='false' obligation='informative'>
784
+ <title>Dedication</title>
785
+ </clause>
786
+ <acknowledgements id='_' obligation='informative'>
787
+ <title>Acknowledgements</title>
788
+ </acknowledgements>
789
+ </preface>
790
+ <sections>
791
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
792
+ <title>Scope</title>
793
+ <p id='_'>Text</p>
794
+ </clause>
795
+ <terms id='_' obligation='normative'>
796
+ <title>Terms and definitions</title>
797
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
798
+ <term id='term-term1'>
799
+ <preferred>Term1</preferred>
800
+ </term>
801
+ </terms>
795
802
  <clause id='_' inline-header='false' obligation='normative'>
796
- <title>Term1</title>
803
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
804
+ <clause id='_' inline-header='false' obligation='normative'>
805
+ <title>Introduction</title>
806
+ <clause id='_' inline-header='false' obligation='normative'>
807
+ <title>Intro 1</title>
808
+ </clause>
809
+ </clause>
810
+ <clause id='_' inline-header='false' obligation='normative'>
811
+ <title>Intro 2</title>
812
+ <clause id='_' inline-header='false' obligation='normative'>
813
+ <title>Intro 3</title>
814
+ </clause>
815
+ </clause>
816
+ <clause id='_' inline-header='false' obligation='normative'>
817
+ <title>Intro 4</title>
818
+ <clause id='_' inline-header='false' obligation='normative'>
819
+ <title>Intro 5</title>
820
+ <clause id='_' inline-header='false' obligation='normative'>
821
+ <title>Term1</title>
822
+ </clause>
823
+ </clause>
824
+ </clause>
825
+ <clause id='_' inline-header='false' obligation='normative'>
826
+ <title>Normal Terms</title>
827
+ <clause id='_' inline-header='false' obligation='normative'>
828
+ <title>Term2</title>
829
+ </clause>
830
+ </clause>
831
+ <definitions id='_' obligation='normative'>
832
+ <title>Symbols and abbreviated terms</title>
833
+ <clause id='_' inline-header='false' obligation='normative'>
834
+ <title>General</title>
835
+ </clause>
836
+ <definitions id='_' type='symbols' obligation='normative'>
837
+ <title>Symbols</title>
838
+ </definitions>
839
+ </definitions>
797
840
  </clause>
798
- </clause>
799
- </clause>
800
- <clause id='_' inline-header='false' obligation='normative'>
801
- <title>Normal Terms</title>
802
- <clause id='_' inline-header='false' obligation='normative'>
803
- <title>Term2</title>
804
- </clause>
805
- </clause>
806
- <definitions id='_' obligation='normative'>
807
- <title>Symbols and abbreviated terms</title>
808
- <clause id='_' inline-header='false' obligation='normative'>
809
- <title>General</title>
810
- </clause>
811
- <definitions id='_' type='symbols' obligation='normative'>
812
- <title>Symbols</title>
813
- </definitions>
814
- </definitions>
815
- </clause>
816
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
817
- <title>Abbreviated terms</title>
818
- </definitions>
819
- <clause id='_' inline-header='false' obligation='normative'>
820
- <title>Clause 4</title>
821
- <clause id='_' inline-header='false' obligation='normative'>
822
- <title>Introduction</title>
823
- </clause>
824
- <clause id='_' inline-header='false' obligation='normative'>
825
- <title>Clause 4.2</title>
826
- </clause>
827
- </clause>
828
- <clause id='_' inline-header='false' obligation='normative'>
829
- <title>Terms and Definitions</title>
830
- </clause>
831
- </sections>
832
- <annex id='_' inline-header='false' obligation='normative'>
833
- <title>Annex</title>
834
- <clause id='_' inline-header='false' obligation='normative'>
835
- <title>Annex A.1</title>
836
- </clause>
837
- </annex>
838
- <bibliography>
839
- <references id='_' normative='true' obligation='informative'>
840
- <title>Normative references</title>
841
- <p id='_'>There are no normative references in this document.</p>
842
- </references>
843
- <references id='_' normative='true' obligation='informative'>
844
- <title>Normative References 2</title>
845
- </references>
846
- <references id='_' normative='false' obligation='informative'>
847
- <title>Bibliography</title>
848
- </references>
849
- <clause id='_' obligation='informative'>
850
- <title>Bibliography 2</title>
851
- <references id='_' normative='false' obligation='informative'>
852
- <title>Bibliography Subsection</title>
853
- </references>
854
- </clause>
855
- </bibliography>
856
- </standard-document>
857
- OUTPUT
858
- end
841
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
842
+ <title>Abbreviated terms</title>
843
+ </definitions>
844
+ <clause id='_' inline-header='false' obligation='normative'>
845
+ <title>Clause 4</title>
846
+ <clause id='_' inline-header='false' obligation='normative'>
847
+ <title>Introduction</title>
848
+ </clause>
849
+ <clause id='_' inline-header='false' obligation='normative'>
850
+ <title>Clause 4.2</title>
851
+ </clause>
852
+ </clause>
853
+ <clause id='_' inline-header='false' obligation='normative'>
854
+ <title>Terms and Definitions</title>
855
+ </clause>
856
+ </sections>
857
+ <annex id='_' inline-header='false' obligation='normative'>
858
+ <title>Annex</title>
859
+ <clause id='_' inline-header='false' obligation='normative'>
860
+ <title>Annex A.1</title>
861
+ </clause>
862
+ </annex>
863
+ <bibliography>
864
+ <references id='_' normative='true' obligation='informative'>
865
+ <title>Normative references</title>
866
+ <p id='_'>There are no normative references in this document.</p>
867
+ </references>
868
+ <references id='_' normative='true' obligation='informative'>
869
+ <title>Normative References 2</title>
870
+ </references>
871
+ <references id='_' normative='false' obligation='informative'>
872
+ <title>Bibliography</title>
873
+ </references>
874
+ <clause id='_' obligation='informative'>
875
+ <title>Bibliography 2</title>
876
+ <references id='_' normative='false' obligation='informative'>
877
+ <title>Bibliography Subsection</title>
878
+ </references>
879
+ </clause>
880
+ </bibliography>
881
+ </standard-document>
882
+ OUTPUT
883
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
884
+ .to be_equivalent_to xmlpp(output)
885
+ end
859
886
 
860
- it "processes section names, French" do
861
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
887
+ it "processes section names, French" do
888
+ input = <<~INPUT
862
889
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: fr\n:script: Latn\n:nodoc:")}
863
890
  .Foreword
864
891
 
@@ -952,147 +979,150 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equiv
952
979
 
953
980
  === Bibliography Subsection
954
981
 
955
- INPUT
956
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
957
- <bibdata type='standard'>
958
- <title language='en' format='text/plain'>Document title</title>
959
- <language>fr</language>
960
- <script>Latn</script>
961
- <abstract>
962
- <p>Text</p>
963
- </abstract>
964
- <status>
965
- <stage>published</stage>
966
- </status>
967
- <copyright>
968
- <from>#{Time.now.year}</from>
969
- </copyright>
970
- <ext>
971
- <doctype>article</doctype>
972
- </ext>
973
- </bibdata>
974
- <preface>
975
- <abstract id='_'>
976
- <title>Résumé</title>
977
- <p id='_'>Text</p>
978
- </abstract>
979
- <foreword id='_' obligation='informative'>
980
- <title>Avant-propos</title>
981
- <p id='_'>Text</p>
982
- </foreword>
983
- <introduction id='_' obligation='informative'>
984
- <title>Introduction</title>
985
- <clause id='_' inline-header='false' obligation='informative'>
986
- <title>Introduction Subsection</title>
987
- </clause>
988
- </introduction>
989
- <clause id='_' inline-header='false' obligation='informative'>
990
- <title>Dedication</title>
991
- </clause>
992
- <acknowledgements id='_' obligation='informative'>
993
- <title>Remerciements</title>
994
- </acknowledgements>
995
- </preface>
996
- <sections>
997
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
998
- <title>Domaine d’application</title>
999
- <p id='_'>Text</p>
1000
- </clause>
1001
- <terms id='_' obligation='normative'>
1002
- <title>Terms et définitions</title>
1003
- <p id='_'>
1004
- Pour les besoins du présent document, les termes et définitions suivants
1005
- s’appliquent.
1006
- </p>
1007
- <term id='term-term1'>
1008
- <preferred>Term1</preferred>
1009
- </term>
1010
- </terms>
1011
- <clause id='_' inline-header='false' obligation='normative'>
1012
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1013
- <clause id='_' inline-header='false' obligation='normative'>
1014
- <title>Introduction</title>
1015
- <clause id='_' inline-header='false' obligation='normative'>
1016
- <title>Intro 1</title>
1017
- </clause>
1018
- </clause>
1019
- <clause id='_' inline-header='false' obligation='normative'>
1020
- <title>Intro 2</title>
1021
- <clause id='_' inline-header='false' obligation='normative'>
1022
- <title>Intro 3</title>
1023
- </clause>
1024
- </clause>
1025
- <clause id='_' inline-header='false' obligation='normative'>
1026
- <title>Intro 4</title>
1027
- <clause id='_' inline-header='false' obligation='normative'>
1028
- <title>Intro 5</title>
982
+ INPUT
983
+ output = <<~OUTPUT
984
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
985
+ <bibdata type='standard'>
986
+ <title language='en' format='text/plain'>Document title</title>
987
+ <language>fr</language>
988
+ <script>Latn</script>
989
+ <abstract>
990
+ <p>Text</p>
991
+ </abstract>
992
+ <status>
993
+ <stage>published</stage>
994
+ </status>
995
+ <copyright>
996
+ <from>#{Time.now.year}</from>
997
+ </copyright>
998
+ <ext>
999
+ <doctype>article</doctype>
1000
+ </ext>
1001
+ </bibdata>
1002
+ <preface>
1003
+ <abstract id='_'>
1004
+ <title>Résumé</title>
1005
+ <p id='_'>Text</p>
1006
+ </abstract>
1007
+ <foreword id='_' obligation='informative'>
1008
+ <title>Avant-propos</title>
1009
+ <p id='_'>Text</p>
1010
+ </foreword>
1011
+ <introduction id='_' obligation='informative'>
1012
+ <title>Introduction</title>
1013
+ <clause id='_' inline-header='false' obligation='informative'>
1014
+ <title>Introduction Subsection</title>
1015
+ </clause>
1016
+ </introduction>
1017
+ <clause id='_' inline-header='false' obligation='informative'>
1018
+ <title>Dedication</title>
1019
+ </clause>
1020
+ <acknowledgements id='_' obligation='informative'>
1021
+ <title>Remerciements</title>
1022
+ </acknowledgements>
1023
+ </preface>
1024
+ <sections>
1025
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
1026
+ <title>Domaine d’application</title>
1027
+ <p id='_'>Text</p>
1028
+ </clause>
1029
+ <terms id='_' obligation='normative'>
1030
+ <title>Terms et définitions</title>
1031
+ <p id='_'>
1032
+ Pour les besoins du présent document, les termes et définitions suivants
1033
+ s’appliquent.
1034
+ </p>
1035
+ <term id='term-term1'>
1036
+ <preferred>Term1</preferred>
1037
+ </term>
1038
+ </terms>
1029
1039
  <clause id='_' inline-header='false' obligation='normative'>
1030
- <title>Term1</title>
1040
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1041
+ <clause id='_' inline-header='false' obligation='normative'>
1042
+ <title>Introduction</title>
1043
+ <clause id='_' inline-header='false' obligation='normative'>
1044
+ <title>Intro 1</title>
1045
+ </clause>
1046
+ </clause>
1047
+ <clause id='_' inline-header='false' obligation='normative'>
1048
+ <title>Intro 2</title>
1049
+ <clause id='_' inline-header='false' obligation='normative'>
1050
+ <title>Intro 3</title>
1051
+ </clause>
1052
+ </clause>
1053
+ <clause id='_' inline-header='false' obligation='normative'>
1054
+ <title>Intro 4</title>
1055
+ <clause id='_' inline-header='false' obligation='normative'>
1056
+ <title>Intro 5</title>
1057
+ <clause id='_' inline-header='false' obligation='normative'>
1058
+ <title>Term1</title>
1059
+ </clause>
1060
+ </clause>
1061
+ </clause>
1062
+ <clause id='_' inline-header='false' obligation='normative'>
1063
+ <title>Normal Terms</title>
1064
+ <clause id='_' inline-header='false' obligation='normative'>
1065
+ <title>Term2</title>
1066
+ </clause>
1067
+ </clause>
1068
+ <definitions id='_' obligation='normative'>
1069
+ <title>Symboles et termes abrégés</title>
1070
+ <clause id='_' inline-header='false' obligation='normative'>
1071
+ <title>General</title>
1072
+ </clause>
1073
+ <definitions id='_' type='symbols' obligation='normative'>
1074
+ <title>Symboles</title>
1075
+ </definitions>
1076
+ </definitions>
1031
1077
  </clause>
1032
- </clause>
1033
- </clause>
1034
- <clause id='_' inline-header='false' obligation='normative'>
1035
- <title>Normal Terms</title>
1036
- <clause id='_' inline-header='false' obligation='normative'>
1037
- <title>Term2</title>
1038
- </clause>
1039
- </clause>
1040
- <definitions id='_' obligation='normative'>
1041
- <title>Symboles et termes abrégés</title>
1042
- <clause id='_' inline-header='false' obligation='normative'>
1043
- <title>General</title>
1044
- </clause>
1045
- <definitions id='_' type='symbols' obligation='normative'>
1046
- <title>Symboles</title>
1047
- </definitions>
1048
- </definitions>
1049
- </clause>
1050
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
1051
- <title>Termes abrégés</title>
1052
- </definitions>
1053
- <clause id='_' inline-header='false' obligation='normative'>
1054
- <title>Clause 4</title>
1055
- <clause id='_' inline-header='false' obligation='normative'>
1056
- <title>Introduction</title>
1057
- </clause>
1058
- <clause id='_' inline-header='false' obligation='normative'>
1059
- <title>Clause 4.2</title>
1060
- </clause>
1061
- </clause>
1062
- <clause id='_' inline-header='false' obligation='normative'>
1063
- <title>Terms and Definitions</title>
1064
- </clause>
1065
- </sections>
1066
- <annex id='_' inline-header='false' obligation='normative'>
1067
- <title>Annex</title>
1068
- <clause id='_' inline-header='false' obligation='normative'>
1069
- <title>Annex A.1</title>
1070
- </clause>
1071
- </annex>
1072
- <bibliography>
1073
- <references id='_' normative='true' obligation='informative'>
1074
- <title>Références normatives</title>
1075
- <p id='_'>Le présent document ne contient aucune référence normative.</p>
1076
- </references>
1077
- <references id='_' normative='true' obligation='informative'>
1078
- <title>Normative References 2</title>
1079
- </references>
1080
- <references id='_' normative='false' obligation='informative'>
1081
- <title>Bibliographie</title>
1082
- </references>
1083
- <clause id='_' obligation='informative'>
1084
- <title>Bibliography 2</title>
1085
- <references id='_' normative='false' obligation='informative'>
1086
- <title>Bibliography Subsection</title>
1087
- </references>
1088
- </clause>
1089
- </bibliography>
1090
- </standard-document>
1091
- OUTPUT
1092
- end
1078
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
1079
+ <title>Termes abrégés</title>
1080
+ </definitions>
1081
+ <clause id='_' inline-header='false' obligation='normative'>
1082
+ <title>Clause 4</title>
1083
+ <clause id='_' inline-header='false' obligation='normative'>
1084
+ <title>Introduction</title>
1085
+ </clause>
1086
+ <clause id='_' inline-header='false' obligation='normative'>
1087
+ <title>Clause 4.2</title>
1088
+ </clause>
1089
+ </clause>
1090
+ <clause id='_' inline-header='false' obligation='normative'>
1091
+ <title>Terms and Definitions</title>
1092
+ </clause>
1093
+ </sections>
1094
+ <annex id='_' inline-header='false' obligation='normative'>
1095
+ <title>Annex</title>
1096
+ <clause id='_' inline-header='false' obligation='normative'>
1097
+ <title>Annex A.1</title>
1098
+ </clause>
1099
+ </annex>
1100
+ <bibliography>
1101
+ <references id='_' normative='true' obligation='informative'>
1102
+ <title>Références normatives</title>
1103
+ <p id='_'>Le présent document ne contient aucune référence normative.</p>
1104
+ </references>
1105
+ <references id='_' normative='true' obligation='informative'>
1106
+ <title>Normative References 2</title>
1107
+ </references>
1108
+ <references id='_' normative='false' obligation='informative'>
1109
+ <title>Bibliographie</title>
1110
+ </references>
1111
+ <clause id='_' obligation='informative'>
1112
+ <title>Bibliography 2</title>
1113
+ <references id='_' normative='false' obligation='informative'>
1114
+ <title>Bibliography Subsection</title>
1115
+ </references>
1116
+ </clause>
1117
+ </bibliography>
1118
+ </standard-document>
1119
+ OUTPUT
1120
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1121
+ .to be_equivalent_to xmlpp(output)
1122
+ end
1093
1123
 
1094
- it "processes section names, Simplified Chinese" do
1095
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1124
+ it "processes section names, Simplified Chinese" do
1125
+ input = <<~INPUT
1096
1126
  #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":language: zh\n:script: Hans\n:nodoc:")}
1097
1127
  .Foreword
1098
1128
 
@@ -1186,145 +1216,148 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equiv
1186
1216
 
1187
1217
  === Bibliography Subsection
1188
1218
 
1189
- INPUT
1190
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1191
- <bibdata type='standard'>
1192
- <title language='en' format='text/plain'>Document title</title>
1193
- <language>zh</language>
1194
- <script>Hans</script>
1195
- <abstract>
1196
- <p>Text</p>
1197
- </abstract>
1198
- <status>
1199
- <stage>published</stage>
1200
- </status>
1201
- <copyright>
1202
- <from>#{Time.now.year}</from>
1203
- </copyright>
1204
- <ext>
1205
- <doctype>article</doctype>
1206
- </ext>
1207
- </bibdata>
1208
- <preface>
1209
- <abstract id='_'>
1210
- <title>摘要</title>
1211
- <p id='_'>Text</p>
1212
- </abstract>
1213
- <foreword id='_' obligation='informative'>
1214
- <title>前言</title>
1215
- <p id='_'>Text</p>
1216
- </foreword>
1217
- <introduction id='_' obligation='informative'>
1218
- <title>引言</title>
1219
- <clause id='_' inline-header='false' obligation='informative'>
1220
- <title>Introduction Subsection</title>
1221
- </clause>
1222
- </introduction>
1223
- <clause id='_' inline-header='false' obligation='informative'>
1224
- <title>Dedication</title>
1225
- </clause>
1226
- <acknowledgements id='_' obligation='informative'>
1227
- <title>致謝</title>
1228
- </acknowledgements>
1229
- </preface>
1230
- <sections>
1231
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
1232
- <title>范围</title>
1233
- <p id='_'>Text</p>
1234
- </clause>
1235
- <terms id='_' obligation='normative'>
1236
- <title>术语和定义</title>
1237
- <p id='_'>下列术语和定义适用于本文件。</p>
1238
- <term id='term-term1'>
1239
- <preferred>Term1</preferred>
1240
- </term>
1241
- </terms>
1242
- <clause id='_' inline-header='false' obligation='normative'>
1243
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1244
- <clause id='_' inline-header='false' obligation='normative'>
1245
- <title>Introduction</title>
1246
- <clause id='_' inline-header='false' obligation='normative'>
1247
- <title>Intro 1</title>
1248
- </clause>
1249
- </clause>
1250
- <clause id='_' inline-header='false' obligation='normative'>
1251
- <title>Intro 2</title>
1252
- <clause id='_' inline-header='false' obligation='normative'>
1253
- <title>Intro 3</title>
1254
- </clause>
1255
- </clause>
1256
- <clause id='_' inline-header='false' obligation='normative'>
1257
- <title>Intro 4</title>
1258
- <clause id='_' inline-header='false' obligation='normative'>
1259
- <title>Intro 5</title>
1219
+ INPUT
1220
+ output = <<~OUTPUT
1221
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1222
+ <bibdata type='standard'>
1223
+ <title language='en' format='text/plain'>Document title</title>
1224
+ <language>zh</language>
1225
+ <script>Hans</script>
1226
+ <abstract>
1227
+ <p>Text</p>
1228
+ </abstract>
1229
+ <status>
1230
+ <stage>published</stage>
1231
+ </status>
1232
+ <copyright>
1233
+ <from>#{Time.now.year}</from>
1234
+ </copyright>
1235
+ <ext>
1236
+ <doctype>article</doctype>
1237
+ </ext>
1238
+ </bibdata>
1239
+ <preface>
1240
+ <abstract id='_'>
1241
+ <title>摘要</title>
1242
+ <p id='_'>Text</p>
1243
+ </abstract>
1244
+ <foreword id='_' obligation='informative'>
1245
+ <title>前言</title>
1246
+ <p id='_'>Text</p>
1247
+ </foreword>
1248
+ <introduction id='_' obligation='informative'>
1249
+ <title>引言</title>
1250
+ <clause id='_' inline-header='false' obligation='informative'>
1251
+ <title>Introduction Subsection</title>
1252
+ </clause>
1253
+ </introduction>
1254
+ <clause id='_' inline-header='false' obligation='informative'>
1255
+ <title>Dedication</title>
1256
+ </clause>
1257
+ <acknowledgements id='_' obligation='informative'>
1258
+ <title>致謝</title>
1259
+ </acknowledgements>
1260
+ </preface>
1261
+ <sections>
1262
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
1263
+ <title>范围</title>
1264
+ <p id='_'>Text</p>
1265
+ </clause>
1266
+ <terms id='_' obligation='normative'>
1267
+ <title>术语和定义</title>
1268
+ <p id='_'>下列术语和定义适用于本文件。</p>
1269
+ <term id='term-term1'>
1270
+ <preferred>Term1</preferred>
1271
+ </term>
1272
+ </terms>
1260
1273
  <clause id='_' inline-header='false' obligation='normative'>
1261
- <title>Term1</title>
1274
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1275
+ <clause id='_' inline-header='false' obligation='normative'>
1276
+ <title>Introduction</title>
1277
+ <clause id='_' inline-header='false' obligation='normative'>
1278
+ <title>Intro 1</title>
1279
+ </clause>
1280
+ </clause>
1281
+ <clause id='_' inline-header='false' obligation='normative'>
1282
+ <title>Intro 2</title>
1283
+ <clause id='_' inline-header='false' obligation='normative'>
1284
+ <title>Intro 3</title>
1285
+ </clause>
1286
+ </clause>
1287
+ <clause id='_' inline-header='false' obligation='normative'>
1288
+ <title>Intro 4</title>
1289
+ <clause id='_' inline-header='false' obligation='normative'>
1290
+ <title>Intro 5</title>
1291
+ <clause id='_' inline-header='false' obligation='normative'>
1292
+ <title>Term1</title>
1293
+ </clause>
1294
+ </clause>
1295
+ </clause>
1296
+ <clause id='_' inline-header='false' obligation='normative'>
1297
+ <title>Normal Terms</title>
1298
+ <clause id='_' inline-header='false' obligation='normative'>
1299
+ <title>Term2</title>
1300
+ </clause>
1301
+ </clause>
1302
+ <definitions id='_' obligation='normative'>
1303
+ <title>符号、代号和缩略语</title>
1304
+ <clause id='_' inline-header='false' obligation='normative'>
1305
+ <title>General</title>
1306
+ </clause>
1307
+ <definitions id='_' type='symbols' obligation='normative'>
1308
+ <title>符号</title>
1309
+ </definitions>
1310
+ </definitions>
1262
1311
  </clause>
1263
- </clause>
1264
- </clause>
1265
- <clause id='_' inline-header='false' obligation='normative'>
1266
- <title>Normal Terms</title>
1267
- <clause id='_' inline-header='false' obligation='normative'>
1268
- <title>Term2</title>
1269
- </clause>
1270
- </clause>
1271
- <definitions id='_' obligation='normative'>
1272
- <title>符号、代号和缩略语</title>
1273
- <clause id='_' inline-header='false' obligation='normative'>
1274
- <title>General</title>
1275
- </clause>
1276
- <definitions id='_' type='symbols' obligation='normative'>
1277
- <title>符号</title>
1278
- </definitions>
1279
- </definitions>
1280
- </clause>
1281
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
1282
- <title>代号和缩略语</title>
1283
- </definitions>
1284
- <clause id='_' inline-header='false' obligation='normative'>
1285
- <title>Clause 4</title>
1286
- <clause id='_' inline-header='false' obligation='normative'>
1287
- <title>Introduction</title>
1288
- </clause>
1289
- <clause id='_' inline-header='false' obligation='normative'>
1290
- <title>Clause 4.2</title>
1291
- </clause>
1292
- </clause>
1293
- <clause id='_' inline-header='false' obligation='normative'>
1294
- <title>Terms and Definitions</title>
1295
- </clause>
1296
- </sections>
1297
- <annex id='_' inline-header='false' obligation='normative'>
1298
- <title>Annex</title>
1299
- <clause id='_' inline-header='false' obligation='normative'>
1300
- <title>Annex A.1</title>
1301
- </clause>
1302
- </annex>
1303
- <bibliography>
1304
- <references id='_' normative='true' obligation='informative'>
1305
- <title>规范性引用文件</title>
1306
- <p id='_'>本文件并没有规范性引用文件。</p>
1307
- </references>
1308
- <references id='_' normative='true' obligation='informative'>
1309
- <title>Normative References 2</title>
1310
- </references>
1311
- <references id='_' normative='false' obligation='informative'>
1312
- <title>参考文献</title>
1313
- </references>
1314
- <clause id='_' obligation='informative'>
1315
- <title>Bibliography 2</title>
1316
- <references id='_' normative='false' obligation='informative'>
1317
- <title>Bibliography Subsection</title>
1318
- </references>
1319
- </clause>
1320
- </bibliography>
1321
- </standard-document>
1322
- OUTPUT
1323
- end
1312
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
1313
+ <title>代号和缩略语</title>
1314
+ </definitions>
1315
+ <clause id='_' inline-header='false' obligation='normative'>
1316
+ <title>Clause 4</title>
1317
+ <clause id='_' inline-header='false' obligation='normative'>
1318
+ <title>Introduction</title>
1319
+ </clause>
1320
+ <clause id='_' inline-header='false' obligation='normative'>
1321
+ <title>Clause 4.2</title>
1322
+ </clause>
1323
+ </clause>
1324
+ <clause id='_' inline-header='false' obligation='normative'>
1325
+ <title>Terms and Definitions</title>
1326
+ </clause>
1327
+ </sections>
1328
+ <annex id='_' inline-header='false' obligation='normative'>
1329
+ <title>Annex</title>
1330
+ <clause id='_' inline-header='false' obligation='normative'>
1331
+ <title>Annex A.1</title>
1332
+ </clause>
1333
+ </annex>
1334
+ <bibliography>
1335
+ <references id='_' normative='true' obligation='informative'>
1336
+ <title>规范性引用文件</title>
1337
+ <p id='_'>本文件并没有规范性引用文件。</p>
1338
+ </references>
1339
+ <references id='_' normative='true' obligation='informative'>
1340
+ <title>Normative References 2</title>
1341
+ </references>
1342
+ <references id='_' normative='false' obligation='informative'>
1343
+ <title>参考文献</title>
1344
+ </references>
1345
+ <clause id='_' obligation='informative'>
1346
+ <title>Bibliography 2</title>
1347
+ <references id='_' normative='false' obligation='informative'>
1348
+ <title>Bibliography Subsection</title>
1349
+ </references>
1350
+ </clause>
1351
+ </bibliography>
1352
+ </standard-document>
1353
+ OUTPUT
1354
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1355
+ .to be_equivalent_to xmlpp(output)
1356
+ end
1324
1357
 
1325
- it "processes section names, internationalisation file" do
1326
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1327
- #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ":i18nyaml: spec/assets/i18n.yaml")}
1358
+ it "processes section names, internationalisation file" do
1359
+ input = <<~INPUT
1360
+ #{ASCIIDOC_BLANK_HDR.sub(/:nodoc:/, ':i18nyaml: spec/assets/i18n.yaml')}
1328
1361
  .Foreword
1329
1362
 
1330
1363
  Text
@@ -1417,140 +1450,142 @@ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equiv
1417
1450
 
1418
1451
  === Bibliography Subsection
1419
1452
 
1420
- INPUT
1421
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1422
- <bibdata type='standard'>
1423
- <title language='en' format='text/plain'>Document title</title>
1424
- <language>en</language>
1425
- <script>Latn</script>
1426
- <abstract>
1427
- <p>Text</p>
1428
- </abstract>
1429
- <status>
1430
- <stage>published</stage>
1431
- </status>
1432
- <copyright>
1433
- <from>#{Time.now.year}</from>
1434
- </copyright>
1435
- <ext>
1436
- <doctype>article</doctype>
1437
- </ext>
1438
- </bibdata>
1439
- <preface>
1440
- <abstract id='_'>
1441
- <title>Abstract</title>
1442
- <p id='_'>Text</p>
1443
- </abstract>
1444
- <foreword id='_' obligation='informative'>
1445
- <title>Antaŭparolo</title>
1446
- <p id='_'>Text</p>
1447
- </foreword>
1448
- <introduction id='_' obligation='informative'>
1449
- <title>Enkonduko</title>
1450
- <clause id='_' inline-header='false' obligation='informative'>
1451
- <title>Introduction Subsection</title>
1452
- </clause>
1453
- </introduction>
1454
- <clause id='_' inline-header='false' obligation='informative'>
1455
- <title>Dedication</title>
1456
- </clause>
1457
- <acknowledgements id='_' obligation='informative'>
1458
- <title>Acknowledgements</title>
1459
- </acknowledgements>
1460
- </preface>
1461
- <sections>
1462
- <clause id='_' type='scope' inline-header='false' obligation='normative'>
1463
- <title>Amplekso</title>
1464
- <p id='_'>Text</p>
1465
- </clause>
1466
- <terms id='_' obligation='normative'>
1467
- <title>Terms and definitions</title>
1468
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1469
- <term id='term-term1'>
1470
- <preferred>Term1</preferred>
1471
- </term>
1472
- </terms>
1473
- <clause id='_' inline-header='false' obligation='normative'>
1474
- <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1475
- <clause id='_' inline-header='false' obligation='normative'>
1476
- <title>Introduction</title>
1477
- <clause id='_' inline-header='false' obligation='normative'>
1478
- <title>Intro 1</title>
1479
- </clause>
1480
- </clause>
1481
- <clause id='_' inline-header='false' obligation='normative'>
1482
- <title>Intro 2</title>
1483
- <clause id='_' inline-header='false' obligation='normative'>
1484
- <title>Intro 3</title>
1485
- </clause>
1486
- </clause>
1487
- <clause id='_' inline-header='false' obligation='normative'>
1488
- <title>Intro 4</title>
1489
- <clause id='_' inline-header='false' obligation='normative'>
1490
- <title>Intro 5</title>
1453
+ INPUT
1454
+ output = <<~OUTPUT
1455
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type="semantic" version="#{Metanorma::Standoc::VERSION}">
1456
+ <bibdata type='standard'>
1457
+ <title language='en' format='text/plain'>Document title</title>
1458
+ <language>en</language>
1459
+ <script>Latn</script>
1460
+ <abstract>
1461
+ <p>Text</p>
1462
+ </abstract>
1463
+ <status>
1464
+ <stage>published</stage>
1465
+ </status>
1466
+ <copyright>
1467
+ <from>#{Time.now.year}</from>
1468
+ </copyright>
1469
+ <ext>
1470
+ <doctype>article</doctype>
1471
+ </ext>
1472
+ </bibdata>
1473
+ <preface>
1474
+ <abstract id='_'>
1475
+ <title>Abstract</title>
1476
+ <p id='_'>Text</p>
1477
+ </abstract>
1478
+ <foreword id='_' obligation='informative'>
1479
+ <title>Antaŭparolo</title>
1480
+ <p id='_'>Text</p>
1481
+ </foreword>
1482
+ <introduction id='_' obligation='informative'>
1483
+ <title>Enkonduko</title>
1484
+ <clause id='_' inline-header='false' obligation='informative'>
1485
+ <title>Introduction Subsection</title>
1486
+ </clause>
1487
+ </introduction>
1488
+ <clause id='_' inline-header='false' obligation='informative'>
1489
+ <title>Dedication</title>
1490
+ </clause>
1491
+ <acknowledgements id='_' obligation='informative'>
1492
+ <title>Acknowledgements</title>
1493
+ </acknowledgements>
1494
+ </preface>
1495
+ <sections>
1496
+ <clause id='_' type='scope' inline-header='false' obligation='normative'>
1497
+ <title>Amplekso</title>
1498
+ <p id='_'>Text</p>
1499
+ </clause>
1500
+ <terms id='_' obligation='normative'>
1501
+ <title>Terms and definitions</title>
1502
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1503
+ <term id='term-term1'>
1504
+ <preferred>Term1</preferred>
1505
+ </term>
1506
+ </terms>
1491
1507
  <clause id='_' inline-header='false' obligation='normative'>
1492
- <title>Term1</title>
1508
+ <title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1509
+ <clause id='_' inline-header='false' obligation='normative'>
1510
+ <title>Introduction</title>
1511
+ <clause id='_' inline-header='false' obligation='normative'>
1512
+ <title>Intro 1</title>
1513
+ </clause>
1514
+ </clause>
1515
+ <clause id='_' inline-header='false' obligation='normative'>
1516
+ <title>Intro 2</title>
1517
+ <clause id='_' inline-header='false' obligation='normative'>
1518
+ <title>Intro 3</title>
1519
+ </clause>
1520
+ </clause>
1521
+ <clause id='_' inline-header='false' obligation='normative'>
1522
+ <title>Intro 4</title>
1523
+ <clause id='_' inline-header='false' obligation='normative'>
1524
+ <title>Intro 5</title>
1525
+ <clause id='_' inline-header='false' obligation='normative'>
1526
+ <title>Term1</title>
1527
+ </clause>
1528
+ </clause>
1529
+ </clause>
1530
+ <clause id='_' inline-header='false' obligation='normative'>
1531
+ <title>Normal Terms</title>
1532
+ <clause id='_' inline-header='false' obligation='normative'>
1533
+ <title>Term2</title>
1534
+ </clause>
1535
+ </clause>
1536
+ <definitions id='_' obligation='normative'>
1537
+ <title>Symbols and abbreviated terms</title>
1538
+ <clause id='_' inline-header='false' obligation='normative'>
1539
+ <title>General</title>
1540
+ </clause>
1541
+ <definitions id='_' type='symbols' obligation='normative'>
1542
+ <title>Simboloj kai mallongigitaj terminoj</title>
1543
+ </definitions>
1544
+ </definitions>
1493
1545
  </clause>
1494
- </clause>
1495
- </clause>
1496
- <clause id='_' inline-header='false' obligation='normative'>
1497
- <title>Normal Terms</title>
1498
- <clause id='_' inline-header='false' obligation='normative'>
1499
- <title>Term2</title>
1500
- </clause>
1501
- </clause>
1502
- <definitions id='_' obligation='normative'>
1503
- <title>Symbols and abbreviated terms</title>
1504
- <clause id='_' inline-header='false' obligation='normative'>
1505
- <title>General</title>
1506
- </clause>
1507
- <definitions id='_' type='symbols' obligation='normative'>
1508
- <title>Simboloj kai mallongigitaj terminoj</title>
1509
- </definitions>
1510
- </definitions>
1511
- </clause>
1512
- <definitions id='_' type='abbreviated_terms' obligation='normative'>
1513
- <title>Abbreviated terms</title>
1514
- </definitions>
1515
- <clause id='_' inline-header='false' obligation='normative'>
1516
- <title>Clause 4</title>
1517
- <clause id='_' inline-header='false' obligation='normative'>
1518
- <title>Introduction</title>
1519
- </clause>
1520
- <clause id='_' inline-header='false' obligation='normative'>
1521
- <title>Clause 4.2</title>
1522
- </clause>
1523
- </clause>
1524
- <clause id='_' inline-header='false' obligation='normative'>
1525
- <title>Terms and Definitions</title>
1526
- </clause>
1527
- </sections>
1528
- <annex id='_' inline-header='false' obligation='normative'>
1529
- <title>Annex</title>
1530
- <clause id='_' inline-header='false' obligation='normative'>
1531
- <title>Annex A.1</title>
1532
- </clause>
1533
- </annex>
1534
- <bibliography>
1535
- <references id='_' normative='true' obligation='informative'>
1536
- <title>Normaj citaĵoj</title>
1537
- <p id='_'>There are no normative references in this document.</p>
1538
- </references>
1539
- <references id='_' normative='true' obligation='informative'>
1540
- <title>Normative References 2</title>
1541
- </references>
1542
- <references id='_' normative='false' obligation='informative'>
1543
- <title>Bibliografio</title>
1544
- </references>
1545
- <clause id='_' obligation='informative'>
1546
- <title>Bibliography 2</title>
1547
- <references id='_' normative='false' obligation='informative'>
1548
- <title>Bibliography Subsection</title>
1549
- </references>
1550
- </clause>
1551
- </bibliography>
1552
- </standard-document>
1553
- OUTPUT
1554
- end
1555
-
1546
+ <definitions id='_' type='abbreviated_terms' obligation='normative'>
1547
+ <title>Abbreviated terms</title>
1548
+ </definitions>
1549
+ <clause id='_' inline-header='false' obligation='normative'>
1550
+ <title>Clause 4</title>
1551
+ <clause id='_' inline-header='false' obligation='normative'>
1552
+ <title>Introduction</title>
1553
+ </clause>
1554
+ <clause id='_' inline-header='false' obligation='normative'>
1555
+ <title>Clause 4.2</title>
1556
+ </clause>
1557
+ </clause>
1558
+ <clause id='_' inline-header='false' obligation='normative'>
1559
+ <title>Terms and Definitions</title>
1560
+ </clause>
1561
+ </sections>
1562
+ <annex id='_' inline-header='false' obligation='normative'>
1563
+ <title>Annex</title>
1564
+ <clause id='_' inline-header='false' obligation='normative'>
1565
+ <title>Annex A.1</title>
1566
+ </clause>
1567
+ </annex>
1568
+ <bibliography>
1569
+ <references id='_' normative='true' obligation='informative'>
1570
+ <title>Normaj citaĵoj</title>
1571
+ <p id='_'>There are no normative references in this document.</p>
1572
+ </references>
1573
+ <references id='_' normative='true' obligation='informative'>
1574
+ <title>Normative References 2</title>
1575
+ </references>
1576
+ <references id='_' normative='false' obligation='informative'>
1577
+ <title>Bibliografio</title>
1578
+ </references>
1579
+ <clause id='_' obligation='informative'>
1580
+ <title>Bibliography 2</title>
1581
+ <references id='_' normative='false' obligation='informative'>
1582
+ <title>Bibliography Subsection</title>
1583
+ </references>
1584
+ </clause>
1585
+ </bibliography>
1586
+ </standard-document>
1587
+ OUTPUT
1588
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1589
+ .to be_equivalent_to xmlpp(output)
1590
+ end
1556
1591
  end