metanorma-ogc 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c479fe29661043d57d71fe5685ac2896c5ecc2ec2813a6ba0a7447001e267c0f
4
- data.tar.gz: 6566850cc12d813e37b340a257be263e0da139684242e4afff42610a146e8317
3
+ metadata.gz: d8872bbdfe76dfa704c1e0f7d6755e8f5d6bbbb8c4a78c302c0ef756fab1169a
4
+ data.tar.gz: 0ab8e41ffd1d323f979f99cf61ca72bc5dd61902dce02a7a8a152d0df2f97f0d
5
5
  SHA512:
6
- metadata.gz: 203e38a7f20a0cccb389c3298dfdd6bb455c0c9f09bb54531c14d3cf77b478e8a86e0e1737e6d9ff7c208256fb935ba4cce83d7046a2e8a61361e9a953be7d11
7
- data.tar.gz: 4e5cc582d36eb993928dec698abdafeb4fed9ee1aee7124f1459ca4a10c5988017060f2cd1cf95e233f467c4c9077384f2b0061eb2b8581d4a0a679bffad3bdd
6
+ metadata.gz: 770e6d7e6c8342dd88a95813a102d50fdf5e6226f493630184f5802ef941331331f22ceb37c85e41e08f3d7b13aa83dcab1aec838014bb2381fbab6b7511cf07
7
+ data.tar.gz: 7c8666c9b37cfd75ca791679dcdf9fc808d60b6eebf39af5d6969cc8ef5cdacecb7da7f02b6b5b8a81c5035890597fdd22de4d695c434cd6bef5c860b7c88e77
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
3
  language: ruby
2
4
  cache: bundler
3
5
  os:
@@ -6,11 +8,11 @@ os:
6
8
  rvm:
7
9
  - 2.5
8
10
  - 2.4
9
- - 2.3
10
11
  - ruby-head
11
- before_install:
12
+ before_install:
12
13
  - nvm install 8
13
14
  - npm install -g puppeteer
15
+ - npm install
14
16
  - gem install bundler -v 2.0.1
15
17
  - bundle update
16
18
  matrix:
data/appveyor.yml CHANGED
@@ -1,10 +1,14 @@
1
+ # Auto-generated !!! Do not edit it manually
2
+ # use ci-master https://github.com/metanorma/metanorma-build-scripts
1
3
  version: '{build}'
2
4
 
5
+ cache:
6
+ - vendor/bundle
7
+
3
8
  environment:
4
9
  matrix:
5
10
  - RUBY_VERSION: 25
6
11
  - RUBY_VERSION: 24
7
- - RUBY_VERSION: 23
8
12
  - RUBY_VERSION: _trunk
9
13
 
10
14
  matrix:
@@ -17,6 +21,8 @@ install:
17
21
 
18
22
  build_script:
19
23
  - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
24
+ - set GIT_TERMINAL_PROMPT=0
25
+ - bundle config --local path vendor/bundle
20
26
  - bundle update
21
27
  - bundle install
22
28
 
@@ -27,4 +33,3 @@ before_test:
27
33
 
28
34
  test_script:
29
35
  - bundle exec rake
30
-
@@ -35,7 +35,28 @@
35
35
  </define>
36
36
  <define name="status">
37
37
  <element name="status">
38
- <ref name="LocalizedString"/>
38
+ <ref name="stage"/>
39
+ <optional>
40
+ <ref name="substage"/>
41
+ </optional>
42
+ <optional>
43
+ <ref name="iteration"/>
44
+ </optional>
45
+ </element>
46
+ </define>
47
+ <define name="stage">
48
+ <element name="stage">
49
+ <text/>
50
+ </element>
51
+ </define>
52
+ <define name="substage">
53
+ <element name="substage">
54
+ <text/>
55
+ </element>
56
+ </define>
57
+ <define name="iteration">
58
+ <element name="iteration">
59
+ <text/>
39
60
  </element>
40
61
  </define>
41
62
  <define name="language">
@@ -523,9 +544,9 @@
523
544
  <zeroOrMore>
524
545
  <ref name="script"/>
525
546
  </zeroOrMore>
526
- <optional>
547
+ <zeroOrMore>
527
548
  <ref name="abstract"/>
528
- </optional>
549
+ </zeroOrMore>
529
550
  <optional>
530
551
  <ref name="status"/>
531
552
  </optional>
@@ -810,6 +831,9 @@
810
831
  </define>
811
832
  <define name="biblionote">
812
833
  <element name="note">
834
+ <optional>
835
+ <attribute name="type"/>
836
+ </optional>
813
837
  <ref name="FormattedString"/>
