metanorma-standoc 2.2.3.1 → 2.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/lib/metanorma/standoc/base.rb +2 -1
  3. data/lib/metanorma/standoc/biblio.rng +32 -1
  4. data/lib/metanorma/standoc/blocks.rb +2 -1
  5. data/lib/metanorma/standoc/cleanup_biblio.rb +111 -23
  6. data/lib/metanorma/standoc/cleanup_boilerplate.rb +2 -2
  7. data/lib/metanorma/standoc/front.rb +1 -0
  8. data/lib/metanorma/standoc/isodoc.rng +9 -0
  9. data/lib/metanorma/standoc/macros_plantuml.rb +23 -10
  10. data/lib/metanorma/standoc/render.rb +1 -0
  11. data/lib/metanorma/standoc/term_lookup_cleanup.rb +32 -13
  12. data/lib/metanorma/standoc/utils.rb +3 -3
  13. data/lib/metanorma/standoc/validate.rb +12 -3
  14. data/lib/metanorma/standoc/version.rb +1 -1
  15. data/metanorma-standoc.gemspec +2 -2
  16. data/spec/metanorma/base_spec.rb +10 -1
  17. data/spec/metanorma/biblio_spec.rb +47 -17
  18. data/spec/metanorma/blocks_spec.rb +2 -2
  19. data/spec/metanorma/cleanup_sections_spec.rb +2 -1
  20. data/spec/metanorma/inline_spec.rb +10 -9
  21. data/spec/metanorma/isobib_cache_spec.rb +2 -2
  22. data/spec/metanorma/macros_concept_spec.rb +1 -1
  23. data/spec/metanorma/macros_spec.rb +2 -2
  24. data/spec/metanorma/refs_spec.rb +25 -25
  25. data/spec/metanorma/validate_spec.rb +33 -0
  26. data/spec/vcr_cassettes/bsi16341.yml +38 -38
  27. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +64 -64
  28. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  29. data/spec/vcr_cassettes/hide_refs.yml +53 -53
  30. data/spec/vcr_cassettes/isobib_get_123.yml +11 -11
  31. data/spec/vcr_cassettes/isobib_get_123_1.yml +22 -22
  32. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +54 -54
  33. data/spec/vcr_cassettes/isobib_get_123_2.yml +24 -24
  34. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  35. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  36. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +22 -24
  37. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +55 -55
  38. data/spec/vcr_cassettes/std-link.yml +13 -13
  39. metadata +6 -10
  40. data/spec/requirements/default/blocks_spec.rb +0 -250
  41. data/spec/requirements/default/cleanup_spec.rb +0 -173
  42. data/spec/requirements/modspec/cleanup_spec.rb +0 -333
  43. data/spec/requirements/modspec/validate_spec.rb +0 -330
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-standoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3.1
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-07 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.2.3
47
+ version: 2.3.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.2.3
54
+ version: 2.3.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: metanorma
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 0.1.3
173
+ version: 0.1.4
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 0.1.3
180
+ version: 0.1.4
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: pngcheck
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -648,10 +648,6 @@ files:
648
648
  - spec/metanorma/section_spec.rb
649
649
  - spec/metanorma/table_spec.rb
650
650
  - spec/metanorma/validate_spec.rb
651
- - spec/requirements/default/blocks_spec.rb
652
- - spec/requirements/default/cleanup_spec.rb
653
- - spec/requirements/modspec/cleanup_spec.rb
654
- - spec/requirements/modspec/validate_spec.rb
655
651
  - spec/spec_helper.rb
656
652
  - spec/support/shared_examples/structured_data_2_text_preprocessor.rb
657
653
  - spec/vcr_cassettes/bsi16341.yml
