metanorma-ogc 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,54 +1,14 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0">
3
3
  <!--
4
4
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
5
  we cannot have a new default namespace: we will end up with a grammar with two different
6
6
  namespaces, one for isostandard and one for csand additions. And we do not want that.
7
7
  -->
8
- <include href="isostandard.rng">
8
+ <include href="isodoc.rng">
9
9
  <start>
10
10
  <ref name="ogc-standard"/>
11
11
  </start>
12
- <define name="figure">
13
- <element name="figure">
14
- <attribute name="id">
15
- <data type="ID"/>
16
- </attribute>
17
- <optional>
18
- <ref name="tname"/>
19
- </optional>
20
- <choice>
21
- <ref name="image"/>
22
- <ref name="pre"/>
23
- <oneOrMore>
24
- <ref name="subfigure"/>
25
- </oneOrMore>
26
- </choice>
27
- <zeroOrMore>
28
- <ref name="fn"/>
29
- </zeroOrMore>
30
- <optional>
31
- <ref name="dl"/>
32
- </optional>
33
- <zeroOrMore>
34
- <ref name="note"/>
35
- </zeroOrMore>
36
- </element>
37
- </define>
38
- <define name="subfigure">
39
- <element name="figure">
40
- <attribute name="id">
41
- <data type="ID"/>
42
- </attribute>
43
- <optional>
44
- <ref name="tname"/>
45
- </optional>
46
- <choice>
47
- <ref name="image"/>
48
- <ref name="pre"/>
49
- </choice>
50
- </element>
51
- </define>
52
12
  <define name="DocumentType">
53
13
  <choice>
54
14
  <value>abstract-specification-topic</value>
@@ -65,6 +25,7 @@
65
25
  <value>standard</value>
66
26
  <value>user-guide</value>
67
27
  <value>white-paper</value>
28
+ <value>test-suite</value>
68
29
  </choice>
69
30
  </define>
70
31
  <define name="editorialgroup">
@@ -135,6 +96,16 @@
135
96
  </choice>
136
97
  </element>
137
98
  </define>
99
+ <define name="subcommittee">
100
+ <element name="subcommittee">
101
+ <ref name="IsoWorkgroup"/>
102
+ </element>
103
+ </define>
104
+ <define name="workgroup">
105
+ <element name="workgroup">
106
+ <ref name="IsoWorkgroup"/>
107
+ </element>
108
+ </define>
138
109
  <define name="ogc-standard">
139
110
  <element name="ogc-standard">
140
111
  <ref name="bibdata"/>
@@ -54,9 +54,9 @@
54
54
  <optional>
55
55
  <ref name="subject"/>
56
56
  </optional>
57
- <optional>
57
+ <zeroOrMore>
58
58
  <ref name="reqinherit"/>
59
- </optional>
59
+ </zeroOrMore>
60
60
  <zeroOrMore>
61
61
  <ref name="classification"/>
62
62
  </zeroOrMore>
@@ -22,6 +22,7 @@ module Asciidoctor
22
22
  end
23
23
 
24
24
  def section_validate(doc)
25
+ preface_sequence_validate(doc.root)
25
26
  sections_sequence_validate(doc.root)
26
27
  end
27
28
 
@@ -68,7 +69,8 @@ module Asciidoctor
68
69
  end
69
70
 
70
71
  def sections_sequence_validate(root)
71
- return unless STANDARDTYPE.include? root&.at("//bibdata/ext/doctype")&.text
72
+ return unless STANDARDTYPE.include?(
73
+ root&.at("//bibdata/ext/doctype")&.text)
72
74
  f = root.at("//sections").elements
73
75
  names = f.map { |s| { tag: s.name, title: s&.at("./title")&.text } }
74
76
  names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val]) || return
@@ -82,9 +84,21 @@ module Asciidoctor
82
84
  warn "OGC style: Document must contain at least one clause"
83
85
  return
84
86
  end
