metanorma-ogc 2.3.8 → 2.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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">
@@ -1349,15 +1350,19 @@
1349
1350
  </choice>
1350
1351
  </element>
1351
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>
1352
1363
  <define name="standard-document">
1353
1364
  <element name="standard-document">
1354
- <attribute name="version"/>
1355
- <attribute name="type">
1356
- <choice>
1357
- <value>semantic</value>
1358
- <value>presentation</value>
1359
- </choice>
1360
- </attribute>
1365
+ <ref name="Root-Attributes"/>
1361
1366
  <ref name="bibdata"/>
1362
1367
  <optional>
1363
1368
  <ref name="misccontainer"/>
@@ -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.8".freeze
3
+ VERSION = "2.3.9".freeze
4
4
  end
5
5
  end
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.8
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-04-10 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