metanorma-ogc 2.3.7 → 2.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/base_convert.rb +0 -20
  3. data/lib/isodoc/ogc/html/html_ogc_intro.html +0 -1
  4. data/lib/isodoc/ogc/html/preprocess.xslt +13 -0
  5. data/lib/isodoc/ogc/html/rouge.css +38 -0
  6. data/lib/isodoc/ogc/html/word_ogc_intro.html +0 -3
  7. data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +0 -3
  8. data/lib/isodoc/ogc/html_convert.rb +1 -11
  9. data/lib/isodoc/ogc/i18n-en.yaml +1 -0
  10. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +347 -96
  11. data/lib/isodoc/ogc/ogc.best-practice.xsl +347 -96
  12. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +347 -96
  13. data/lib/isodoc/ogc/ogc.community-practice.xsl +347 -96
  14. data/lib/isodoc/ogc/ogc.community-standard.xsl +347 -96
  15. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +347 -96
  16. data/lib/isodoc/ogc/ogc.draft-standard.xsl +347 -96
  17. data/lib/isodoc/ogc/ogc.engineering-report.xsl +347 -96
  18. data/lib/isodoc/ogc/ogc.other.xsl +347 -96
  19. data/lib/isodoc/ogc/ogc.policy.xsl +347 -96
  20. data/lib/isodoc/ogc/ogc.reference-model.xsl +347 -96
  21. data/lib/isodoc/ogc/ogc.release-notes.xsl +347 -96
  22. data/lib/isodoc/ogc/ogc.standard.xsl +347 -96
  23. data/lib/isodoc/ogc/ogc.test-suite.xsl +347 -96
  24. data/lib/isodoc/ogc/ogc.user-guide.xsl +347 -96
  25. data/lib/isodoc/ogc/ogc.white-paper.xsl +311 -95
  26. data/lib/isodoc/ogc/presentation_xml_convert.rb +26 -6
  27. data/lib/isodoc/ogc/sections.rb +48 -48
  28. data/lib/isodoc/ogc/word_convert.rb +3 -0
  29. data/lib/isodoc/ogc/xref.rb +12 -1
  30. data/lib/metanorma/ogc/isodoc.rng +41 -14
  31. data/lib/metanorma/ogc/ogc.rng +3 -8
  32. data/lib/metanorma/ogc/validate.rb +18 -11
  33. data/lib/metanorma/ogc/version.rb +1 -1
  34. data/metanorma-ogc.gemspec +1 -1
  35. metadata +6 -4
@@ -5,12 +5,25 @@ require_relative "../../relaton/render/general"
5
5
  module IsoDoc
6
6
  module Ogc
7
7
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
8
+ def initialize(options)
9
+ @libdir = File.dirname(__FILE__)
10
+ super
11
+ end
12
+
8
13
  def convert1(docxml, filename, dir)
9
14
  info docxml, nil
10
- insert_preface_sections(docxml)
11
15
  super
12
16
  end
13
17
 
18
+ def rouge_css_location
19
+ File.read(File.join(@libdir, "html", "rouge.css"))
20
+ end
21
+
22
+ def preface_rearrange(doc)
23
+ super
24
+ insert_preface_sections(doc)
25
+ end
26
+
14
27
  def insert_preface_sections(doc)
