metanorma-standoc 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -115,12 +115,15 @@ module Asciidoctor
115
115
  end
116
116
 
117
117
  def metadata_status(node, xml)
118
- xml.status(**{ format: "plain" }) do |s|
119
- s << ( node.attr("status") || "published" )
118
+ xml.status do |s|
119
+ s.stage ( node.attr("status") || node.attr("docstage") || "published" )
120
+ node.attr("docsubstage") and s.substage node.attr("docsubstage")
121
+ node.attr("iteration") and s.iteration node.attr("iteration")
120
122
  end
121
123
  end
122
124
 
123
125
  def metadata_committee(node, xml)
126
+ return unless node.attr("technical-committee")
124
127
  xml.editorialgroup do |a|
125
128
  committee_component("technical-committee", node, a)
126
129
  end
@@ -216,13 +219,28 @@ module Asciidoctor
216
219
  metadata_status(node, xml)
217
220
  metadata_copyright(node, xml)
218
221
  metadata_relations(node, xml)
219
- metadata_committee(node, xml)
220
- metadata_ics(node, xml)
222
+ metadata_series(node, xml)
223
+ xml.ext do |ext|
224
+ metadata_ext(node, xml)
225
+ end
226
+ end
227
+
228
+ def metadata_ext(node, ext)
229
+ metadata_doctype(node, ext)
230
+ metadata_committee(node, ext)
231
+ metadata_ics(node, ext)
232
+ end
233
+
234
+ def metadata_doctype(node, xml)
235
+ xml.doctype doctype(node)
221
236
  end
222
237
 
223
238
  def metadata_note(node, xml)
224
239
  end
225
240
 
241
+ def metadata_series(node, xml)
242
+ end
243
+
226
244
  def asciidoc_sub(x)
227
245
  return nil if x.nil?
228
246
  return "" if x.empty?
@@ -19,21 +19,7 @@
19
19
  -->
20
20
  <grammar ns="http://riboseinc.com/isoxml" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
21
  <include href="reqt.rng"/>
22
- <include href="biblio.rng">
23
- <define name="status">
24
- <element name="status">
25
- <choice>
26
- <value>proposal</value>
27
- <value>working_draft</value>
28
- <value>committee_draft</value>
29
- <value>draft_standard</value>
30
- <value>final_draft</value>
31
- <value>published</value>
32
- <value>withdrawn</value>
33
- </choice>
34
- </element>
35
- </define>
36
- </include>
22
+ <include href="biblio.rng"/>
37
23
  <start>
38
24
  <ref name="standard-document"/>
39
25
  </start>
@@ -485,6 +471,11 @@
485
471
  <attribute name="id">
486
472
  <data type="ID"/>
487
473
  </attribute>
474
+ <optional>
475
+ <attribute name="unnumbered">
476
+ <data type="boolean"/>
477
+ </attribute>
478
+ </optional>
488
479
  <ref name="stem"/>
489
480
  <optional>
490
481
  <ref name="dl"/>
@@ -533,6 +524,11 @@
533
524
  <attribute name="id">
534
525
  <data type="ID"/>
535
526
  </attribute>
527
+ <optional>
528
+ <attribute name="unnumbered">
529
+ <data type="boolean"/>
530
+ </attribute>
531
+ </optional>
536
532
  <optional>
537
533
  <attribute name="lang"/>
538
534
  </optional>
@@ -572,6 +568,11 @@
572
568
  <attribute name="id">
573
569
  <data type="ID"/>
574
570
  </attribute>
571
+ <optional>
572
+ <attribute name="unnumbered">
573
+ <data type="boolean"/>
574
+ </attribute>
575
+ </optional>
575
576
  <optional>
576
577
  <attribute name="alt"/>
577
578
  </optional>
@@ -689,6 +690,11 @@
689
690
  <attribute name="id">
690
691
  <data type="ID"/>
691
692
  </attribute>
693
+ <optional>
694
+ <attribute name="unnumbered">
695
+ <data type="boolean"/>
696
+ </attribute>
697
+ </optional>
692
698
  <oneOrMore>
693
699
  <choice>
694
700
  <ref name="formula"/>
@@ -732,6 +738,11 @@
732
738
  <attribute name="id">
733
739
  <data type="ID"/>
734
740
  </attribute>
741
+ <optional>
742
+ <attribute name="unnumbered">
743
+ <data type="boolean"/>
744
+ </attribute>
745
+ </optional>
735
746
  <optional>
