metanorma-ogc 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,6 +49,8 @@ style='mso-color-alt:windowtext'><a href="http://www.opengeospatial.org/legal/">
49
49
  style='mso-color-alt:windowtext'>http://www.opengeospatial.org/legal/</span></a></span></span>.<b
50
50
  style='mso-bidi-font-weight:normal'><o:p></o:p></b></span></p>
51
51
 
52
+ {% if status == "Published" or status == "Withdrawn" %}
53
+
52
54
  {% if doctype == "Standard" or doctype == "Standard With Suite" %}
53
55
  <p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
54
56
  border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:
@@ -109,22 +111,46 @@ style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Thi
109
111
  <o:p></o:p></span></p>
110
112
  {% endif %}
111
113
 
112
- {% if status != "Published" and status != "Withdrawn" %}
114
+ {% else %}
113
115
  <p class="MsoNormal" align="center" style='margin-bottom:6.0pt;text-align:center;
114
116
  border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:
115
117
  1.0pt 4.0pt 1.0pt 4.0pt'><b style='mso-bidi-font-weight:normal'><span
116
118
  lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt'>Warning for drafts<o:p></o:p></span></b></p>
117
119
 
118
- <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>This document is not a OGC Standard. It is distributed for review and comment, and is subject to change without notice and may not be referred to as a Standard.
120
+ {% if doctype == "Standard" or doctype == "Standard With Suite" %}
121
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>This document is not an OGC Standard. This document is distributed for review and comment. This document is subject to change without notice and may not be referred to as an OGC Standard.
122
+ </p>
123
+
124
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.</p>
125
+ {% endif %}
126
+
127
+ {% if doctype == "Best Practice" %}
128
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>This document defines an OGC Best Practice on a particular technology or approach related to an OGC standard. This document is not an OGC Standard and may not be referred to as an OGC Standard. It is subject to change without notice. However, this document is an official position of the OGC membership on this particular technology topic.
129
+ </p>
130
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.
131
+ </p>
132
+ {% endif %}
133
+
134
+ {% if doctype == "Discussion Paper" %}
135
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>This document is not an OGC Standard. This document is an OGC Discussion Paper and is therefore not an official position of the OGC membership. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard. Further, an OGC Discussion Paper should not be referenced as required or mandatory technology in procurements.
119
136
  </p>
137
+ {% endif %}
120
138
 
121
- <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. The Open Geospatial Consortium Inc. shall not be held responsible for identifying any or all such patent rights.
139
+ {% if doctype == "White Paper" %}
140
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>This document is not an OGC Standard. This document is an OGC White Paper and is therefore not an official position of the OGC membership. It is distributed for review and comment. It is subject to change without notice and may not be referred to as an OGC Standard. Further, an OGC White Paper should not be referenced as required or mandatory technology in procurements.
122
141
  </p>
142
+ {% endif %}
123
143
 
124
- <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by any implementation of the standard set forth in this document, and to provide supporting documentation.
144
+ {% if doctype == "Release Notes" %}
145
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>This document is not an OGC standard. This document provides release notes for an OGC standard. This document is subject to change without notice and may not be referred to as an OGC Standard.
146
+ </p>
147
+ <p class="MsoNormal" style='margin-bottom:6.0pt;border:none;mso-border-alt:solid windowtext .5pt;padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Recipients of this document are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.
125
148
  </p>
126
149
  {% endif %}
127
150
 
151
+
152
+ {% endif %}
153
+
128
154
  <div style='mso-element:frame;mso-element-frame-hspace:7.1pt;mso-element-frame-vspace:
129
155
  7.1pt;mso-element-wrap:auto;mso-element-anchor-vertical:page;mso-element-anchor-horizontal:
130
156
  page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
@@ -176,17 +202,6 @@ page;mso-element-left:39.9pt;mso-element-top:693.25pt;mso-height-rule:exactly'>
176
202
 
177
203
  </div>
178
204
 
179
- {% if status != "Published" and status != "Withdrawn" %}
180
- <p class="MsoNormal" style='border:none;mso-border-alt:solid windowtext .5pt;
181
- padding:0cm;mso-padding-alt:1.0pt 4.0pt 1.0pt 4.0pt'><span lang="EN-GB"
182
- style='font-size:10.0pt;mso-bidi-font-size:11.0pt;mso-bidi-font-weight:bold'>Recipients
183
- of this draft are invited to submit, with their comments, notification of any
184
- relevant patent rights of which they are aware and to provide supporting
185
- documentation.</span><span lang="EN-GB" style='font-size:10.0pt;mso-bidi-font-size:
186
- 11.0pt'><o:p></o:p></span></p>
187
-
188
- {% endif %}
189
-
190
205
 