15
28
  preface_insert(doc.at(ns("//preface/clause" \
16
29
  "[@type = 'executivesummary']")),
@@ -30,8 +43,7 @@ module IsoDoc
30
43
  end
31
44
 
32
45
  def preface_insert(clause, after, docxml)
33
- return unless clause
34
-
46
+ clause or return
35
47
  clause.remove
36
48
  if after then after.next = clause
37
49
  else
@@ -117,9 +129,9 @@ module IsoDoc
117
129
  end
118
130
 
119
131
  def clause1(elem)
120
- return if elem.name == "terms" && elem.parent.name == "annex" &&
121
- elem.parent.xpath(ns("./terms")).size == 1
122
-
132
+ elem.name == "terms" && elem.parent.name == "annex" &&
133
+ elem.parent.xpath(ns("./terms")).size == 1 and return
134
+ elem.name == "clause" && elem["type"] == "toc" and return
123
135
  super
124
136
  end
125
137
 
@@ -215,6 +227,14 @@ module IsoDoc
215
227
  prefix_bracketed_ref("#{ret}#{datefn}")
216
228
  end
217
229
 
230
+ def deprecates(elem)
231
+ elem << "&#xa0;<span class='AdmittedLabel'>#{@i18n.deprecated}</span>"
232
+ end
233
+
234
+ def admits(elem)
235
+ elem << "&#xa0;<span class='AdmittedLabel'>#{@i18n.admitted}</span>"
236
+ end
237
+
218
238
  include Init
219
239
  end
220
240
  end
@@ -1,70 +1,70 @@
1
1
  module IsoDoc
2
2
  module Ogc
3
3
  module BaseConvert
4
- def intro_clause(elem, out)
5
- out.div **{ class: "Section3", id: elem["id"] } do |div|
6
- clause_name(elem, elem&.at(ns("./title")), div, class: "IntroTitle")
7
- elem.elements.each { |e| parse(e, div) unless e.name == "title" }
4
+ def front(isoxml, out)
5
+ p = isoxml.at(ns("//preface")) or return
6
+ p.elements.each do |e|
7
+ if is_clause?(e.name)
8
+ case e.name
9
+ when "abstract" then abstract e, out
10
+ when "foreword" then foreword e, out
11
+ when "introduction" then introduction e, out
12
+ when "submitters" then intro_clause e, out
13
+ when "clause" then preface e, out
14
+ when "acknowledgements" then acknowledgements e, out
15
+ end
16
+ else
17
+ preface_block(e, out)
18
+ end
8
19
  end
9
20
  end
10
21
 
11
- def keywords(docxml, out)
12
- f = docxml.at(ns("//preface/clause[@type = 'keywords']")) || return
13
- intro_clause(f, out)
14
- end
15
-
16
- def submittingorgs(docxml, out)
17
- f = docxml.at(ns("//preface/clause[@type = 'submitting_orgs']")) or
18
- return
19
- intro_clause(f, out)
20
- end
21
-
22
- def security(docxml, out)
23
- f = docxml.at(ns("//preface/clause[@type = 'security']")) or return
24
- intro_clause(f, out)
25
- end
26
-
27
- def executivesummary(docxml, out)
28
- f = docxml.at(ns("//preface/clause[@type = 'executivesummary']")) or
29
- return
30
- intro_clause(f, out)
31
- end
32
-
33
- def submitters(docxml, out)
34
- f = docxml.at(ns("//submitters")) || return
35
- intro_clause(f, out)
22
+ def preface(clause, out)
23
+ case clause["type"]
24
+ when "toc"
25
+ table_of_contents(clause, out)
26
+ when "executivesummary", "security", "submitting_orgs",
27
+ "keywords"
28
+ intro_clause(clause, out)
29
+ else
30
+ intro_clause(clause, out)
31
+ end
36
32
  end
37
33
 
38
- def preface(isoxml, out)
39
- isoxml.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
40
- "@type = 'submitting_orgs' or @type = 'security' or "\
41
- "@type = 'executivesummary')]"))
42
- .each do |f|
43
- intro_clause(f, out)
34
+ def intro_clause(elem, out)
35
+ out.div class: "Section3", id: elem["id"] do |div|
36
+ clause_name(elem, elem&.at(ns("./title")), div,
37
+ class: "IntroTitle")
38
+ elem.elements.each do |e|
39
+ parse(e, div) unless e.name == "title"
40
+ end
44
41
  end
45
42
  end
46
43
 
47
- def abstract(isoxml, out)
48
- f = isoxml.at(ns("//preface/abstract")) || return
44
+ def abstract(clause, out)
49
45
  page_break(out)
50
- out.div **attr_code(id: f["id"]) do |s|
51
- clause_name(f, f&.at(ns("./title")), s, class: "AbstractTitle")
52
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
46
+ out.div **attr_code(id: clause["id"]) do |s|
47
+ clause_name(clause, clause.at(ns("./title")), s,
48
+ class: "AbstractTitle")
49
+ clause.elements.each do |e|
50
+ parse(e, s) unless e.name == "title"
51
+ end
53
52
  end
54
53
  end
55
54
 