814
838
  </element>
815
839
  </define>
@@ -2,6 +2,7 @@ require "asciidoctor"
2
2
  require "asciidoctor/standoc/converter"
3
3
  require "fileutils"
4
4
  require_relative "front"
5
+ require_relative "validate"
5
6
 
6
7
  module Asciidoctor
7
8
  module Ogc
@@ -17,10 +18,6 @@ module Asciidoctor
17
18
  def toc(value)
18
19
  end
19
20
 
20
- def title_validate(root)
21
- nil
22
- end
23
-
24
21
  def makexml(node)
25
22
  result = ["<?xml version='1.0' encoding='UTF-8'?>\n<ogc-standard>"]
26
23
  @draft = node.attributes.has_key?("draft")
@@ -68,72 +65,6 @@ module Asciidoctor
68
65
  File.join(File.dirname(__FILE__), "ogc.rng"))
69
66
  end
70
67
 
71
- def section_validate(doc)
72
- sections_sequence_validate(doc.root)
73
- end
74
-
75
- STANDARDTYPE = %w{standard standard-with-suite abstract-specification
76
- community-standard profile}.freeze
77
-
78
- # spec of permissible section sequence
79
- # we skip normative references, it goes to end of list
80
- SEQ =
81
- [
82
- {
83
- msg: "Prefatory material must be followed by (clause) Scope",
84
- val: [{ tag: "clause", title: "Scope" }],
85
- },
86
- {
87
- msg: "Scope must be followed by Conformance",
88
- val: [{ tag: "clause", title: "Conformance" }],
89
- },
90
- {
91
- msg: "Normative References must be followed by "\
92
- "Terms and Definitions",
93
- val: [
94
- { tag: "terms", title: "Terms and definitions" },
95
- { tag: "clause", title: "Terms and definitions" },
96
- {
97
- tag: "terms",
98
- title: "Terms, definitions, symbols and abbreviated terms",
99
- },
100
- {
101
- tag: "clause",
102
- title: "Terms, definitions, symbols and abbreviated terms",
103
- },
104
- ],
105
- },
106
- ].freeze
107
-
108
- def seqcheck(names, msg, accepted)
109
- n = names.shift
110
- unless accepted.include? n
111
- warn "OGC style: #{msg}"
112
- names = []
113
- end
114
- names
115
- end
116
-
117
- def sections_sequence_validate(root)
118
- return unless STANDARDTYPE.include? root&.at("//bibdata/@type")&.text
119
- f = root.at("//sections").elements
120
- names = f.map { |s| { tag: s.name, title: s&.at("./title")&.text } }
121
- names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val]) || return
122
- names = seqcheck(names, SEQ[1][:msg], SEQ[1][:val]) || return
123
- names = seqcheck(names, SEQ[2][:msg], SEQ[2][:val]) || return
124
- n = names.shift
125
- if !n.nil? && n[:tag] == "definitions"
126
- n = names.shift
127
- end
128
- unless n
129
- warn "OGC style: Document must contain at least one clause"
130
- return
131
- end
132
- root.at("//references | //clause[descendant::references][not(parent::clause)]") or
133
- seqcheck([{tag: "clause"}],
134
- "Normative References are mandatory", [{tag: "references"}])
135
- end
136
-
137
68
  def sections_cleanup(x)
138
69
  super
139
70
  x.xpath("//*[@inline-header]").each do |h|
@@ -77,6 +77,7 @@ module Asciidoctor
77
77
  end
78
78
 
79
79
  def metadata_committee(node, xml)
80
+ return unless node.attr("committee")
80
81
  xml.editorialgroup do |a|
81
82
  a.committee(node.attr("committee") || "technical")
82
83
  node.attr("subcommittee") and
@@ -90,11 +91,6 @@ module Asciidoctor
90
91
  end
91
92
  end
92
93
 
93
- def metadata_status(node, xml)
94
- status = node.attr("status") || "published"
95
- xml.status(**{ format: "plain" }) { |s| s << status }
96
- end
97
-
98
94
  def metadata_id(node, xml)
99
95
  node.attr("external-id") and
100
96
  xml.docidentifier node.attr("external-id"), **{ type: "ogc-external" }
@@ -154,8 +150,9 @@ module Asciidoctor
154
150
  end
155
151
  end
156
152
 
157
- def metadata(node, xml)
158
- super
153
+ def metadata_ext(node, xml)
154
+ metadata_doctype(node, xml)
155
+ metadata_committee(node, xml)
159
156
  metadata_keywords(node, xml)
160
157
  end