191
206
 
192
207
 
@@ -1,6 +1,7 @@
1
+ require_relative "base_convert"
2
+ require "fileutils"
1
3
  require "isodoc"
2
4
  require_relative "metadata"
3
- require "fileutils"
4
5
 
5
6
  module IsoDoc
6
7
  module Ogc
@@ -40,8 +41,8 @@ module IsoDoc
40
41
  def googlefonts
41
42
  <<~HEAD.freeze
42
43
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet" />
43
- <link href="https://fonts.googleapis.com/css?family=Teko:300,400,500" rel="stylesheet">
44
44
  <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet">
45
+ <link href="https://fonts.googleapis.com/css?family=Teko:300,400,500" rel="stylesheet">
45
46
  HEAD
46
47
  end
47
48
 
@@ -67,95 +68,6 @@ module IsoDoc
67
68
  docxml
68
69
  end
69
70
 
70
- def annex_name(annex, name, div)
71
- div.h1 **{ class: "Annex" } do |t|
72
- t << "#{get_anchors[annex['id']][:label]}"
73
- t.br
74
- t.b do |b|
75
- name&.children&.each { |c2| parse(c2, b) }
76
- end
77
- end
78
- end
79
-
80
- def term_defs_boilerplate(div, source, term, preface)
81
- if source.empty? && term.nil?
82
- div << @no_terms_boilerplate
83
- else
84
- div << term_defs_boilerplate_cont(source, term)
85
- end
86
- end
87
-
88
- def fileloc(loc)
89
- File.join(File.dirname(__FILE__), loc)
90
- end
91
-
92
- def cleanup(docxml)
93
- super
94
- term_cleanup(docxml)
95
- end
96
-
97
- def term_cleanup(docxml)
98
- docxml.xpath("//p[@class = 'Terms']").each do |d|
99
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
100
- h2.add_child("&nbsp;")
101
- h2.add_child(d.remove)
102
- end
103
- docxml
104
- end
105
-
106
- def info(isoxml, out)
107
- @meta.keywords isoxml, out
108
- super
109
- end
110
-
111
- def load_yaml(lang, script)
112
- y = if @i18nyaml then YAML.load_file(@i18nyaml)
113
- elsif lang == "en"
114
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
115
- else
116
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
117
- end
118
- super.merge(y)
119
- end
120
-
121
- def keywords(_docxml, out)
122
- kw = @meta.get[:keywords]
123
- kw.empty? and return
124
- @prefacenum += 1
125
- out.div **{ class: "Section3" } do |div|
126
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Keywords", div, class: "IntroTitle")
127
- div.p "The following are keywords to be used by search engines and document catalogues."
128
- div.p kw.join(", ")
129
- end
130
- end
131
-
132
- SUBMITTINGORGS =
133
- "//bibdata/contributor[role/@type = 'author']/organization/name".freeze
134
-
135
- def submittingorgs(docxml, out)
136
- orgs = []
137
- docxml.xpath(ns(SUBMITTINGORGS)).each { |org| orgs << org.text }
138
- return if orgs.empty?
139
- @prefacenum += 1
140
- out.div **{ class: "Section3" } do |div|
141
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Submitting Organizations", div, class: "IntroTitle")
142
- div.p "The following organizations submitted this Document to the Open Geospatial Consortium (OGC):"
143
- div.ul do |ul|
144
- orgs.each do |org|
145
- ul.li org
146
- end
147
- end
148
- end
149
- end
150
-
151
- def submitters(docxml, out)
152
- f = docxml.at(ns("//submitters")) || return
153
- out.div **{ class: "Section3" } do |div|
154
- clause_name(get_anchors[f['id']][:label], "Submitters", div, class: "IntroTitle")
155
- f.elements.each { |e| parse(e, div) unless e.name == "title" }
156
- end
157
- end
158
-
159
71
  def make_body3(body, docxml)
160
72
  body.div **{ class: "main-section" } do |div3|
161
73
  @prefacenum = 0
@@ -170,185 +82,7 @@ module IsoDoc
170
82
  end
171
83
  end
172
84
 