56
- def foreword(isoxml, out)
57
- f = isoxml.at(ns("//foreword")) || return
55
+ def foreword(clause, out)
58
56
  page_break(out)
59
- out.div **attr_code(id: f["id"]) do |s|
60
- clause_name(f, f&.at(ns("./title")), s, class: "ForewordTitle")
61
- f.elements.each { |e| parse(e, s) unless e.name == "title" }
57
+ out.div **attr_code(id: clause["id"]) do |s|
58
+ clause_name(clause, clause&.at(ns("./title")), s,
59
+ class: "ForewordTitle")
60
+ clause.elements.each do |e|
61
+ parse(e, s) unless e.name == "title"
62
+ end
62
63
  end
63
64
  end
64
65
 
65
- def acknowledgements(isoxml, out)
66
- f = isoxml.at(ns("//acknowledgements")) || return
67
- intro_clause(f, out)
66
+ def acknowledgements(clause, out)
67
+ intro_clause(clause, out)
68
68
  end
69
69
 
70
70
  def conformance(isoxml, out, num)
@@ -91,6 +91,8 @@ module IsoDoc
91
91
  @prefacenum = 0
92
92
  info docxml, div2
93
93
  boilerplate docxml, div2
94
+ front docxml, div2
95
+ =begin
94
96
  preface_block docxml, div2
95
97
  abstract docxml, div2
96
98
  executivesummary docxml, div2
@@ -102,6 +104,7 @@ module IsoDoc
102
104
  submitters docxml, div2
103
105
  preface docxml, div2
104
106
  acknowledgements docxml, div2
107
+ =end
105
108
  div2.p { |p| p << "&#xA0;" } # placeholder
106
109
  end
107
110
  section_break(body)
@@ -31,7 +31,7 @@ module IsoDoc
31
31
  end
32
32
  doc.xpath(ns("//preface/clause[not(@type = 'keywords' or " \
33
33
  "@type = 'submitting_orgs' or @type = 'security' or " \
34
- "@type = 'executivesummary')]"))
34
+ "@type = 'executivesummary' or @type = 'toc')]"))
35
35
  .each { |c| preface_names_numbered(c) }
36
36
  preface_names_numbered(doc.at(ns("//acknowledgements")))
