metanorma-iso 1.8.5 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -86,86 +86,86 @@ RSpec.describe IsoDoc do
86
86
  INPUT
87
87
 
88
88
  presxml = <<~OUTPUT
89
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
90
- <preface>
91
- <foreword obligation="informative" displayorder="1">
92
- <title>Foreword</title>
93
- <p id="A">This is a preamble</p>
94
- </foreword>
95
- <introduction id="B" obligation="informative" displayorder="2">
96
- <title depth="1">0<tab/>Introduction</title>
97
- <clause id="C" inline-header="false" obligation="informative">
98
- <title depth="2">0.1<tab/>Introduction Subsection</title>
99
- </clause>
100
- <p>This is patent boilerplate</p>
101
- </introduction>
102
- </preface>
103
- <sections>
104
- <clause id="D" obligation="normative" type="scope" displayorder="3">
105
- <title depth="1">1<tab/>Scope</title>
106
- <p id="E">Text</p>
107
- </clause>
108
- <clause id="H" obligation="normative" displayorder="5">
109
- <title depth="1">3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
110
- <terms id="I" obligation="normative">
111
- <title depth="2">3.1<tab/>Normal Terms</title>
112
- <term id="J"><name>3.1.1</name>
113
- <preferred>Term2</preferred>
114
- </term>
115
- </terms>
116
- <definitions id="K" inline-header="true"><title>3.2</title>
117
- <dl>
118
- <dt>Symbol</dt>
119
- <dd>Definition</dd>
120
- </dl>
121
- </definitions>
89
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
90
+ <preface>
91
+ <foreword obligation="informative" displayorder="1">
92
+ <title>Foreword</title>
93
+ <p id="A">This is a preamble</p>
94
+ </foreword>
95
+ <introduction id="B" obligation="informative" displayorder="2">
96
+ <title depth="1">0<tab/>Introduction</title>
97
+ <clause id="C" inline-header="false" obligation="informative">
98
+ <title depth="2">0.1<tab/>Introduction Subsection</title>
122
99
  </clause>
123
- <definitions id="L" displayorder="6"><title>4</title>
100
+ <p>This is patent boilerplate</p>
101
+ </introduction>
102
+ </preface>
103
+ <sections>
104
+ <clause id="D" obligation="normative" type="scope" displayorder="3">
105
+ <title depth="1">1<tab/>Scope</title>
106
+ <p id="E">Text</p>
107
+ </clause>
108
+ <clause id="H" obligation="normative" displayorder="5">
109
+ <title depth="1">3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
110
+ <terms id="I" obligation="normative">
111
+ <title depth="2">3.1<tab/>Normal Terms</title>
112
+ <term id="J"><name>3.1.1</name>
113
+ <preferred>Term2</preferred>
114
+ </term>
115
+ </terms>
116
+ <definitions id="K" inline-header="true"><title>3.2</title>
124
117
  <dl>
125
118
  <dt>Symbol</dt>
126
119
  <dd>Definition</dd>
127
120
  </dl>
128
121
  </definitions>
129
- <clause id="M" inline-header="false" obligation="normative" displayorder="7">
130
- <title depth="1">5<tab/>Clause 4</title>
131
- <clause id="N" inline-header="false" obligation="normative">
132
- <title depth="2">5.1<tab/>Introduction</title>
133
- </clause>
134
- <clause id="O" inline-header="false" obligation="normative">
135
- <title depth="2">5.2<tab/>Clause 4.2</title>
136
- </clause>
122
+ </clause>
123
+ <definitions id="L" displayorder="6"><title>4</title>
124
+ <dl>
125
+ <dt>Symbol</dt>
126
+ <dd>Definition</dd>
127
+ </dl>
128
+ </definitions>
129
+ <clause id="M" inline-header="false" obligation="normative" displayorder="7">
130
+ <title depth="1">5<tab/>Clause 4</title>
131
+ <clause id="N" inline-header="false" obligation="normative">
132
+ <title depth="2">5.1<tab/>Introduction</title>
137
133
  </clause>