173
- def preface_names(clause)
174
- return if clause.nil?
175
- @prefacenum += 1
176
- @anchors[clause["id"]] =
177
- { label: RomanNumerals.to_roman(@prefacenum).downcase,
178
- level: 1, xref: preface_clause_name(clause), type: "clause" }
179
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each_with_index do |c, i|
180
- section_names1(c, "#{@prefacenum}.#{i + 1}", 2)
181
- end
182
- end
183
-
184
- def abstract(isoxml, out)
185
- f = isoxml.at(ns("//preface/abstract")) || return
186
- @prefacenum += 1
187
- page_break(out)
188
- out.div **attr_code(id: f["id"]) do |s|
189
- clause_name(get_anchors[f["id"]][:label], @abstract_lbl, s, class: "AbstractTitle")
190
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
191
- end
192
- end
193
-
194
- def foreword(isoxml, out)
195
- f = isoxml.at(ns("//foreword")) || return
196
- @prefacenum += 1
197
- page_break(out)
198
- out.div **attr_code(id: f["id"]) do |s|
199
- clause_name(get_anchors[f["id"]][:label], @foreword_lbl, s, class: "ForewordTitle")
200
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
201
- end
202
- end
203
-
204
- def example_parse(node, out)
205
- name = node.at(ns("./name"))
206
- sourcecode_name_parse(node, out, name) if name
207
- super
208
- end
209
-
210
- def error_parse(node, out)
211
- case node.name
212
- when "recommendation" then recommendation_parse(node, out)
213
- when "requirement" then requirement_parse(node, out)
214
- when "permission" then permission_parse(node, out)
215
- else
216
- super
217
- end
218
- end
219
-
220
- def anchor_names(docxml)
221
- super
222
- recommendation_anchor_names(docxml)
223
- requirement_anchor_names(docxml)
224
- permission_anchor_names(docxml)
225
- end
226
-
227
- def recommendation_anchor_names(docxml)
228
- docxml.xpath(ns("//recommendation")).each_with_index do |x, i|
229
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Recommendation", "recommendation")
230
- end
231
- end
232
-
233
- def requirement_anchor_names(docxml)
234
- docxml.xpath(ns("//requirement")).each_with_index do |x, i|
235
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Requirement", "requirement")
236
- end
237
- end
238
-
239
- def permission_anchor_names(docxml)
240
- docxml.xpath(ns("//permission")).each_with_index do |x, i|
241
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Permission", "permission")
242
- end
243
- end
244
-
245
- def recommend_table_attr(node)
246
- attr_code(id: node["id"], class: "recommend",
247
- cellspacing: 0, cellpadding: 0,
248
- style: "border-collapse:collapse" )
249
- end
250
-
251
- REQ_TBL_ATTR =
252
- { valign: "top", class: "example_label",
253
- style: "width:100.0pt;padding:0 0 0 1em;margin-left:0pt" }.freeze
254
-
255
- def recommend_name_parse(node, div)
256
- name = node&.at(ns("./name"))&.text or return
257
- div.p do |p|
258
- p.b name
259
- end
260
- end
261
-
262
- def recommendation_parse(node, out)
263
- out.table **recommend_table_attr(node) do |t|
264
- t.tr do |tr|
265
- tr.td **REQ_TBL_ATTR do |td|
266
- recommendation_label(node, td)
267
- end
268
- tr.td **{ valign: "top", class: "recommend" } do |td|
269
- recommend_name_parse(node, td)
270
- node.children.each { |n| parse(n, td) unless n.name == "name" }
271
- end
272
- end
273
- end
274
- end
275
-
276
- def recommendation_label(node, out)
277
- n = get_anchors[node["id"]]
278
- label = (n.nil? || n[:label].empty?) ?
279
- "Recommendation" : l10n("#{"Recommendation"} #{n[:label]}")
280
- out.p **{class: "RecommendationTitle" } do |p|
281
- p << label
282
- end
283
- end
284
-
285
- def requirement_parse(node, out)
286
- out.table **recommend_table_attr(node) do |t|
287
- t.tr do |tr|
288
- tr.td **REQ_TBL_ATTR do |td|
289
- requirement_label(node, td)
290
- end
291
- tr.td **{ valign: "top", class: "recommend" } do |td|
292
- recommend_name_parse(node, td)
293
- node.children.each { |n| parse(n, td) unless n.name == "name" }
294
- end
295
- end
296
- end
297
- end
298
-
299
- def requirement_label(node, out)
300
- n = get_anchors[node["id"]]
301
- label = (n.nil? || n[:label].empty?) ?
302
- "Requirement" : l10n("#{"Requirement"} #{n[:label]}")
303
- out.p **{class: "RecommendationTitle" } do |p|
304
- p << label
305
- end
306
- end
307
-
308
- def permission_parse(node, out)
309
- out.table **recommend_table_attr(node) do |t|
310
- t.tr do |tr|
311
- tr.td **REQ_TBL_ATTR do |td|
312
- permission_label(node, td)
313
- end
314
- tr.td **{ valign: "top", class: "recommend" } do |td|
315
- recommend_name_parse(node, td)
316
- node.children.each { |n| parse(n, td) unless n.name == "name" }
317
- end
318
- end
319
- end
320
- end
321
-
322
- def permission_label(node, out)
323
- n = get_anchors[node["id"]]
324
- label = (n.nil? || n[:label].empty?) ?
325
- "Permission" : l10n("#{"Permission"} #{n[:label]}")
326
- out.p **{class: "RecommendationTitle" } do |p|
327
- p << label
328
- end
329
- end
330
-
331
- def initial_anchor_names(d)
332
- @prefacenum = 0
333
- preface_names(d.at(ns("//preface/abstract")))
334
- @prefacenum += 1 if d.at(ns("//keyword"))
335
- preface_names(d.at(ns("//foreword")))
336
- #preface_names(d.at(ns("//introduction")))
337
- @prefacenum += 1 if d.at(ns(SUBMITTINGORGS))
338
- preface_names(d.at(ns("//submitters")))
339
- sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | //introduction | //submitters")))
340
- n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
341
- n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
342
- n = section_names(d.at(ns(
343
- "//references[title = 'Normative References' or title = 'Normative references']")), n, 1)
344
- n = section_names(d.at(ns("//sections/terms | "\
345
- "//sections/clause[descendant::terms]")), n, 1)
346
- n = section_names(d.at(ns("//sections/definitions")), n, 1)
347
- middle_section_asset_names(d)
348
- clause_names(d, n)
349
- termnote_anchor_names(d)
350
- termexample_anchor_names(d)
351
- end
85
+ include BaseConvert
352
86
  end