37
37
  sequential_asset_names(
@@ -93,6 +93,17 @@ module IsoDoc
93
93
 
94
94
  @anchors[ref["id"]] = { xref: "#{@anchors[ref['id']][:xref]} (draft)" }
95
95
  end
96
+
97
+ def sequential_permission_body(id, block, label, klass, model)
98
+ @anchors[block["id"]] = model.postprocess_anchor_struct(
99
+ block, anchor_struct(id, nil,
100
+ label, klass, block["unnumbered"])
101
+ )
102
+ model.permission_parts(block, id, label, klass).each do |n|
103
+ @anchors[n[:id]] = anchor_struct(n[:number], nil, n[:label],
104
+ n[:klass], false)
105
+ end
106
+ end
96
107
  end
97
108
  end
98
109
  end
@@ -17,6 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
+ <!-- VERSION v1.2.1 -->
20
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
21
22
  <include href="reqt.rng"/>
22
23
  <include href="basicdoc.rng">
@@ -382,6 +383,9 @@
382
383
  <optional>
383
384
  <ref name="dl"/>
384
385
  </optional>
386
+ <optional>
387
+ <ref name="source"/>
388
+ </optional>
385
389
  </element>
386
390
  </define>
387
391
  <define name="figure">
@@ -404,9 +408,6 @@
404
408
  <attribute name="class"/>
405
409
  </optional>
406
410
  <ref name="BlockAttributes"/>
407
- <optional>
408
- <ref name="source"/>
409
- </optional>
410
411
  <optional>
411
412
  <ref name="tname"/>
412
413
  </optional>
@@ -431,6 +432,20 @@
431
432
  <zeroOrMore>
432
433
  <ref name="note"/>
433
434
  </zeroOrMore>
435
+ <optional>
436
+ <ref name="source"/>
437
+ </optional>
438
+ </element>
439
+ </define>
440
+ <define name="source">
441
+ <element name="source">
442
+ <attribute name="status">
443
+ <ref name="SourceStatusType"/>
444
+ </attribute>
445
+ <ref name="origin"/>
446
+ <optional>
447
+ <ref name="modification"/>
448
+ </optional>
434
449
  </element>
435
450
  </define>
436
451
  <define name="sourcecode">
@@ -1335,15 +1350,19 @@
1335
1350
  </choice>
1336
1351
  </element>
1337
1352
  </define>
1353
+ <define name="Root-Attributes">
1354
+ <attribute name="version"/>
1355
+ <attribute name="schema-version"/>
1356
+ <attribute name="type">
1357
+ <choice>
1358
+ <value>semantic</value>
1359
+ <value>presentation</value>
1360
+ </choice>
1361
+ </attribute>
1362
+ </define>
1338
1363
  <define name="standard-document">
1339
1364
  <element name="standard-document">
1340
- <attribute name="version"/>
1341
- <attribute name="type">
1342
- <choice>
1343
- <value>semantic</value>
1344
- <value>presentation</value>
1345
- </choice>
1346
- </attribute>
1365
+ <ref name="Root-Attributes"/>
1347
1366
  <ref name="bibdata"/>
1348
1367
  <optional>
1349
1368
  <ref name="misccontainer"/>
@@ -2099,10 +2118,7 @@
2099
2118
  <define name="termsource">
2100
2119
  <element name="termsource">
2101
2120
  <attribute name="status">
2102
- <choice>
2103
- <value>identical</value>
2104
- <value>modified</value>
2105
- </choice>
2121
+ <ref name="SourceStatusType"/>
2106
2122
  </attribute>
2107
2123
  <attribute name="type">
2108
2124
  <choice>
@@ -2116,6 +2132,17 @@
2116
2132
  </optional>
2117
2133
  </element>
2118
2134
  </define>
2135
+ <define name="SourceStatusType">
2136
+ <choice>
2137
+ <value>identical</value>
2138
+ <value>modified</value>
2139
+ <value>restyled</value>
2140
+ <value>context-added</value>
2141
+ <value>generalisation</value>
2142
+ <value>specialisation</value>
2143
+ <value>unspecified</value>
2144
+ </choice>
2145
+ </define>
2119
2146
  <define name="origin">
2120
2147
  <element name="origin">
2121
2148
  <choice>
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar ns="https://www.metanorma.org/ns/ogc" xmlns="http://relaxng.org/ns/structure/1.0">
2
+ <grammar ns='https://www.metanorma.org/ns/ogc' xmlns="http://relaxng.org/ns/structure/1.0">
3
3
  <!--
4
+ VERSION v1.2.1
4
5
  Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
5
6
  we cannot have a new default namespace: we will end up with a grammar with two different
6
7
  namespaces, one for isostandard and one for csand additions. And we do not want that.
@@ -45,13 +46,7 @@
45
46
  </define>
46
47
  <define name="ogc-standard">
47
48
  <element name="ogc-standard">
48
- <attribute name="version"/>
49
- <attribute name="type">
50
- <choice>
51
- <value>semantic</value>
52
- <value>presentation</value>
53
- </choice>
54
- </attribute>
49
+ <ref name="Root-Attributes"/>
55
50
  <ref name="bibdata"/>
56
51
  <zeroOrMore>
57
52
  <ref name="termdocsource"/>
@@ -2,6 +2,7 @@ module Metanorma
2
2
  module Ogc
3
3
  class Converter < Standoc::Converter
4
4
  def validate(doc)
5
+ @doctype = doc.at("//bibdata/ext/doctype")&.text
5
6
  content_validate(doc)
6
7
  schema_validate(formattedstr_strip(doc.dup),
7
8
  File.join(File.dirname(__FILE__), "ogc.rng"))
@@ -22,12 +23,13 @@ module Metanorma
22
23
  end
23
24
 
24
25
  def stage_validate(xmldoc)
26
+ @doctype == "engineering-report" and return
25
27
  stage = xmldoc&.at("//bibdata/status/stage")&.text
26
28
  %w(draft swg-draft oab-review public-rfc tc-vote work-item-draft
27
29
  approved deprecated retired rescinded).include? stage or
28
30
  @log.add("Document Attributes", nil,
29
31
  "#{stage} is not a recognised status")
30
- stage_type_validate(stage, xmldoc&.at("//bibdata/ext/doctype")&.text)
32
+ stage_type_validate(stage, @doctype)
31
33
  end
32
34
 
33
35
  def stage_type_validate(stage, doctype)
@@ -47,23 +49,21 @@ module Metanorma
47
49
 
48
50
  def version_validate(xmldoc)
49
51
  version = xmldoc.at("//bibdata/edition")&.text
50
- doctype = xmldoc.at("//bibdata/ext/doctype")&.text
51
- if %w(engineering-report discussion-paper).include? doctype
52
+ if %w(engineering-report discussion-paper).include? @doctype
52
53
  version.nil? or @log.add("Document Attributes", nil,
53
- "Version not permitted for #{doctype}")
54
+ "Version not permitted for #{@doctype}")
54
55
  else