@@ -1,250 +0,0 @@
1
- require "spec_helper"
2
- require "open3"
3
-
4
- RSpec.describe Metanorma::Requirements::Default do
5
- it "processes recommendation" do
6
- input = <<~"INPUT"
7
- #{ASCIIDOC_BLANK_HDR}
8
- [.recommendation,identifier="/ogc/recommendation/wfs/2",subject="user;developer, implementer",inherit="/ss/584/2015/level/1; /ss/584/2015/level/2",options="unnumbered",type=verification,model=ogc,tag=X,multilingual-rendering=common]
9
- ====
10
- I recommend this
11
- ====
12
- INPUT
13
- output = <<~"OUTPUT"
14
- #{BLANK_HDR}
15
- <sections>
16
- <recommendation id="_" unnumbered="true" type="verification" model="ogc" tag='X' multilingual-rendering='common'>
17
- <identifier>/ogc/recommendation/wfs/2</identifier>
18
- <subject>user</subject>
19
- <subject>developer, implementer</subject>
20
- <inherit>/ss/584/2015/level/1</inherit>
21
- <inherit>/ss/584/2015/level/2</inherit>
22
- <description><p id="_">I recommend this</p>
23
- </description>
24
- </recommendation>
25
- </sections>
26
- </standard-document>
27
- OUTPUT
28
-
29
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
30
- .to be_equivalent_to xmlpp(output)
31
- end
32
-
33
- it "processes requirement" do
34
- input = <<~"INPUT"
35
- #{ASCIIDOC_BLANK_HDR}
36
- [[ABC]]
37
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2",number=3,keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
38
- .Title
39
- ====
40
- I recommend this
41
-
42
- . http://www.example.com[]
43
- . <<ABC>>
44
- ====
45
- INPUT
46
- output = <<~OUTPUT
47
- #{BLANK_HDR}
48
- <sections>
49
- <requirement id="ABC" subsequence="A" number="3" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' model="default">
50
- <title>Title</title>
51
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
52
- <description><p id="_">I recommend this</p>
53
- <ol id='_' type='arabic'>
54
- <li>
55
- <p id='_'>
56
- <link target='http://www.example.com'/>
57
- </p>
58
- </li>
59
- <li>
60
- <p id='_'>
61
- <xref target='ABC'/>
62
- </p>
63
- </li>
64
- </ol>
65
- </description>
66
- </requirement>
67
- </sections>
68
- </standard-document>
69
- OUTPUT
70
-
71
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
72
- .to be_equivalent_to xmlpp(output)
73
- end
74
-
75
- it "processes permission" do
76
- input = <<~"INPUT"
77
- #{ASCIIDOC_BLANK_HDR}
78
-
79
- [[ABC]]
80
- [.permission,tag=X,multilingual-rendering=common]
81
- ====
82
- I recommend this
83
- ====
84
- INPUT
85
- output = <<~"OUTPUT"
86
- #{BLANK_HDR}
87
- <sections>
88
- <permission id="ABC" tag='X' multilingual-rendering='common' model="default">
89
- <description><p id="_">I recommend this</p></description>
90
- </permission>
91
- </sections>
92
- </standard-document>
93
- OUTPUT
94
-
95
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
96
- .to be_equivalent_to xmlpp(output)
97
- end
98
-
99
- it "processes nested permissions" do
100
- input = <<~"INPUT"
101
- #{ASCIIDOC_BLANK_HDR}
102
- [.permission]
103
- ====
104
- I permit this
105
-
106
- =====
107
- Example 2
108
- =====
109
-
110
- [.permission]
111
- =====
112
- I also permit this
113
-
114
- . List
115
- . List
116
- =====
117
-
118
- [requirement,type="general",identifier="/req/core/quantities-uom"]
119
- ======
120
- ======
121
- ====
122
- INPUT
123
- output = <<~"OUTPUT"
124
- #{BLANK_HDR}
125
- <sections>
126
- <permission id="_" model="default"><description><p id="_">I permit this</p>
127
- <example id="_">
128
- <p id="_">Example 2</p>
129
- </example></description>
130
- <permission id="_" model="default">
131
- <description><p id="_">I also permit this</p>
132
- <ol id='_' type='arabic'>
133
- <li>
134
- <p id='_'>List</p>
135
- </li>
136
- <li>
137
- <p id='_'>List</p>
138
- </li>
139
- </ol>
140
- </description>
141
- </permission>
142
- <requirement id='_' type='general' model="default">
143
- <identifier>/req/core/quantities-uom</identifier>
144
- </requirement>
145
- </permission>
146
- </sections>
147
- </standard-document>
148
- OUTPUT
149
-
150
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
151
- .to be_equivalent_to xmlpp(output)
152
- end
153
-
154
- it "processes recommendation with internal markup of structure" do
155
- input = <<~"INPUT"
156
- #{ASCIIDOC_BLANK_HDR}
157
-
158
- [[ABC]]
159
- [.recommendation,identifier="/ogc/recommendation/wfs/2",subject="user",classification="control-class:Technical;priority:P0;family:System &amp; Communications Protection,System and Communications Protocols",obligation="permission,recommendation",filename="reqt1.rq"]
160
- ====
161
- I recommend _this_.
162
-
163
- [.specification,type="tabular",keep-with-next=true,keep-lines-together=true]
164
- --
165
- This is the object of the recommendation:
166
- |===
167
- |Object |Value
168
- |Mission | Accomplished
169
- |===
170
- --
171
-
172
- As for the measurement targets,
173
-
174
- [.measurement-target]
175
- --
176
- The measurement target shall be measured as:
177
- [stem]
178
- ++++
179
- r/1 = 0
180
- ++++
181
- --
182
-
183
- [.verification]
184
- --
185
- The following code will be run for verification:
186
-
187
- [source,CoreRoot]
188
- ----
189
- CoreRoot(success): HttpResponse
190
- if (success)
191
- recommendation(label: success-response)
192
- end
193
- ----
194
- --
195
-
196
- [.import%exclude]
197
- --
198
- [source,CoreRoot]
199
- ----
200
- success-response()
201
- ----
202
- --
203
-
204
- [.component]
205
- --
206
- Hello
207
- --
208
-
209
- [.component,class=condition]
210
- --
211
- If this be thus
212
- --
213
- ====
214
- INPUT
215
- output = <<~"OUTPUT"
216
- #{BLANK_HDR}
217
- <sections>
218
- <recommendation id="ABC" obligation="permission,recommendation" filename="reqt1.rq" model="default"><identifier>/ogc/recommendation/wfs/2</identifier><subject>user</subject>
219
- <classification><tag>control-class</tag><value>Technical</value></classification><classification><tag>priority</tag><value>P0</value></classification><classification><tag>family</tag><value>System &amp; Communications Protection</value></classification><classification><tag>family</tag><value>System and Communications Protocols</value></classification>
220
- <description><p id="_">I recommend <em>this</em>.</p>
221
- </description><specification exclude="false" type="tabular" keep-with-next="true" keep-lines-together="true"><p id="_">This is the object of the recommendation:</p><table id="_"> <tbody> <tr> <td valign="top" align="left">Object</td> <td valign="top" align="left">Value</td> </tr> <tr> <td valign="top" align="left">Mission</td> <td valign="top" align="left">Accomplished</td> </tr> </tbody></table></specification><description>
222
- <p id="_">As for the measurement targets,</p>
223
- </description><measurement-target exclude="false"><p id="_">The measurement target shall be measured as:</p><formula id="_"> <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac>
224
- <mrow>
225
- <mi>r</mi>
226
- </mrow>
227
- <mrow>
228
- <mn>1</mn>
229
- </mrow>
230
- </mfrac><mo>=</mo><mn>0</mn></math></stem></formula></measurement-target>
231
- <verification exclude="false"><p id="_">The following code will be run for verification:</p><sourcecode lang="CoreRoot" id="_">CoreRoot(success): HttpResponse
232
- if (success)
233
- recommendation(label: success-response)
234
- end</sourcecode></verification>
235
- <import exclude="true"> <sourcecode lang="CoreRoot" id="_">success-response()</sourcecode></import>
236
- <component exclude='false' class='component'>
237
- <p id='_'>Hello</p>
238
- </component>
239
- <component exclude='false' class='condition'>
240
- <p id='_'>If this be thus</p>
241
- </component>
242
- </recommendation>
243
- </sections>
244
- </standard-document>
245
- OUTPUT
246
-
247
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
248
- .to be_equivalent_to xmlpp(output)
249
- end
250
- end
@@ -1,173 +0,0 @@
1
- require "spec_helper"
2
- require "fileutils"
3
-
4
- RSpec.describe Metanorma::Requirements::Default do
5
- it "moves requirement metadata deflist to correct location" do
6
- input = <<~INPUT
7
- #{ASCIIDOC_BLANK_HDR}
8
-
9
- == Clause
10
-
11
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
12
- ====
13
- [%metadata]
14
- model:: ogc
15
- type:: class
16
- identifier:: http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules[*req/core*]
17
- subject:: Encoding of logical models
18
- inherit:: urn:iso:dis:iso:19156:clause:7.2.2
19
- inherit:: urn:iso:dis:iso:19156:clause:8
20
- inherit:: http://www.opengis.net/doc/IS/GML/3.2/clause/2.4
21
- inherit:: O&M Abstract model, OGC 10-004r3, clause D.3.4
22
- inherit:: http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used
23
- inherit:: <<ref2>>
24
- inherit:: <<ref3>>
25
- target:: http://www.example.com
26
- classification:: priority:P0
27
- classification:: domain:Hydrology,Groundwater
28
- classification:: control-class:Technical
29
- obligation:: recommendation,requirement
30
-
31
- I recommend this
32
- ====
33
- INPUT
34
- output = <<~OUTPUT
35
- #{BLANK_HDR}
36
- <sections>
37
- <clause id='_' inline-header='false' obligation='normative'>
38
- <title>Clause</title>
39
- <requirement id='_' subsequence='A' obligation='recommendation,requirement' model='ogc' type='class'>
40
- <identifier>http://www.opengis.net/spec/waterml/2.0/req/xsd-xml-rules</identifier>
41
- <subject>Encoding of logical models</subject>
42
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
43
- <inherit>urn:iso:dis:iso:19156:clause:7.2.2</inherit>
44
- <inherit>urn:iso:dis:iso:19156:clause:8</inherit>
45
- <inherit>http://www.opengis.net/doc/IS/GML/3.2/clause/2.4</inherit>
46
- <inherit>O&amp;M Abstract model, OGC 10-004r3, clause D.3.4</inherit>
47
- <inherit>http://www.opengis.net/spec/SWE/2.0/req/core/core-concepts-used</inherit>
48
- <inherit>
49
- <xref target='ref2'/>
50
- </inherit>
51
- <inherit>
52
- <xref target='ref3'/>
53
- </inherit>
54
- <classification>
55
- <tag>priority</tag>
56
- <value>P0</value>
57
- </classification>
58
- <classification>
59
- <tag>domain</tag>
60
- <value>Hydrology</value>
61
- </classification>
62
- <classification>
63
- <tag>domain</tag>
64
- <value>Groundwater</value>
65
- </classification>
66
- <classification>
67
- <tag>control-class</tag>
68
- <value>Technical</value>
69
- </classification>
70
- <classification>
71
- <tag>target</tag>
72
- <value><link target='http://www.example.com'/></value>
73
- </classification>
74
- <description>
75
- <p id='_'>I recommend this</p>
76
- </description>
77
- </requirement>
78
- </clause>
79
- </sections>
80
- </standard-document>
81
- OUTPUT
82
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
83
- .to be_equivalent_to xmlpp(output)
84
- end
85
-
86
- it "moves inherit macros to correct location" do
87
- input = <<~INPUT
88
- #{ASCIIDOC_BLANK_HDR}
89
-
90
- == Clause
91
-
92
- [.requirement,subsequence="A",inherit="/ss/584/2015/level/1 &amp; /ss/584/2015/level/2"]
93
- .Title
94
- ====
95
- inherit:[A]
96
- inherit:[B]
97
- I recommend this
98
- ====
99
-
100
- [.requirement,subsequence="A",classification="X:Y"]
101
- .Title
102
- ====
103
- inherit:[A]
104
- I recommend this
105
- ====
106
-
107
- [.requirement,subsequence="A"]
108
- .Title
109
- ====
110
- inherit:[A]
111
- I recommend this
112
- ====
113
-
114
- [.requirement,subsequence="A"]
115
- .Title
116
- ====
117
- inherit:[A]
118
- ====
119
-
120
- [.requirement,subsequence="A"]
121
- ====
122
- inherit:[A]
123
- ====
124
-
125
- INPUT
126
- output = <<~OUTPUT
127
- #{BLANK_HDR}
128
- <sections>
129
- <clause id='_' inline-header='false' obligation='normative'>
130
- <title>Clause</title>
131
- <requirement id='_' subsequence='A' model="default">
132
- <title>Title</title>
133
- <inherit>A</inherit>
134
- <inherit>B</inherit>
135
- <inherit>/ss/584/2015/level/1 &amp; /ss/584/2015/level/2</inherit>
136
- <description>
137
- <p id='_'> I recommend this</p>
138
- </description>
139
- </requirement>
140
- <requirement id='_' subsequence='A' model="default">
141
- <title>Title</title>
142
- <inherit>A</inherit>
143
- <classification>
144
- <tag>X</tag>
145
- <value>Y</value>
146
- </classification>
147
- <description>
148
- <p id='_'> I recommend this</p>
149
- </description>
150
- </requirement>
151
- <requirement id='_' subsequence='A' model="default">
152
- <title>Title</title>
153
- <inherit>A</inherit>
154
- <description>
155
- <p id='_'> I recommend this</p>
156
- </description>
157
- </requirement>
158
- <requirement id='_' subsequence='A' model="default">
159
- <title>Title</title>
160
- <inherit>A</inherit>
161
- </requirement>
162
- <requirement id='_' subsequence='A' model="default">
163
- <inherit>A</inherit>
164
- </requirement>
165
- </clause>
166
- </sections>
167
- </standard-document>
168
- OUTPUT
169
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
170
- .to be_equivalent_to xmlpp(output)
171
- end
172
- end
173
-