metanorma-ogc 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -92,6 +92,12 @@
92
92
  <data type="ID"/>
93
93
  </attribute>
94
94
  </optional>
95
+ <optional>
96
+ <attribute name="language"/>
97
+ </optional>
98
+ <optional>
99
+ <attribute name="script"/>
100
+ </optional>
95
101
  <optional>
96
102
  <attribute name="obligation">
97
103
  <choice>
@@ -118,6 +124,12 @@
118
124
  <data type="ID"/>
119
125
  </attribute>
120
126
  </optional>
127
+ <optional>
128
+ <attribute name="language"/>
129
+ </optional>
130
+ <optional>
131
+ <attribute name="script"/>
132
+ </optional>
121
133
  <optional>
122
134
  <attribute name="obligation">
123
135
  <choice>
@@ -149,6 +161,12 @@
149
161
  <data type="ID"/>
150
162
  </attribute>
151
163
  </optional>
164
+ <optional>
165
+ <attribute name="language"/>
166
+ </optional>
167
+ <optional>
168
+ <attribute name="script"/>
169
+ </optional>
152
170
  <optional>
153
171
  <attribute name="inline-header">
154
172
  <data type="boolean"/>
@@ -212,6 +230,12 @@
212
230
  <data type="ID"/>
213
231
  </attribute>
214
232
  </optional>
233
+ <optional>
234
+ <attribute name="language"/>
235
+ </optional>
236
+ <optional>
237
+ <attribute name="script"/>
238
+ </optional>
215
239
  <optional>
216
240
  <attribute name="obligation">
217
241
  <choice>
@@ -230,6 +254,12 @@
230
254
  <data type="ID"/>
231
255
  </attribute>
232
256
  </optional>
257
+ <optional>
258
+ <attribute name="language"/>
259
+ </optional>
260
+ <optional>
261
+ <attribute name="script"/>
262
+ </optional>
233
263
  <optional>
234
264
  <attribute name="obligation">
235
265
  <choice>
@@ -303,6 +333,12 @@
303
333
  <data type="ID"/>
304
334
  </attribute>
305
335
  </optional>
336
+ <optional>
337
+ <attribute name="language"/>
338
+ </optional>
339
+ <optional>
340
+ <attribute name="script"/>
341
+ </optional>
306
342
  <optional>
307
343
  <attribute name="inline-header">
308
344
  <data type="boolean"/>
@@ -525,6 +561,29 @@
525
561
  <value>guide</value>
526
562
  </choice>
527
563
  </define>
564
+ <define name="structuredidentifier">
565
+ <element name="structuredidentifier">
566
+ <optional>
567
+ <attribute name="type"/>
568
+ </optional>
569
+ <group>
570
+ <ref name="documentnumber"/>
571
+ <optional>
572
+ <ref name="tc-documentnumber"/>
573
+ </optional>
574
+ </group>
575
+ </element>
576
+ </define>
577
+ <define name="foreword">
578
+ <element name="foreword">
579
+ <ref name="Basic-Section"/>
580
+ </element>
581
+ </define>
582
+ <define name="introduction">
583
+ <element name="introduction">
584
+ <ref name="Content-Section"/>
585
+ </element>
586
+ </define>
528
587
  </include>
529
588
  <!-- end overrides -->
530
589
  <!--
@@ -581,29 +640,6 @@
581
640
  <ref name="Basic-Section"/>
582
641
  </element>
583
642
  </define>
584
- <define name="foreword">
585
- <element name="foreword">
586
- <ref name="Basic-Section"/>
587
- </element>
588
- </define>
589
- <define name="introduction">
590
- <element name="introduction">
591
- <ref name="Content-Section"/>
592
- </element>
593
- </define>
594
- <define name="structuredidentifier">
595
- <element name="structuredidentifier">
596
- <optional>
597
- <attribute name="type"/>
598
- </optional>
599
- <group>
600
- <ref name="documentnumber"/>
601
- <optional>
602
- <ref name="tc-documentnumber"/>
603
- </optional>
604
- </group>
605
- </element>
606
- </define>
607
643
  <define name="documentnumber">
608
644
  <element name="project-number">
609
645
  <optional>
@@ -662,6 +698,12 @@
662
698
  <data type="ID"/>
663
699
  </attribute>
664
700
  </optional>