138
- </sections>
139
- <annex id="P" inline-header="false" obligation="normative" displayorder="8">
140
- <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
141
- <clause id="Q" inline-header="false" obligation="normative">
142
- <title depth="2">A.1<tab/>Annex A.1</title>
143
- <clause id="Q1" inline-header="false" obligation="normative">
144
- <title depth="3">A.1.1<tab/>Annex A.1a</title>
145
- </clause>
134
+ <clause id="O" inline-header="false" obligation="normative">
135
+ <title depth="2">5.2<tab/>Clause 4.2</title>
146
136
  </clause>
147
- <appendix id="Q2" inline-header="false" obligation="normative">
148
- <title depth="2">Appendix 1<tab/>An Appendix</title>
149
- <clause id="Q2a" inline-header="false" obligation="normative">
150
- <title depth="3">Appendix 1.1<tab/>Appendix subclause</title>
151
- </clause>
152
- </appendix>
153
- <references id="Q3" normative="false">
154
- <title depth="2">A.2<tab/>Annex Bibliography</title>
155
- </references>
156
- </annex>
157
- <bibliography>
158
- <references id="R" normative="true" obligation="informative" displayorder="4">
159
- <title depth="1">2<tab/>Normative References</title>
160
- </references>
161
- <clause id="S" obligation="informative" displayorder="9">
162
- <title depth="1">Bibliography</title>
163
- <references id="T" normative="false" obligation="informative">
164
- <title depth="2">Bibliography Subsection</title>
165
- </references>
137
+ </clause>
138
+ </sections>
139
+ <annex id="P" inline-header="false" obligation="normative" displayorder="8">
140
+ <title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
141
+ <clause id="Q" inline-header="false" obligation="normative">
142
+ <title depth="2">A.1<tab/>Annex A.1</title>
143
+ <clause id="Q1" inline-header="false" obligation="normative">
144
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
166
145
  </clause>
167
- </bibliography>
168
- </iso-standard>
146
+ </clause>
147
+ <appendix id="Q2" inline-header="false" obligation="normative">
148
+ <title depth="2">Appendix 1<tab/>An Appendix</title>
149
+ <clause id="Q2a" inline-header="false" obligation="normative">
150
+ <title depth="3">Appendix 1.1<tab/>Appendix subclause</title>
151
+ </clause>
152
+ </appendix>
153
+ <references id="Q3" normative="false">
154
+ <title depth="2">A.2<tab/>Annex Bibliography</title>
155
+ </references>
156
+ </annex>
157
+ <bibliography>
158
+ <references id="R" normative="true" obligation="informative" displayorder="4">
159
+ <title depth="1">2<tab/>Normative References</title>
160
+ </references>
161
+ <clause id="S" obligation="informative" displayorder="9">
162
+ <title depth="1">Bibliography</title>
163
+ <references id="T" normative="false" obligation="informative">
164
+ <title depth="2">Bibliography Subsection</title>
165
+ </references>
166
+ </clause>
167
+ </bibliography>
168
+ </iso-standard>
169
169
  OUTPUT
170
170
 
171
171
  html = <<~OUTPUT
@@ -524,6 +524,129 @@ RSpec.describe IsoDoc do
524
524
  .convert("test", input, true))).to be_equivalent_to xmlpp(output)
525
525
  end
526
526
 