85
- root.at("//references | //clause[descendant::references][not(parent::clause)]") or
86
- seqcheck([{tag: "clause"}],
87
- "Normative References are mandatory", [{tag: "references"}])
87
+ root.at("//references | //clause[descendant::references]"\
88
+ "[not(parent::clause)]") or
89
+ seqcheck([{tag: "clause"}],
90
+ "Normative References are mandatory", [{tag: "references"}])
91
+ end
92
+
93
+ def preface_sequence_validate(root)
94
+ root.at("//preface/abstract") or warn "OGC style: Abstract is missing!"
95
+ root.at("//bibdata/keyword | //bibdata/ext/keyword") or
96
+ warn "OGC style: Keywords are missing!"
97
+ root.at("//foreword") or warn "OGC style: Preface is missing!"
98
+ root.at("//bibdata/contributor[role/@type = 'author']/organization/"\
99
+ "name") or
100
+ warn "OGC style: Submitting Organizations is missing!"
101
+ root.at("//submitters") or warn "OGC style: Submitters is missing!"
88
102
  end
89
103
  end
90
104
  end
@@ -22,10 +22,29 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def cleanup(docxml)
25
+ requirement_table_cleanup(docxml)
25
26
  super
26
27
  term_cleanup(docxml)
27
28
  end
28
29
 
30
+ # table nested in table: merge label and caption into a single row
31
+ def requirement_table_cleanup(docxml)
32
+ docxml.xpath("//table[@class = 'recommendclass']//table").each do |t|
33
+ x = t.at("./thead") and x.replace(x.children)
34
+ x = t.at("./tbody") and x.replace(x.children)
35
+ x = t.at("./tfoot") and x.replace(x.children)
36
+ if x = t.at("./tr/th[@colspan = '2']") and y = t.at("./tr/td[@colspan = '2']")
37
+ x["colspan"] = "1"
38
+ y["colspan"] = "1"
39
+ x.name = "td"
40
+ p = x.at("./p[@class = 'RecommendationTitle']") and p.delete("class")
41
+ x << y.dup
42
+ y.parent.remove
43
+ end
44
+ t.replace(t.children)
45
+ end
46
+ end
47
+
29
48
  def term_cleanup(docxml)
30
49
  docxml.xpath("//p[@class = 'Terms']").each do |d|
31
50
  h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
@@ -91,6 +91,39 @@
91
91
  }
92
92
  }
93
93
 
94
+ .docstage-box {
95
+ table {
96
+ width: auto;
97
+ }
98
+ th {
99
+ background-color: #93c0d6;
100
+ }
101
+ td {
102
+ vertical-align: top;
103
+ background-color: #daeef3;
104
+ padding: 0.5em;
105
+ border: 0;
106
+ }
107
+ th:first-child {
108
+ border-radius: 1em 0 0 0;
109
+ }
110
+ th:last-child {
111
+ border-radius: 0 1em 0 0;
112
+ }
113
+ tr:first-child {
114
+ border-radius: 0 0 0 1em;
115
+ }
116
+ tr:last-child {
117
+ border-radius: 0 1em 0 0;
118
+ }
119
+ tr:last-child > td:first-child {
120
+ border-radius: 0 0 0 1em;
121
+ }
122
+ tr:last-child > td:last-child {
123
+ border-radius: 0 0 1em 0;
124
+ }
125
+ }
126
+
94
127
 