736
747
  <ref name="source"/>
737
748
  </optional>
@@ -1094,57 +1105,28 @@
1094
1105
  </zeroOrMore>
1095
1106
  </element>
1096
1107
  </define>
1097
- <define name="BibData">
1098
- <optional>
1099
- <attribute name="type">
1100
- <ref name="BibItemType"/>
1101
- </attribute>
1102
- </optional>
1103
- <oneOrMore>
1104
- <ref name="btitle"/>
1105
- </oneOrMore>
1106
- <optional>
1107
- <ref name="formattedref"/>
1108
- </optional>
1109
- <zeroOrMore>
1110
- <ref name="bsource"/>
1111
- </zeroOrMore>
1112
- <zeroOrMore>
1113
- <ref name="docidentifier"/>
1114
- </zeroOrMore>
1115
- <optional>
1116
- <ref name="docnumber"/>
1117
- </optional>
1118
- <zeroOrMore>
1119
- <ref name="bdate"/>
1120
- </zeroOrMore>
1121
- <zeroOrMore>
1122
- <ref name="contributor"/>
1123
- </zeroOrMore>
1124
- <optional>
1125
- <ref name="edition"/>
1126
- </optional>
1127
- <optional>
1128
- <ref name="version"/>
1129
- </optional>
1130
- <zeroOrMore>
1131
- <ref name="biblionote"/>
1132
- </zeroOrMore>
1133
- <zeroOrMore>
1134
- <ref name="language"/>
1135
- </zeroOrMore>
1136
- <zeroOrMore>
1137
- <ref name="script"/>
1138
- </zeroOrMore>
1108
+ <define name="ext">
1109
+ <element name="ext">
1110
+ <ref name="BibDataExtensionType"/>
1111
+ </element>
1112
+ </define>
1113
+ <define name="BibDataExtensionType">
1139
1114
  <optional>
1140
- <ref name="abstract"/>
1115
+ <ref name="doctype"/>
1141
1116
  </optional>
1117
+ </define>
1118
+ <define name="doctype">
1119
+ <element name="doctype">
1120
+ <ref name="DocumentType"/>
1121
+ </element>
1122
+ </define>
1123
+ <define name="DocumentType">
1124
+ <value>document</value>
1125
+ </define>
1126
+ <define name="BibData">
1127
+ <ref name="BibliographicItem"/>
1142
1128
  <optional>
1143
- <ref name="status"/>
1129
+ <ref name="ext"/>
1144
1130
  </optional>
1145
- <ref name="copyright"/>
1146
- <zeroOrMore>
1147
- <ref name="docrelation"/>
1148
- </zeroOrMore>
1149
1131
  </define>
1150
1132
  </grammar>
@@ -95,7 +95,10 @@ module Asciidoctor
95
95
  conditional_date(t, m, noyr)
96
96
  iso_publisher(t, m[:code])
97
97
  t.note(**plaintxt) { |p| p << "ISO DATE: #{m[:fn]}" } if m.names.include?("fn") && m[:fn]
98
- t.allparts "true"
98
+ #t.allparts "true"
99
+ t.extent **{ type: 'part' } do |e|
100
+ e.referenceFrom "all"
101
+ end
99
102
  end
100
103
  end
101
104
 
@@ -194,16 +197,6 @@ module Asciidoctor
194
197
  end.join("\n")
195
198
  end
196
199
 
197
- def global_bibliocache_name
198
- "#{Dir.home}/.relaton/cache"
199
- end
200
-
201
- def local_bibliocache_name(cachename)
202
- return nil if cachename.nil?
203
- cachename = "relaton" if cachename.empty?
204
- "#{cachename}/cache"
205
- end
206
-
207
200
  def global_ievcache_name
208
201
  "#{Dir.home}/.iev/cache"
209
202
  end
@@ -25,6 +25,11 @@
25
25
  <ref name="ObligationType"/>
26
26
  </attribute>
27
27
  </optional>
28
+ <optional>
29
+ <attribute name="unnumbered">
30
+ <data type="boolean"/>
31
+ </attribute>
32
+ </optional>
28
33
  <attribute name="id">
29
34
  <data type="ID"/>
30
35
  </attribute>
@@ -87,6 +87,7 @@ module Asciidoctor
87
87
 
88
88
  def clause_parse(attrs, xml, node)
89
89
  attrs["inline-header".to_sym] = node.option? "inline-header"