353
87
  end
354
88
  end
@@ -1,6 +1,7 @@
1
+ require_relative "base_convert"
2
+ require "fileutils"
1
3
  require "isodoc"
2
4
  require_relative "metadata"
3
- require "fileutils"
4
5
 
5
6
  module IsoDoc
6
7
  module Ogc
@@ -35,7 +36,7 @@ module IsoDoc
35
36
  @meta = Metadata.new(lang, script, labels)
36
37
  end
37
38
 
38
- def googlefonts()
39
+ def googlefonts
39
40
  <<~HEAD.freeze
40
41
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700" rel="stylesheet" />
41
42
  <link href="https://fonts.googleapis.com/css?family=Overpass:300,300i,600,900" rel="stylesheet" />
@@ -65,96 +66,6 @@ module IsoDoc
65
66
  docxml
66
67
  end
67
68
 
68
- def annex_name(annex, name, div)
69
- div.h1 **{ class: "Annex" } do |t|
70
- t << "#{get_anchors[annex['id']][:label]} "
71
- t.br
72
- t.b do |b|
73
- name&.children&.each { |c2| parse(c2, b) }
74
- end
75
- end
76
- end
77
-
78
- def term_defs_boilerplate(div, source, term, preface)
79
- if source.empty? && term.nil?
80
- div << @no_terms_boilerplate
81
- else
82
- div << term_defs_boilerplate_cont(source, term)
83
- end
84
- end
85
-
86
- def fileloc(loc)
87
- File.join(File.dirname(__FILE__), loc)
88
- end
89
-
90
- def cleanup(docxml)
91
- super
92
- term_cleanup(docxml)
93
- end
94
-
95
- def term_cleanup(docxml)
96
- docxml.xpath("//p[@class = 'Terms']").each do |d|
97
- h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
98
- h2.add_child("&nbsp;")
99
- h2.add_child(d.remove)
100
- end
101
- docxml
102
- end
103
-
104
- def info(isoxml, out)
105
- @meta.keywords isoxml, out
106
- super
107
- end
108
-
109
- def load_yaml(lang, script)
110
- y = if @i18nyaml then YAML.load_file(@i18nyaml)
111
- elsif lang == "en"
112
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
113
- else
114
- YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
115
- end
116
- super.merge(y)
117
- end
118
-
119
-
120
- def keywords(_docxml, out)
121
- kw = @meta.get[:keywords]
122
- kw.empty? and return
123
- @prefacenum += 1
124
- out.div **{ class: "Section3" } do |div|
125
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Keywords", div, class: "IntroTitle")
126
- div.p "The following are keywords to be used by search engines and document catalogues."
127
- div.p kw.join(", ")
128
- end
129
- end
130
-
131
- SUBMITTINGORGS =
132
- "//bibdata/contributor[role/@type = 'author']/organization/name".freeze
133
-
134
- def submittingorgs(docxml, out)
135
- orgs = []
136
- docxml.xpath(ns(SUBMITTINGORGS)).each { |org| orgs << org.text }
137
- return if orgs.empty?
138
- @prefacenum += 1
139
- out.div **{ class: "Section3" } do |div|
140
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase, "Submitting Organizations", div, class: "IntroTitle")
141
- div.p "The following organizations submitted this Document to the Open Geospatial Consortium (OGC):"
142
- div.ul do |ul|
143
- orgs.each do |org|
144
- ul.li org
145
- end
146
- end
147
- end
148
- end
149
-
150
- def submitters(docxml, out)
151
- f = docxml.at(ns("//submitters")) || return
152
- out.div **{ class: "Section3" } do |div|
153
- clause_name(get_anchors[f['id']][:label], "Submitters", div, class: "IntroTitle")
154
- f.elements.each { |e| parse(e, div) unless e.name == "title" }
155
- end
156
- end
157
-
158
69
  def make_body3(body, docxml)