55
56
  version.nil? and @log.add("Document Attributes", nil,
56
- "Version required for #{doctype}")
57
+ "Version required for #{@doctype}")
57
58
  end
58
59
  end
59
60
 
60
61
  def execsummary_validate(xmldoc)
61
- doctype = xmldoc.at("//bibdata/ext/doctype")&.text
62
62
  sect = xmldoc.at("//clause[@type = 'executivesummary']")
63
- doctype == "engineering-report" && sect.nil? and
63
+ @doctype == "engineering-report" && sect.nil? and
64
64
  @log.add("Style", nil,
65
65
  "Executive Summary required for Engineering Reports!")
66
- doctype != "engineering-report" && !sect.nil? and
66
+ @doctype != "engineering-report" && !sect.nil? and
67
67
  @log.add("Style", nil,
68
68
  "Executive Summary only allowed for Engineering Reports!")
69
69
  end
@@ -109,9 +109,7 @@ module Metanorma
109
109
  end
110
110
 
111
111
  def sections_sequence_validate(root)
112
- return unless STANDARDTYPE.include?(
113
- root.at("//bibdata/ext/doctype")&.text,
114
- )
112
+ return unless STANDARDTYPE.include?(@doctype)
115
113
 
116
114
  names = root.xpath("//sections/* | //bibliography/*")
117
115
  names = seqcheck(names, SEQ[0][:msg], SEQ[0][:val])
@@ -132,6 +130,7 @@ module Metanorma
132
130
  end
133
131
 
134
132
  def preface_sequence_validate(root)
133
+ @doctype == "engineering-report" and return
135
134
  root.at("//preface/abstract") or @log.add("Style", nil,
136
135
  "Abstract is missing!")
137
136
  root.at("//bibdata/keyword | //bibdata/ext/keyword") or
@@ -144,6 +143,14 @@ module Metanorma
144
143
  root.at("//submitters") or @log.add("Style", nil,
145
144
  "Submitters is missing!")
146
145
  end
146
+
147
+ def norm_ref_validate(doc)
148
+ @doctype == "engineering-report" or return super
149
+ doc.xpath("//references[@normative = 'true']").each do |b|
150
+ @log.add("Bibliography", b,
151
+ "Engineering report should not contain normative references")
152
+ end
153
+ end
147
154
  end
148
155
  end
149
156
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.3.7".freeze
3
+ VERSION = "2.3.9".freeze
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
27
27
 
28
28
  spec.add_dependency "iso-639"
29
- spec.add_dependency "metanorma-standoc", "~> 2.4.0"
29
+ spec.add_dependency "metanorma-standoc", "~> 2.4.2"
30
30
 
31
31
  spec.add_development_dependency "debug"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.7
4
+ version: 2.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-27 00:00:00.000000000 Z
11
+ date: 2023-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.4.0
33
+ version: 2.4.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.4.0
40
+ version: 2.4.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -238,6 +238,8 @@ files:
238
238
  - lib/isodoc/ogc/html/ogc.scss
239
239
  - lib/isodoc/ogc/html/ogc_wp.css
240
240
  - lib/isodoc/ogc/html/ogc_wp.scss
241
+ - lib/isodoc/ogc/html/preprocess.xslt
242
+ - lib/isodoc/ogc/html/rouge.css
241
243
  - lib/isodoc/ogc/html/scripts.html
242
244
  - lib/isodoc/ogc/html/word_ogc_intro.html
243
245
  - lib/isodoc/ogc/html/word_ogc_intro_wp.html