90
+ attrs[:bibitem] = true if node.option? "bibitem"
90
91
  attrs[:level] = node.attr("level")
91
92
  set_obligation(attrs, node)
92
93
  xml.send "clause", **attr_code(attrs) do |xml_section|
@@ -4,6 +4,7 @@ module Asciidoctor
4
4
  def table_attrs(node)
5
5
  { id: Utils::anchor_or_uuid(node),
6
6
  headerrows: node.attr("headerrows"),
7
+ unnumbered: node.option?("unnumbered") ? "true" : nil,
7
8
  alt: node.attr("alt") }
8
9
  end
9
10
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Standoc
3
- VERSION = "1.1.9".freeze
3
+ VERSION = "1.2.0".freeze
4
4
  end
5
5
  end
@@ -24,17 +24,18 @@ Gem::Specification.new do |spec|
24
24
  spec.require_paths = ["lib"]
25
25
  spec.files = `git ls-files`.split("\n")
26
26
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
27
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
27
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
29
  spec.add_dependency "asciidoctor", "~> 1.5.7"
30
30
  spec.add_dependency "ruby-jing"
31
- spec.add_dependency "isodoc", "~> 0.9.0"
31
+ spec.add_dependency "isodoc", "~> 0.10.0"
32
32
  spec.add_dependency "iev", "~> 0.2.1"
33
- spec.add_dependency "relaton", "~> 0.3.1"
33
+ spec.add_dependency "relaton", "~> 0.4.0"
34
34
  spec.add_dependency "sterile", "~> 1.0.14"
35
35
  spec.add_dependency "concurrent-ruby"
36
- spec.add_dependency "html2doc", "~> 0.8.0"
36
+ spec.add_dependency "html2doc", "~> 0.8.11"
37
37
  spec.add_dependency "unicode2latex", "~> 0.0.1"
38
+ spec.add_dependency "relaton-cli", "~> 0.2.0"
38
39
 
39
40
  spec.add_development_dependency "bundler", "~> 2.0.1"
40
41
  spec.add_development_dependency "byebug"
@@ -47,6 +48,9 @@ Gem::Specification.new do |spec|
47
48
  spec.add_development_dependency "simplecov", "~> 0.15"
48
49
  spec.add_development_dependency "timecop", "~> 0.9"
49
50
  spec.add_development_dependency "metanorma", "~> 0.3.0"
50
- spec.add_development_dependency "vcr"
51
+ spec.add_development_dependency "vcr", "~> 5.0.0"
51
52
  spec.add_development_dependency "webmock"
53
+ #spec.add_development_dependency "relaton-iec"
54
+ #spec.add_development_dependency "relaton-iso"
55
+ #spec.add_development_dependency "relaton-ietf"
52
56
  end
@@ -99,7 +99,7 @@ RSpec.describe Asciidoctor::Standoc do
99
99
  INPUT
100
100
  <?xml version="1.0" encoding="UTF-8"?>
101
101
  <standard-document xmlns="http://riboseinc.com/isoxml">
102
- <bibdata type="article">
102
+ <bibdata type="standard">
103
103
  <title language="en" format="text/plain">Main Title — Title</title>
104
104
  <docidentifier>1000-1</docidentifier>
105
105
  <docnumber>1000</docnumber>
@@ -206,7 +206,11 @@ RSpec.describe Asciidoctor::Standoc do
206
206
  </version>
207
207
  <language>en</language>
208
208
  <script>Latn</script>
209
- <status format="plain">published</status>
209
+ <status>
210
+ <stage>10</stage>
211
+ <substage>20</substage>
212
+ <iteration>3</iteration>
213
+ </status>
210
214
  <copyright>
211
215
  <from>2001</from>
212
216
  <owner>
@@ -229,6 +233,8 @@ RSpec.describe Asciidoctor::Standoc do
229
233
  <docidentifier>ABC</docidentifier>
230
234
  </bibitem>
231
235
  </relation>
236
+ <ext>
237
+ <doctype>article</doctype>
232
238
  <editorialgroup>
233
239
  <technical-committee number="1" type="A">TC</technical-committee>
234
240
  <technical-committee number="11" type="A1">TC1</technical-committee>
@@ -242,6 +248,7 @@ RSpec.describe Asciidoctor::Standoc do
242
248
  <ics>
243
249
  <code>3</code>
244
250
  </ics>
251
+ </ext>
245
252
  </bibdata>
246
253
  <sections/>
247
254
  </standard-document>