159
70
  body.div **{ class: "main-section" } do |div3|
160
71
  @prefacenum = 0
@@ -169,186 +80,7 @@ module IsoDoc
169
80
  end
170
81
  end
171
82
 
172
- def preface_names(clause)
173
- return if clause.nil?
174
- @prefacenum += 1
175
- @anchors[clause["id"]] =
176
- { label: RomanNumerals.to_roman(@prefacenum).downcase,
177
- level: 1, xref: preface_clause_name(clause), type: "clause" }
178
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each_with_index do |c, i|
179
- section_names1(c, "#{@prefacenum}.#{i + 1}", 2)
180
- end
181
- end
182
-
183
- def abstract(isoxml, out)
184
- f = isoxml.at(ns("//preface/abstract")) || return
185
- @prefacenum += 1
186
- page_break(out)
187
- out.div **attr_code(id: f["id"]) do |s|
188
- clause_name(get_anchors[f["id"]][:label], @abstract_lbl, s, class: "AbstractTitle")
189
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
190
- end
191
- end
192
-
193
- def foreword(isoxml, out)
194
- f = isoxml.at(ns("//foreword")) || return
195
- @prefacenum += 1
196
- page_break(out)
197
- out.div **attr_code(id: f["id"]) do |s|
198
- clause_name(get_anchors[f["id"]][:label], @foreword_lbl, s, class: "ForewordTitle")
199
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
200
- end
201
- end
202
-
203
- def example_parse(node, out)
204
- name = node.at(ns("./name"))
205
- sourcecode_name_parse(node, out, name) if name
206
- super
207
- end
208
-
209
- def error_parse(node, out)
210
- case node.name
211
- when "recommendation" then recommendation_parse(node, out)
212
- when "requirement" then requirement_parse(node, out)
213
- when "permission" then permission_parse(node, out)
214
- else
215
- super
216
- end
217
- end
218
-
219
- def anchor_names(docxml)
220
- super
221
- recommendation_anchor_names(docxml)
222
- requirement_anchor_names(docxml)
223
- permission_anchor_names(docxml)
224
- end
225
-
226
- def recommendation_anchor_names(docxml)
227
- docxml.xpath(ns("//recommendation")).each_with_index do |x, i|
228
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Recommendation", "recommendation")
229
- end
230
- end
231
-
232
- def requirement_anchor_names(docxml)
233
- docxml.xpath(ns("//requirement")).each_with_index do |x, i|
234
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Requirement", "requirement")
235
- end
236
- end
237
-
238
- def permission_anchor_names(docxml)
239
- docxml.xpath(ns("//permission")).each_with_index do |x, i|
240
- @anchors[x["id"]] = anchor_struct(i+1, nil, "Permission", "permission")
241
- end
242
- end
243
-
244
- def recommend_table_attr(node)
245
- attr_code(id: node["id"], class: "recommend",
246
- cellspacing: 0, cellpadding: 0,
247
- style: "border-collapse:collapse" )
248
- end
249
-
250
- REQ_TBL_ATTR =
251
- { valign: "top", class: "example_label",
252
- style: "width:100.0pt;padding:0 0 0 1em;margin-left:0pt" }.freeze
253
-
254
- def recommend_name_parse(node, div)
255
- name = node&.at(ns("./name"))&.text or return
256
- div.p do |p|
257
- p.b name
258
- end
259
- end
260
-
261
- def recommendation_parse(node, out)
262
- out.table **recommend_table_attr(node) do |t|
263
- t.tr do |tr|
264
- tr.td **REQ_TBL_ATTR do |td|
265
- recommendation_label(node, td)
266
- end
267
- tr.td **{ valign: "top", class: "recommend" } do |td|
268
- recommend_name_parse(node, td)
269
- node.children.each { |n| parse(n, td) unless n.name == "name" }
270
- end
271
- end
272
- end
273
- end
274
-
275
- def recommendation_label(node, out)
276
- n = get_anchors[node["id"]]
277
- label = (n.nil? || n[:label].empty?) ?
278
- "Recommendation" : l10n("#{"Recommendation"} #{n[:label]}")
279
- out.p **{class: "RecommendationTitle" } do |p|
280
- p << label
281
- end
282
- end
283
-
284
- def requirement_parse(node, out)
285
- out.table **recommend_table_attr(node) do |t|
286
- t.tr do |tr|
287
- tr.td **REQ_TBL_ATTR do |td|
288
- requirement_label(node, td)
289
- end
290
- tr.td **{ valign: "top", class: "recommend" } do |td|
291
- recommend_name_parse(node, td)
292
- node.children.each { |n| parse(n, td) unless n.name == "name" }
293
- end
294
- end
295
- end
296
- end
297
-
298
- def requirement_label(node, out)
299
- n = get_anchors[node["id"]]
300
- label = (n.nil? || n[:label].empty?) ?
301
- "Requirement" : l10n("#{"Requirement"} #{n[:label]}")
302
- out.p **{class: "RecommendationTitle" } do |p|
303
- p << label
304
- end
305
- end
306
-
307
- def permission_parse(node, out)
308
- out.table **recommend_table_attr(node) do |t|
309
- t.tr do |tr|
310
- tr.td **REQ_TBL_ATTR do |td|
311
- permission_label(node, td)
312
- end
313
- tr.td **{ valign: "top", class: "recommend" } do |td|
314
- recommend_name_parse(node, td)
315
- node.children.each { |n| parse(n, td) unless n.name == "name" }
316
- end
317
- end
318
- end
319
- end
320
-
321
- def permission_label(node, out)
322
- n = get_anchors[node["id"]]
323
- label = (n.nil? || n[:label].empty?) ?
324
- "Permission" : l10n("#{"Permission"} #{n[:label]}")
325
- out.p **{class: "RecommendationTitle" } do |p|
326
- p << label
327
- end
328
- end
329
-
330
- def initial_anchor_names(d)
331
- @prefacenum = 0
332
- preface_names(d.at(ns("//preface/abstract")))
333
- @prefacenum += 1 if d.at(ns("//keyword"))
334
- preface_names(d.at(ns("//foreword")))
335
- #preface_names(d.at(ns("//introduction")))
336
- @prefacenum += 1 if d.at(ns(SUBMITTINGORGS))
337
- preface_names(d.at(ns("//submitters")))
338
- sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | //introduction | //submitters")))
339
- n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
340
- n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
341
- n = section_names(d.at(ns(
342
- "//references[title = 'Normative References' or title = 'Normative references']")), n, 1)
343
- n = section_names(d.at(ns("//sections/terms | "\
344
- "//sections/clause[descendant::terms]")), n, 1)
345
- n = section_names(d.at(ns("//sections/definitions")), n, 1)
346
- middle_section_asset_names(d)
347
- clause_names(d, n)
348
- termnote_anchor_names(d)
349
- termexample_anchor_names(d)
350
- end
351
-
83
+ include BaseConvert
352
84
  end
353
85
  end
354
86
  end