701
+ <optional>
702
+ <attribute name="language"/>
703
+ </optional>
704
+ <optional>
705
+ <attribute name="script"/>
706
+ </optional>
665
707
  <optional>
666
708
  <attribute name="inline-header">
667
709
  <data type="boolean"/>
@@ -723,6 +765,12 @@
723
765
  <data type="ID"/>
724
766
  </attribute>
725
767
  </optional>
768
+ <optional>
769
+ <attribute name="language"/>
770
+ </optional>
771
+ <optional>
772
+ <attribute name="script"/>
773
+ </optional>
726
774
  <optional>
727
775
  <attribute name="inline-header">
728
776
  <data type="boolean"/>
@@ -755,6 +803,12 @@
755
803
  <data type="ID"/>
756
804
  </attribute>
757
805
  </optional>
806
+ <optional>
807
+ <attribute name="language"/>
808
+ </optional>
809
+ <optional>
810
+ <attribute name="script"/>
811
+ </optional>
758
812
  <optional>
759
813
  <attribute name="inline-header">
760
814
  <data type="boolean"/>
@@ -1,5 +1,7 @@
1
1
  require "isodoc"
2
2
  require_relative "metadata"
3
+ require_relative "reqt"
4
+ require_relative "biblio"
3
5
  require "fileutils"
4
6
 
5
7
  module IsoDoc
@@ -61,8 +63,10 @@ module IsoDoc
61
63
  kw.empty? and return
62
64
  @prefacenum += 1
63
65
  out.div **{ class: "Section3" } do |div|
64
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Keywords", div, class: "IntroTitle")
65
- div.p "The following are keywords to be used by search engines and document catalogues."
66
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
67
+ "Keywords", div, class: "IntroTitle")
68
+ div.p "The following are keywords to be used by search engines and "\
69
+ "document catalogues."
66
70
  div.p kw.join(", ")
67
71
  end
68
72
  end
@@ -76,12 +80,12 @@ module IsoDoc
76
80
  return if orgs.empty?
77
81
  @prefacenum += 1
78
82
  out.div **{ class: "Section3" } do |div|
79
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Submitting Organizations", div, class: "IntroTitle")
80
- div.p "The following organizations submitted this Document to the Open Geospatial Consortium (OGC):"
83
+ clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
84
+ "Submitting Organizations", div, class: "IntroTitle")
85
+ div.p "The following organizations submitted this Document to the "\
86
+ "Open Geospatial Consortium (OGC):"
81
87
  div.ul do |ul|
82
- orgs.each do |org|
83
- ul.li org
84
- end
88
+ orgs.each { |org| ul.li org }
85
89
  end
86
90
  end
87
91
  end
@@ -89,7 +93,8 @@ module IsoDoc
89
93
  def submitters(docxml, out)
90
94
  f = docxml.at(ns("//submitters")) || return
91
95
  out.div **{ class: "Section3" } do |div|
92
- clause_name(anchor(f['id'], :label), "Submitters", div, class: "IntroTitle")
96
+ clause_name(anchor(f['id'], :label), "Submitters", div,
97
+ class: "IntroTitle")
93
98
  f.elements.each { |e| parse(e, div) unless e.name == "title" }
94
99
  end
95
100
  end
@@ -100,7 +105,8 @@ module IsoDoc
100
105
  @anchors[clause["id"]] =
101
106
  { label: RomanNumerals.to_roman(@prefacenum).downcase,
102
107
  level: 1, xref: preface_clause_name(clause), type: "clause" }
103
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each_with_index do |c, i|
108
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).
109
+ each_with_index do |c, i|
104
110
  section_names1(c, "#{@prefacenum}.#{i + 1}", 2)
105
111
  end
106
112
  end
@@ -110,7 +116,8 @@ module IsoDoc
110
116
  @prefacenum += 1
111
117
  page_break(out)
112
118
  out.div **attr_code(id: f["id"]) do |s|
113
- clause_name(anchor(f["id"], :label), @abstract_lbl, s, class: "AbstractTitle")
119
+ clause_name(anchor(f["id"], :label), @abstract_lbl, s,
120
+ class: "AbstractTitle")
114
121
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
115
122
  end
116
123
  end
@@ -120,7 +127,8 @@ module IsoDoc
120
127
  @prefacenum += 1