@@ -277,7 +284,7 @@ RSpec.describe Asciidoctor::Standoc do
277
284
  INPUT
278
285
  <?xml version="1.0" encoding="UTF-8"?>
279
286
  <standard-document xmlns="http://riboseinc.com/isoxml">
280
- <bibdata type="article">
287
+ <bibdata type="standard">
281
288
  <title language="en" format="text/plain">Document title</title>
282
289
  <title language="eo" format="text/plain">Dokumenttitolo</title>
283
290
  <uri>A</uri>
@@ -328,7 +335,7 @@ RSpec.describe Asciidoctor::Standoc do
328
335
  <script>Grek</script>
329
336
  <abstract><p id="_">This is the abstract of the document</p>
330
337
  <p id="_">This is the second paragraph of the abstract of the document.</p></abstract>
331
- <status format="plain">published</status>
338
+ <status><stage>published</stage></status>
332
339
  <copyright>
333
340
  <from>#{Date.today.year}</from>
334
341
  <owner>
@@ -353,9 +360,9 @@ RSpec.describe Asciidoctor::Standoc do
353
360
  </organization>
354
361
  </owner>
355
362
  </copyright>
356
- <editorialgroup>
357
- <technical-committee/>
358
- </editorialgroup>
363
+ <ext>
364
+ <doctype>article</doctype>
365
+ </ext>
359
366
  </bibdata>
360
367
  OUTPUT
361
368
  end
@@ -46,7 +46,7 @@ RSpec.describe Asciidoctor::Standoc do
46
46
  r = 1 %
47
47
  ++++
48
48
 
49
- [stem]
49
+ [stem%unnumbered]
50
50
  ++++
51
51
  <mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">&#x0391;</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>
52
52
  ++++
@@ -69,7 +69,7 @@ RSpec.describe Asciidoctor::Standoc do
69
69
  r = 1 %</stem>
70
70
  </formula>
71
71
 
72
- <formula id="_">
72
+ <formula id="_" unnumbered="true">
73
73
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
74
74
  </formula>
75
75
  <formula id="_">
@@ -277,7 +277,7 @@ RSpec.describe Asciidoctor::Standoc do
277
277
  ****
278
278
  INPUT
279
279
  <standard-document xmlns="http://riboseinc.com/isoxml">
280
- <bibdata type="article">
280
+ <bibdata type="standard">
281
281
  <title language="en" format="text/plain">Document title</title>
282
282
 
283
283
 
@@ -286,13 +286,13 @@ RSpec.describe Asciidoctor::Standoc do
286
286
  </version>
287
287
  <language>en</language>
288
288
  <script>Latn</script>
289
- <status format="plain">published</status>
289
+ <status><stage>published</stage></status>
290
290
  <copyright>
291
291
  <from>#{Date.today.year}</from>
292
292
  </copyright>
293
- <editorialgroup>
294
- <technical-committee/>
295
- </editorialgroup>
293
+ <ext>
294
+ <doctype>article</doctype>
295
+ </ext>
296
296
  </bibdata>
297
297
  <sections><p id="foreword">Foreword</p>
298
298
  <review reviewer="ISO" id="_" date="20170101T00:00:00Z" from="foreword" to="foreword"><p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
@@ -570,11 +570,17 @@ RSpec.describe Asciidoctor::Standoc do
570
570
 
571
571
  Amen
572
572
  ====
573
+
574
+ [example%unnumbered]
575
+ ====
576
+ This is another example
577
+ ====
573
578
  INPUT
574
579
  #{BLANK_HDR}
575
580
  <sections>
576
581
  <example id="_"><p id="_">This is an example</p>
577
582
  <p id="_">Amen</p></example>
583
+ <example id="_" unnumbered="true"><p id="_">This is another example</p></example>
578
584
  </sections>
579
585
  </standard-document>
580
586
  OUTPUT
@@ -623,13 +629,14 @@ RSpec.describe Asciidoctor::Standoc do
623
629
  it "processes images" do
624
630
  expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
625
631
  #{ASCIIDOC_BLANK_HDR}
632
+ [%unnumbered]
626
633
  .Split-it-right sample divider
627
634
  image::spec/examples/rice_images/rice_image1.png[alttext]
628
635
 
629
636
  INPUT
630
637
  #{BLANK_HDR}
631
638
  <sections>
632
- <figure id="_">
639
+ <figure id="_" unnumbered="true">
633
640
  <name>Split-it-right sample divider</name>