161
158
  end
@@ -19,27 +19,16 @@
19
19
  -->
20
20
  <grammar 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>
40
26
  <define name="standard-document">
41
27
  <element name="standard-document">
42
28
  <ref name="bibdata"/>
29
+ <optional>
30
+ <ref name="boilerplate"/>
31
+ </optional>
43
32
  <optional>
44
33
  <ref name="preface"/>
45
34
  </optional>
@@ -64,6 +53,42 @@
64
53
  </oneOrMore>
65
54
  </element>
66
55
  </define>
56
+ <define name="boilerplate">
57
+ <element name="boilerplate">
58
+ <optional>
59
+ <ref name="copyright-statement"/>
60
+ </optional>
61
+ <optional>
62
+ <ref name="license-statement"/>
63
+ </optional>
64
+ <optional>
65
+ <ref name="legal-statement"/>
66
+ </optional>
67
+ <optional>
68
+ <ref name="feedback-statement"/>
69
+ </optional>
70
+ </element>
71
+ </define>
72
+ <define name="copyright-statement">
73
+ <element name="copyright-statement">
74
+ <ref name="Content-Section"/>
75
+ </element>
76
+ </define>
77
+ <define name="license-statement">
78
+ <element name="license-statement">
79
+ <ref name="Content-Section"/>
80
+ </element>
81
+ </define>
82
+ <define name="legal-statement">
83
+ <element name="legal-statement">
84
+ <ref name="Content-Section"/>
85
+ </element>
86
+ </define>
87
+ <define name="feedback-statement">
88
+ <element name="feedback-statement">
89
+ <ref name="Content-Section"/>
90
+ </element>
91
+ </define>
67
92
  <define name="sections">
68
93
  <element name="sections">
69
94
  <oneOrMore>
@@ -446,6 +471,11 @@
446
471
  <attribute name="id">
447
472
  <data type="ID"/>
448
473
  </attribute>
474
+ <optional>
475
+ <attribute name="unnumbered">
476
+ <data type="boolean"/>
477
+ </attribute>
478
+ </optional>
449
479
  <ref name="stem"/>
450
480
  <optional>
451
481
  <ref name="dl"/>
@@ -494,6 +524,11 @@
494
524
  <attribute name="id">
495
525
  <data type="ID"/>
496
526
  </attribute>
527
+ <optional>
528
+ <attribute name="unnumbered">
529
+ <data type="boolean"/>
530
+ </attribute>
531
+ </optional>
497
532
  <optional>
498
533
  <attribute name="lang"/>
499
534
  </optional>
@@ -533,6 +568,14 @@
533
568
  <attribute name="id">
534
569
  <data type="ID"/>
535
570
  </attribute>
571
+ <optional>
572
+ <attribute name="unnumbered">
573
+ <data type="boolean"/>
574
+ </attribute>
575
+ </optional>
576
+ <optional>
577
+ <attribute name="alt"/>
578
+ </optional>
536
579
  <optional>
537
580
  <ref name="tname"/>
538
581
  </optional>
@@ -647,6 +690,11 @@
647
690
  <attribute name="id">
648
691
  <data type="ID"/>
649
692
  </attribute>
693
+ <optional>
694
+ <attribute name="unnumbered">
695
+ <data type="boolean"/>
696
+ </attribute>
697
+ </optional>
650
698
  <oneOrMore>
651
699
  <choice>
652
700
  <ref name="formula"/>
@@ -690,6 +738,11 @@
690
738
  <attribute name="id">
691
739
  <data type="ID"/>
692
740
  </attribute>
741
+ <optional>
742
+ <attribute name="unnumbered">
743
+ <data type="boolean"/>
744
+ </attribute>
745
+ </optional>
693
746
  <optional>
694
747
  <ref name="source"/>
695
748
  </optional>
@@ -735,6 +788,20 @@
735
788
  <ref name="bookmark"/>
736
789
  </choice>
737
790
  </define>
791
+ <define name="PureTextElement">
792
+ <choice>
793
+ <text/>
794
+ <ref name="em"/>
795
+ <ref name="strong"/>
796
+ <ref name="sub"/>
797
+ <ref name="sup"/>
798
+ <ref name="tt"/>
799
+ <ref name="keyword"/>
800
+ <ref name="strike"/>
801
+ <ref name="smallcap"/>
802
+ <ref name="br"/>
803
+ </choice>
804
+ </define>
738
805
  <define name="source">
739
806
  <element name="source">
740
807
  <ref name="TypedUri"/>
@@ -742,42 +809,58 @@
742
809
  </define>