121
128
  page_break(out)
122
129
  out.div **attr_code(id: f["id"]) do |s|
123
- clause_name(anchor(f["id"], :label), @foreword_lbl, s, class: "ForewordTitle")
130
+ clause_name(anchor(f["id"], :label), @foreword_lbl, s,
131
+ class: "ForewordTitle")
124
132
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
125
133
  end
126
134
  end
@@ -131,136 +139,6 @@ module IsoDoc
131
139
  super
132
140
  end
133
141
 
134
- def error_parse(node, out)
135
- case node.name
136
- when "recommendation" then recommendation_parse(node, out)
137
- when "requirement" then requirement_parse(node, out)
138
- when "permission" then permission_parse(node, out)
139
- else
140
- super
141
- end
142
- end
143
-
144
- def anchor_names(docxml)
145
- super
146
- recommendation_anchor_names(docxml)
147
- requirement_anchor_names(docxml)
148
- permission_anchor_names(docxml)
149
- end
150
-
151
- def recommendation_anchor_names(docxml)
152
- i = 0
153
- docxml.xpath(ns("//recommendation")).each do |x|
154
- next if x["id"].nil? || x["id"].empty?
155
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Recommendation", "recommendation", x["unnumbered"])
156
- i += 1 unless x["unnumbered"]
157
- end
158
- end
159
-
160
- def requirement_anchor_names(docxml)
161
- i = 0
162
- docxml.xpath(ns("//requirement")).each_with_index do |x|
163
- next if x["id"].nil? || x["id"].empty?
164
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Requirement", "requirement", x["unnumbered"])
165
- i += 1 unless x["unnumbered"]
166
- end
167
- end
168
-
169
- def permission_anchor_names(docxml)
170
- i = 0
171
- docxml.xpath(ns("//permission")).each do |x|
172
- next if x["id"].nil? || x["id"].empty?
173
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Permission", "permission", x["unnumbered"])
174
- i += 1 unless x["unnumbered"]
175
- end
176
- end
177
-
178
- def recommend_table_attr(node)
179
- attr_code(id: node["id"], class: "recommend",
180
- cellspacing: 0, cellpadding: 0,
181
- style: "border-collapse:collapse" )
182
- end
183
-
184
- REQ_TBL_ATTR =
185
- { valign: "top", class: "example_label",
186
- style: "width:100.0pt;padding:0 0 0 1em;margin-left:0pt" }.freeze
187
-
188
- def recommend_name_parse(node, div)
189
- name = node&.at(ns("./name"))&.text or return
190
- div.p do |p|
191
- p.b name
192
- end
193
- end
194
-
195
- def recommendation_parse(node, out)
196
- out.table **recommend_table_attr(node) do |t|
197
- t.tr do |tr|
198
- tr.td **REQ_TBL_ATTR do |td|
199
- recommendation_label(node, td)
200
- end
201
- tr.td **{ valign: "top", class: "recommend" } do |td|
202
- recommend_name_parse(node, td)
203
- node.children.each { |n| parse(n, td) unless n.name == "name" }
204
- end
205
- end
206
- end
207
- end
208
-
209
- def recommendation_label(node, out)
210
- n = get_anchors[node["id"]]
211
- label = (n.nil? || n[:label].nil? || n[:label].empty?) ?
212
- "Recommendation" : l10n("#{"Recommendation"} #{n[:label]}")
213
- out.p **{class: "RecommendationTitle" } do |p|
214
- p << label
215
- end
216
- end
217
-
218
- def requirement_parse(node, out)
219
- out.table **recommend_table_attr(node) do |t|
220
- t.tr do |tr|
221
- tr.td **REQ_TBL_ATTR do |td|
222
- requirement_label(node, td)
223
- end
224
- tr.td **{ valign: "top", class: "recommend" } do |td|
225
- recommend_name_parse(node, td)
226
- node.children.each { |n| parse(n, td) unless n.name == "name" }
227
- end
228
- end
229
- end
230
- end
231
-
232
- def requirement_label(node, out)
233
- n = get_anchors[node["id"]]
234
- label = (n.nil? || n[:label].nil? || n[:label].empty?) ?
235
- "Requirement" : l10n("#{"Requirement"} #{n[:label]}")
236
- out.p **{class: "RecommendationTitle" } do |p|
237
- p << label
238
- end
239
- end
240
-
241
- def permission_parse(node, out)
242
- out.table **recommend_table_attr(node) do |t|
243
- t.tr do |tr|
244
- tr.td **REQ_TBL_ATTR do |td|
245
- permission_label(node, td)
246
- end
247
- tr.td **{ valign: "top", class: "recommend" } do |td|
248
- recommend_name_parse(node, td)
249
- node.children.each { |n| parse(n, td) unless n.name == "name" }
250
- end
251
- end
252
- end
253
- end
254
-
255
- def permission_label(node, out)
256
- n = get_anchors[node["id"]]
257
- label = (n.nil? || n[:label].nil? || n[:label].empty?) ?
258
- "Permission" : l10n("#{"Permission"} #{n[:label]}")
259
- out.p **{class: "RecommendationTitle" } do |p|
260
- p << label
261
- end
262
- end
263
-
264
142
  def initial_anchor_names(d)