634
641
  <image src="spec/examples/rice_images/rice_image1.png" id="_" imagetype="PNG" height="auto" width="auto" alt="alttext"/>
635
642
  </figure>
@@ -844,7 +851,7 @@ RSpec.describe Asciidoctor::Standoc do
844
851
  it "processes recommendation" do
845
852
  input = <<~"INPUT"
846
853
  #{ASCIIDOC_BLANK_HDR}
847
- [recommendation,label="/ogc/recommendation/wfs/2",subject="user",inherit="/ss/584/2015/level/1"]
854
+ [.recommendation,label="/ogc/recommendation/wfs/2",subject="user",inherit="/ss/584/2015/level/1",options="unnumbered"]
848
855
  ====
849
856
  I recommend this
850
857
  ====
@@ -852,7 +859,7 @@ RSpec.describe Asciidoctor::Standoc do
852
859
  output = <<~"OUTPUT"
853
860
  #{BLANK_HDR}
854
861
  <sections>
855
- <recommendation id="_">
862
+ <recommendation id="_" unnumbered="true">
856
863
  <label>/ogc/recommendation/wfs/2</label>
857
864
  <subject>user</subject>
858
865
  <inherit>/ss/584/2015/level/1</inherit>
@@ -868,7 +875,7 @@ RSpec.describe Asciidoctor::Standoc do
868
875
  it "processes requirement" do
869
876
  input = <<~"INPUT"
870
877
  #{ASCIIDOC_BLANK_HDR}
871
- [requirement]
878
+ [.requirement]
872
879
  .Title
873
880
  ====
874
881
  I recommend this
@@ -890,7 +897,7 @@ RSpec.describe Asciidoctor::Standoc do
890
897
  it "processes permission" do
891
898
  input = <<~"INPUT"
892
899
  #{ASCIIDOC_BLANK_HDR}
893
- [permission]
900
+ [.permission]
894
901
  ====
895
902
  I recommend this
896
903
  ====
@@ -912,7 +919,7 @@ RSpec.describe Asciidoctor::Standoc do
912
919
  it "processes nested permissions" do
913
920
  input = <<~"INPUT"
914
921
  #{ASCIIDOC_BLANK_HDR}
915
- [permission]
922
+ [.permission]
916
923
  ====
917
924
  I permit this
918
925
 
@@ -920,7 +927,7 @@ RSpec.describe Asciidoctor::Standoc do
920
927
  Example 2
921
928
  =====
922
929
 
923
- [permission]
930
+ [.permission]
924
931
  =====
925
932
  I also permit this
926
933
  =====
@@ -946,11 +953,11 @@ RSpec.describe Asciidoctor::Standoc do
946
953
  it "processes recommendation with internal markup of structure" do
947
954
  input = <<~"INPUT"
948
955
  #{ASCIIDOC_BLANK_HDR}
949
- [recommendation,label="/ogc/recommendation/wfs/2",subject="user",classification="control-class:Technical;priority:P0;family:System and Communications Protection,System and Communications Protocols",obligation="permission,recommendation",filename="reqt1.rq"]
956
+ [.recommendation,label="/ogc/recommendation/wfs/2",subject="user",classification="control-class:Technical;priority:P0;family:System and Communications Protection,System and Communications Protocols",obligation="permission,recommendation",filename="reqt1.rq"]
950
957
  ====
951
958
  I recommend _this_.
952
959
 
953
- [specification,type="tabular"]
960
+ [.specification,type="tabular"]
954
961
  --
955
962
  This is the object of the recommendation:
956
963
  |===
@@ -961,7 +968,7 @@ RSpec.describe Asciidoctor::Standoc do
961
968
 
962
969
  As for the measurement targets,
963
970
 
964
- [measurement-target]
971
+ [.measurement-target]
965
972
  --
966
973
  The measurement target shall be measured as:
967
974
  [stem]
@@ -970,7 +977,7 @@ RSpec.describe Asciidoctor::Standoc do
970
977
  ++++
971
978
  --
972
979
 
973
- [verification]
980
+ [.verification]
974
981
  --
975
982
  The following code will be run for verification:
976
983
 
@@ -983,7 +990,7 @@ RSpec.describe Asciidoctor::Standoc do
983
990
  ----
984
991
  --
985
992
 
986
- [import%exclude]
993
+ [.import%exclude]
987
994
  --
988
995
  [source,CoreRoot]
989
996
  ----