743
810
  <define name="em">
744
811
  <element name="em">
745
- <text/>
812
+ <zeroOrMore>
813
+ <ref name="PureTextElement"/>
814
+ </zeroOrMore>
746
815
  </element>
747
816
  </define>
748
817
  <define name="strong">
749
818
  <element name="strong">
750
- <text/>
819
+ <zeroOrMore>
820
+ <ref name="PureTextElement"/>
821
+ </zeroOrMore>
751
822
  </element>
752
823
  </define>
753
824
  <define name="tt">
754
825
  <element name="tt">
755
- <text/>
826
+ <zeroOrMore>
827
+ <ref name="PureTextElement"/>
828
+ </zeroOrMore>
756
829
  </element>
757
830
  </define>
758
831
  <define name="keyword">
759
832
  <element name="keyword">
760
- <text/>
833
+ <zeroOrMore>
834
+ <ref name="PureTextElement"/>
835
+ </zeroOrMore>
761
836
  </element>
762
837
  </define>
763
838
  <define name="sub">
764
839
  <element name="sub">
765
- <text/>
840
+ <zeroOrMore>
841
+ <ref name="PureTextElement"/>
842
+ </zeroOrMore>
766
843
  </element>
767
844
  </define>
768
845
  <define name="sup">
769
846
  <element name="sup">
770
- <text/>
847
+ <zeroOrMore>
848
+ <ref name="PureTextElement"/>
849
+ </zeroOrMore>
771
850
  </element>
772
851
  </define>
773
852
  <define name="strike">
774
853
  <element name="strike">
775
- <text/>
854
+ <zeroOrMore>
855
+ <ref name="PureTextElement"/>
856
+ </zeroOrMore>
776
857
  </element>
777
858
  </define>
778
859
  <define name="smallcap">
779
860
  <element name="smallcap">
780
- <text/>
861
+ <zeroOrMore>
862
+ <ref name="PureTextElement"/>
863
+ </zeroOrMore>
781
864
  </element>
782
865
  </define>
783
866
  <define name="br">
@@ -838,6 +921,9 @@
838
921
  <attribute name="type">
839
922
  <ref name="ReferenceFormat"/>
840
923
  </attribute>
924
+ <optional>
925
+ <attribute name="alt"/>
926
+ </optional>
841
927
  <text/>
842
928
  </element>
843
929
  </define>
@@ -1019,57 +1105,28 @@
1019
1105
  </zeroOrMore>
1020
1106
  </element>
1021
1107
  </define>
1022
- <define name="BibData">
1023
- <optional>
1024
- <attribute name="type">
1025
- <ref name="BibItemType"/>
1026
- </attribute>
1027
- </optional>
1028
- <oneOrMore>
1029
- <ref name="btitle"/>
1030
- </oneOrMore>
1031
- <optional>
1032
- <ref name="formattedref"/>
1033
- </optional>
1034
- <zeroOrMore>
1035
- <ref name="bsource"/>
1036
- </zeroOrMore>
1037
- <zeroOrMore>
1038
- <ref name="docidentifier"/>
1039
- </zeroOrMore>
1040
- <optional>
1041
- <ref name="docnumber"/>
1042
- </optional>
1043
- <zeroOrMore>
1044
- <ref name="bdate"/>
1045
- </zeroOrMore>
1046
- <zeroOrMore>
1047
- <ref name="contributor"/>
1048
- </zeroOrMore>
1049
- <optional>
1050
- <ref name="edition"/>
1051
- </optional>
1052
- <optional>
1053
- <ref name="version"/>
1054
- </optional>
1055
- <zeroOrMore>
1056
- <ref name="biblionote"/>
1057
- </zeroOrMore>
1058
- <zeroOrMore>
1059
- <ref name="language"/>
1060
- </zeroOrMore>
1061
- <zeroOrMore>
1062
- <ref name="script"/>
1063
- </zeroOrMore>
1108
+ <define name="ext">
1109
+ <element name="ext">
1110
+ <ref name="BibDataExtensionType"/>
1111
+ </element>
1112
+ </define>
1113
+ <define name="BibDataExtensionType">
1064
1114
  <optional>
1065
- <ref name="abstract"/>
1115
+ <ref name="doctype"/>
1066
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"/>
1067
1128
  <optional>
1068
- <ref name="status"/>
1129
+ <ref name="ext"/>
1069
1130
  </optional>
1070
- <ref name="copyright"/>
1071
- <zeroOrMore>
1072
- <ref name="docrelation"/>
1073
- </zeroOrMore>
1074
1131
  </define>
1075
1132
  </grammar>