95
128
  .WordSection11 {
96
129
  padding: 0 2em 0 3em;
@@ -165,6 +165,15 @@
165
165
  </div>
166
166
  {% endif %}
167
167
 
168
+ <div class="docstage-box">
169
+ <table>
170
+ <tr><th>Document type:</th><th>OGC {{doctype}}</th></tr>
171
+ <tr><td align="right">Document subtype:</td><td align="right">{{docsubtype}}</td></tr>
172
+ <tr><td align="right">Document stage:</td><td align="right">{{stage}}</td></tr>
173
+ <tr><td align="right">Document language:</td><td align="right">{{doclanguage}}</td></tr>
174
+ </table>
175
+ </div>
176
+
168
177
  <div class="info-section">
169
178
  <div class="copyright">
170
179
  <p><b>Copyright notice</b></p>
@@ -484,6 +484,11 @@ p.Biblio, p.NormRef {
484
484
  @include recommendationBlock();
485
485
  }
486
486
 
487
+ tbody td.recommend p.RecommendationTitle, tbody td.recommend p.RecommendationTitle, tbody td.recommend p.RecommendationTitle {
488
+ font-weight: normal;
489
+ text-align: left;
490
+ }
491
+
487
492
  #myBtn {
488
493
  @include toTopBtn(white, #00335b);
489
494
  }
@@ -20,7 +20,7 @@ module IsoDoc
20
20
  def default_fonts(options)
21
21
  {
22
22
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
23
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Teko",sans-serif'),
23
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
24
24
  monospacefont: '"Space Mono",monospace'
25
25
  }
26
26
  end
@@ -2,3 +2,6 @@ foreword: Preface
2
2
  recommendationtest: Recommendation Test
3
3
  requirementtest: Requirement Test
4
4
  permissiontest: Permission Test
5
+ recommendationclass: Recommendation Class
6
+ requirementclass: Requirement Class
7
+ permissionclass: Permission Class
@@ -37,7 +37,7 @@ module IsoDoc
37
37
 
38
38
  def keywords(isoxml, _out)
39
39
  keywords = []
40
- isoxml.xpath(ns("//bibdata/ext/keyword")).each do |kw|
40
+ isoxml.xpath(ns("//bibdata/keyword | //bibdata/ext/keyword")).each do |kw|
41
41
  keywords << kw.text
42
42
  end
43
43
  set(:keywords, keywords)
@@ -52,7 +52,8 @@ module IsoDoc
52
52
  revdate = get[:revdate]
53
53
  set(:revdate_monthyear, monthyr(revdate))
54
54
  set(:edition, isoxml&.at(ns("//bibdata/edition"))&.text)
55
- set(:language, ISO_639.find_by_code(isoxml&.at(ns("//bibdata/language"))&.text))
55
+ lg = ISO_639.find_by_code(isoxml&.at(ns("//bibdata/language"))&.text)
56
+ set(:doclanguage, lg ? lg[3] : "English")
56
57
  end
57
58
 
58
59
  MONTHS = {
@@ -83,7 +84,7 @@ module IsoDoc
83
84
 
84
85
  def type_capitalise(b)
85
86
  b.split(/[- ]/).map do |w|
86
- w.capitalize unless %w(SWG).include? w
87
+ %w(SWG).include?(w) ? w : w.capitalize
87
88
  end.join(" ")
88
89
  end
89
90
 
@@ -93,6 +94,10 @@ module IsoDoc
93
94
  b = isoxml&.at(ns("//bibdata/ext/docsubtype"))&.text and
94
95
  set(:docsubtype, type_capitalise(b))
95
96
  end
97
+
98
+ def status_print(status)
99
+ type_capitalise(status)
100
+ end
96
101
  end
97
102
  end
98
103
  end
@@ -18,7 +18,7 @@ module IsoDoc
18
18
  def default_fonts(options)
19
19
  {
20
20
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' : '"Overpass",sans-serif'),
21
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Teko",sans-serif'),
21
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' : '"Overpass",sans-serif'),
22
22
  monospacefont: '"Space Mono",monospace'
23
23
  }
24
24
  end
@@ -5,10 +5,15 @@ require "fileutils"
5
5
  module IsoDoc
6
6
  module Ogc
7
7
  module BaseConvert
8
+ def recommend_class(node)
9
+ return "recommendtest" if node["type"] == "verification"
10
+ return "recommendclass" if node["type"] == "class"
11
+ "recommend"
12
+ end
13
+
8
14
  def recommend_table_attr(node)
9
15
  attr_code(id: node["id"],
10
- class: node["type"] == "verification" ?
11
- "recommendtest" : "recommend",
16
+ class: recommend_class(node),
12
17
  style: "border-collapse:collapse;border-spacing:0;")
13
18
  end
14
19
 
@@ -42,11 +47,12 @@ module IsoDoc
42
47
  def recommendation_attributes1(node)
43
48
  out = []
44
49
  oblig = node["obligation"] and out << ["Obligation", oblig]
45
- subj = node&.at(ns("./subject"))&.text and out << ["Subject", subj]
50
+ subj = node&.at(ns("./subject"))&.text and
51
+ out << [node["type"] == "class" ? "Target Type" : "Subject", subj]
52
+ node.xpath(ns("./inherit")).each { |i| out << ["Dependency", i.text] }
46
53
  node.xpath(ns("./classification")).each do |c|
47
- tag = c.at(ns("./tag"))
48
- value = c.at(ns("./value"))
49
- tag && value or next
54
+ tag = c.at(ns("./tag")) or next
55
+ value = c.at(ns("./value")) or next
50
56
  out << [tag.text.capitalize, value.text]
51
57
  end
52
58
  out
@@ -113,19 +119,33 @@ module IsoDoc
113
119
  end
114
120
 
115
121
  def recommendation_parse(node, out)
116
- recommendation_parse1(node, out, node["type"] == "verification" ?
117
- @labels["recommendationtest"] :
118
- @recommendation_lbl)
122
+ label = case node["type"]
123
+ when "verification" then @labels["recommendationtest"]
124
+ when "class" then @labels["recommendationclass"]
125
+ else
126
+ @recommendation_lbl
127
+ end
128
+ recommendation_parse1(node, out, label)
119
129
  end
120
130
 
121
131
  def requirement_parse(node, out)
122
- recommendation_parse1(node, out, node["type"] == "verification" ?
123
- @labels["requirementtest"] : @requirement_lbl)
132
+ label = case node["type"]
133
+ when "verification" then @labels["requirementtest"]
134
+ when "class" then @labels["requirementclass"]
135
+ else
136
+ @requirement_lbl
137
+ end
138
+ recommendation_parse1(node, out, label)
124
139
  end
125
140
 
126
141
  def permission_parse(node, out)
127
- recommendation_parse1(node, out, node["type"] == "verification" ?
128
- @labels["permissiontest"] : @permission_lbl)
142
+ label = case node["type"]
143
+ when "verification" then @labels["permissiontest"]
144
+ when "class" then @labels["permissionclass"]
145
+ else
146
+ @permission_lbl
147
+ end
148
+ recommendation_parse1(node, out, label)
129
149
  end
130
150
 
131
151
  FIRST_LVL_REQ = IsoDoc::Function::XrefGen::FIRST_LVL_REQ
@@ -136,27 +156,29 @@ module IsoDoc
136
156
  next if t["id"].nil? || t["id"].empty?
137
157
  id = c.increment(t).print
138
158
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
139
- sequential_permission_names1(t, id, "permission[not(@type = 'verification')]", @permission_lbl)
140
- sequential_permission_names1(t, id, "requirement[not(@type = 'verification')]", @requirement_lbl)
141
- sequential_permission_names1(t, id, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
142
- sequential_permission_names1(t, id, "permission[@type = 'verification']", @labels["permissiontest"])
143
- sequential_permission_names1(t, id, "requirement[@type = 'verification']", @labels["requirementtest"])
144
- sequential_permission_names1(t, id, "recommendation[@type = 'verification']", @labels["recommendationtest"])
159
+ sequential_permission_children(t, id)
145
160
  end
146
161
  end
147
162
 
163
+ def sequential_permission_children(t, id)
164
+ sequential_permission_names1(t, id, "permission[not(@type = 'verification' or @type = 'class')]", @permission_lbl)
165
+ sequential_permission_names1(t, id, "requirement[not(@type = 'verification' or @type = 'class')]", @requirement_lbl)
166
+ sequential_permission_names1(t, id, "recommendation[not(@type = 'verification' or @type = 'class')]", @recommendation_lbl)
167
+ sequential_permission_names1(t, id, "permission[@type = 'verification']", @labels["permissiontest"])
168
+ sequential_permission_names1(t, id, "requirement[@type = 'verification']", @labels["requirementtest"])
169
+ sequential_permission_names1(t, id, "recommendation[@type = 'verification']", @labels["recommendationtest"])
170
+ sequential_permission_names1(t, id, "permission[@type = 'class']", @labels["permissionclass"])
171
+ sequential_permission_names1(t, id, "requirement[@type = 'class']", @labels["requirementclass"])
172
+ sequential_permission_names1(t, id, "recommendation[@type = 'class']", @labels["recommendationclass"])
173
+ end
174
+
148
175
  def sequential_permission_names1(block, lbl, klass, label)
149
176
  c = ::IsoDoc::Function::XrefGen::Counter.new
150
177
  block.xpath(ns("./#{klass}")).each do |t|
151
178
  next if t["id"].nil? || t["id"].empty?
152
179
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
153
180
  @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
154
- sequential_permission_names1(t, id, "permission[not(@type = 'verification')]", @permission_lbl)
155
- sequential_permission_names1(t, id, "requirement[not(@type = 'verification')]", @requirement_lbl)
156
- sequential_permission_names1(t, id, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
157
- sequential_permission_names1(t, id, "permission[@type = 'verification']", @labels["permissiontest"])
158
- sequential_permission_names1(t, id, "requirement[@type = 'verification']", @labels["requirementtest"])
159
- sequential_permission_names1(t, id, "recommendation[@type = 'verification']", @labels["recommendationtest"])
181
+ sequential_permission_children(t, id)
160
182
  end
161
183
  end
162
184
 
@@ -164,24 +186,30 @@ module IsoDoc
164
186
  sequential_table_names(clause)
165
187
  sequential_figure_names(clause)
166
188
  sequential_formula_names(clause)
167
- sequential_permission_names(clause, "permission[not(@type = 'verification')]", @permission_lbl)
168
- sequential_permission_names(clause, "requirement[not(@type = 'verification')]", @requirement_lbl)
169
- sequential_permission_names(clause, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
189
+ sequential_permission_names(clause, "permission[not(@type = 'verification' or @type = 'class')]", @permission_lbl)
190
+ sequential_permission_names(clause, "requirement[not(@type = 'verification' or @type = 'class')]", @requirement_lbl)
191
+ sequential_permission_names(clause, "recommendation[not(@type = 'verification' or @type = 'class')]", @recommendation_lbl)
170
192
  sequential_permission_names(clause, "permission[@type = 'verification']", @labels["permissiontest"])
171
193
  sequential_permission_names(clause, "requirement[@type = 'verification']", @labels["requirementtest"])
172
194
  sequential_permission_names(clause, "recommendation[@type = 'verification']", @labels["recommendationtest"])
195
+ sequential_permission_names(clause, "permission[@type = 'class']", @labels["permissionclass"])
196
+ sequential_permission_names(clause, "requirement[@type = 'class']", @labels["requirementclass"])
197
+ sequential_permission_names(clause, "recommendation[@type = 'class']", @labels["recommendationclass"])
173
198
  end
174
199
 
175
200
  def hierarchical_asset_names(clause, num)
176
201
  hierarchical_table_names(clause, num)
177
202
  hierarchical_figure_names(clause, num)
178
203
  hierarchical_formula_names(clause, num)
179
- hierarchical_permission_names(clause, num, "permission[not(@type = 'verification')]", @permission_lbl)
180
- hierarchical_permission_names(clause, num, "requirement[not(@type = 'verification')]", @requirement_lbl)
181
- hierarchical_permission_names(clause, num, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
204
+ hierarchical_permission_names(clause, num, "permission[not(@type = 'verification' or @type = 'class')]", @permission_lbl)
205
+ hierarchical_permission_names(clause, num, "requirement[not(@type = 'verification' or @type = 'class')]", @requirement_lbl)
206
+ hierarchical_permission_names(clause, num, "recommendation[not(@type = 'verification' or @type = 'class')]", @recommendation_lbl)
182
207
  hierarchical_permission_names(clause, num, "permission[@type = 'verification']", @labels["permissiontest"])
183
208
  hierarchical_permission_names(clause, num, "requirement[@type = 'verification']", @labels["requirementtest"])
184
209
  hierarchical_permission_names(clause, num, "recommendation[@type = 'verification']", @labels["recommendationtest"])
210
+ hierarchical_permission_names(clause, num, "permission[@type = 'class']", @labels["permissionclass"])
211
+ hierarchical_permission_names(clause, num, "requirement[@type = 'class']", @labels["requirementclass"])
212
+ hierarchical_permission_names(clause, num, "recommendation[@type = 'class']", @labels["recommendationclass"])
185
213
  end
186
214
 
187
215
  def hierarchical_permission_names(clause, num, klass, label)
@@ -190,12 +218,7 @@ module IsoDoc
190
218
  next if t["id"].nil? || t["id"].empty?
191
219
  lbl = "#{num}#{hiersep}#{c.increment(t).print}"
192
220
  @anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
193
- sequential_permission_names1(t, lbl, "permission[not(@type = 'verification')]", @permission_lbl)
194
- sequential_permission_names1(t, lbl, "requirement[not(@type = 'verification')]", @requirement_lbl)
195
- sequential_permission_names1(t, lbl, "recommendation[not(@type = 'verification')]", @recommendation_lbl)
196
- sequential_permission_names1(t, lbl, "permission[@type = 'verification']", @labels["permissiontest"])
197
- sequential_permission_names1(t, lbl, "requirement[@type = 'verification']", @labels["requirementtest"])
198
- sequential_permission_names1(t, lbl, "recommendation[@type = 'verification']", @labels["recommendationtest"])
221
+ sequential_permission_children(t, lbl)
199
222
  end
200
223
  end
201
224
  end