265
143
  @prefacenum = 0
266
144
  preface_names(d.at(ns("//preface/abstract")))
@@ -269,11 +147,13 @@ module IsoDoc
269
147
  preface_names(d.at(ns("//introduction")))
270
148
  @prefacenum += 1 if d.at(ns(SUBMITTINGORGS))
271
149
  preface_names(d.at(ns("//submitters")))
272
- sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | //introduction | //submitters")))
150
+ sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | "\
151
+ "//introduction | //submitters")))
273
152
  n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
274
153
  n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
275
154
  n = section_names(d.at(ns(
276
- "//references[title = 'Normative References' or title = 'Normative references']")), n, 1)
155
+ "//references[title = 'Normative References' or "\
156
+ "title = 'Normative references']")), n, 1)
277
157
  n = section_names(d.at(ns("//sections/terms | "\
278
158
  "//sections/clause[descendant::terms]")), n, 1)
279
159
  n = section_names(d.at(ns("//sections/definitions")), n, 1)
@@ -284,26 +164,19 @@ module IsoDoc
284
164
  end
285
165
 
286
166
  MIDDLE_CLAUSE =
287
- "//clause[parent::sections][not(xmlns:title = 'Scope' or xmlns:title = 'Conformance')]"\
288
- "[not(descendant::terms)]".freeze
167
+ "//clause[parent::sections][not(xmlns:title = 'Scope' or "\
168
+ "xmlns:title = 'Conformance')][not(descendant::terms)]".freeze
289
169
 
290
170
  def middle_section_asset_names(d)
291
- middle_sections = "//clause[title = 'Scope' or title = 'Conformance'] | "\
292
- "//foreword | //introduction | "\
293
- "//references[title = 'Normative References' or title = 'Normative references'] | "\
171
+ middle_sections = "//clause[title = 'Scope' or title = 'Conformance'] "\
172
+ "| //foreword | //introduction | "\
173
+ "//references[title = 'Normative References' or title = "\
174
+ "'Normative references'] | "\
294
175
  "//sections/terms | "\
295
176
  "//sections/definitions | //clause[parent::sections]"
296
177
  sequential_asset_names(d.xpath(ns(middle_sections)))
297
178
  end
298
179
 
299
- =begin
300
- def clause_names(docxml, sect_num)
301
- docxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each_with_index do |c, i|
302
- section_names(c, (i + sect_num), 1)
303
- end
304
- end
305
- =end
306
-
307
180
  def conformance(isoxml, out, num)
308
181
  f = isoxml.at(ns("//clause[title = 'Conformance']")) or return num
309
182
  out.div **attr_code(id: f["id"]) do |div|
@@ -316,21 +189,6 @@ module IsoDoc
316
189
  num
317
190
  end
318
191
 
319
- =begin
320
- def clause(isoxml, out, num)
321
- isoxml.xpath(ns(self.class::MIDDLE_CLAUSE)).each do |c|
322
- out.div **attr_code(id: c["id"]) do |div|
323
- num = num + 1
324
- clause_name(num,
325
- c&.at(ns("./title"))&.content, div, nil)
326
- c.elements.each do |e|
327
- parse(e, div) unless e.name == "title"
328
- end
329
- end
330
- end
331
- end
332
- =end
333
-
334
192
  def middle(isoxml, out)
335
193
  middle_title(out)
336
194
  i = scope isoxml, out, 0