527
+ it "processes multiple terms & definitions sections" do
528
+ input = <<~INPUT
529
+ #{BLANK_HDR.sub(%r{<doctype>article</doctype>}, '<doctype>article</doctype><subdoctype>vocabulary</subdoctype>')}
530
+ <sections>
531
+ <terms id='A' obligation='normative'>
532
+ <title>Terms and definitions</title>
533
+ <p id='A1'>No terms and definitions are listed in this document.</p>
534
+ </terms>
535
+ <clause id='B' inline-header='false' obligation='normative'>
536
+ <title>Clause</title>
537
+ </clause>
538
+ <terms id='C' obligation='normative'>
539
+ <title>More terms</title>
540
+ </terms>
541
+ </sections>
542
+ </iso-standard>
543
+ INPUT
544
+ presxml = <<~OUTPUT
545
+ <iso-standard xmlns='https://www.metanorma.org/ns/iso' type='presentation' version="#{Metanorma::ISO::VERSION}">
546
+ <bibdata type='standard'>
547
+ <contributor>
548
+ <role type='author'/>
549
+ <organization>
550
+ <name>International Organization for Standardization</name>
551
+ <abbreviation>ISO</abbreviation>
552
+ </organization>
553
+ </contributor>
554
+ <contributor>
555
+ <role type='publisher'/>
556
+ <organization>
557
+ <name>International Organization for Standardization</name>
558
+ <abbreviation>ISO</abbreviation>
559
+ </organization>
560
+ </contributor>
561
+ <language current='true'>en</language>
562
+ <script current='true'>Latn</script>
563
+ <status>
564
+ <stage abbreviation='IS' language=''>60</stage>
565
+ <substage language=''>60</substage>
566
+ </status>
567
+ <copyright>
568
+ <from>2021</from>
569
+ <owner>
570
+ <organization>
571
+ <name>International Organization for Standardization</name>
572
+ <abbreviation>ISO</abbreviation>
573
+ </organization>
574
+ </owner>
575
+ </copyright>
576
+ <ext>
577
+ <doctype language=''>article</doctype>
578
+ <subdoctype>vocabulary</subdoctype>
579
+ <editorialgroup>
580
+ <technical-committee/>
581
+ <subcommittee/>
582
+ <workgroup/>
583
+ </editorialgroup>
584
+ <stagename>International standard</stagename>
585
+ </ext>
586
+ </bibdata>
587
+ <sections>
588
+ <terms id='A' obligation='normative' displayorder='1'>
589
+ <title depth='1'>
590
+ 1
591
+ <tab/>
592
+ Terms and definitions
593
+ </title>
594
+ <p id='A1'>No terms and definitions are listed in this document.</p>
595
+ </terms>
596
+ <clause id='B' inline-header='false' obligation='normative' displayorder='2'>
597
+ <title depth='1'>
598
+ 2
599
+ <tab/>
600
+ Clause
601
+ </title>
602
+ </clause>
603
+ <terms id='C' obligation='normative' displayorder='3'>
604
+ <title depth='1'>
605
+ 3
606
+ <tab/>
607
+ More terms
608
+ </title>
609
+ </terms>
610
+ </sections>
611
+ </iso-standard>
612
+ OUTPUT
613
+ output = <<~OUTPUT
614
+ <html lang='en'>
615
+ <head/>
616
+ <body lang='en'>
617
+ <div class='title-section'>
618
+ <p>&#160;</p>
619
+ </div>
620
+ <br/>
621
+ <div class='prefatory-section'>
622
+ <p>&#160;</p>
623
+ </div>
624
+ <br/>
625
+ <div class='main-section'>
626
+ <p class='zzSTDTitle1'/>
627
+ <div id='A'>
628
+ <h1> 1 &#160; Terms and definitions </h1>
629
+ <p id='A1'>No terms and definitions are listed in this document.</p>
630
+ </div>
631
+ <div id='B'>
632
+ <h1> 2 &#160; Clause </h1>
633
+ </div>
634
+ <div id='C'>
635
+ <h1> 3 &#160; More terms </h1>
636
+ </div>
637
+ </div>
638
+ </body>
639
+ </html>
640
+ OUTPUT
641
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
642
+ .convert("test", input, true)
643
+ .gsub(%r{<localized-strings>.*</localized-strings>}m, "")
644
+ .gsub(%r{<boilerplate>.*</boilerplate>}m, "")))
645
+ .to be_equivalent_to xmlpp(presxml)
646
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
647
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
648
+ end
649
+
527
650
  it "processes inline section headers" do
528
651
  output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
529
652
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -701,7 +824,7 @@ RSpec.describe IsoDoc do
701
824
  </clause>
702
825
  </clause>
703
826
  </sections>
704
- <indexsect id='_'>
827
+ <indexsect id='_' displayorder="2">
705
828
  <title>Index</title>
706
829
  <ul>
707
830
  <li>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.5
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isodoc
@@ -16,30 +16,30 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.2
19
+ version: 1.7.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.2
26
+ version: 1.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: metanorma-standoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.9.0
33
+ version: 1.10.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.9.0
40
+ version: 1.10.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: mn2sts
42
+ name: mnconvert
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"