metanorma-ogc 2.0.8 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/ogc/biblio.rb +1 -134
  3. data/lib/isodoc/ogc/html/html_ogc_titlepage.html +2 -0
  4. data/lib/isodoc/ogc/html/word_ogc_intro.html +2 -3
  5. data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +1 -2
  6. data/lib/isodoc/ogc/html/word_ogc_titlepage.html +20 -17
  7. data/lib/isodoc/ogc/html/word_ogc_titlepage_wp.html +3 -0
  8. data/lib/isodoc/ogc/init.rb +5 -6
  9. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1501 -276
  10. data/lib/isodoc/ogc/ogc.best-practice.xsl +1501 -276
  11. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1501 -276
  12. data/lib/isodoc/ogc/ogc.community-practice.xsl +1501 -276
  13. data/lib/isodoc/ogc/ogc.community-standard.xsl +1501 -276
  14. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1501 -276
  15. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1501 -276
  16. data/lib/isodoc/ogc/ogc.other.xsl +1501 -276
  17. data/lib/isodoc/ogc/ogc.policy.xsl +1501 -276
  18. data/lib/isodoc/ogc/ogc.reference-model.xsl +1501 -276
  19. data/lib/isodoc/ogc/ogc.release-notes.xsl +1501 -276
  20. data/lib/isodoc/ogc/ogc.standard.xsl +1501 -276
  21. data/lib/isodoc/ogc/ogc.test-suite.xsl +1501 -276
  22. data/lib/isodoc/ogc/ogc.user-guide.xsl +1501 -276
  23. data/lib/isodoc/ogc/ogc.white-paper.xsl +1506 -283
  24. data/lib/isodoc/ogc/presentation_xml_convert.rb +14 -10
  25. data/lib/isodoc/ogc/word_convert.rb +4 -4
  26. data/lib/isodoc/ogc/xref.rb +6 -2
  27. data/lib/metanorma/ogc/biblio.rng +37 -8
  28. data/lib/metanorma/ogc/isodoc.rng +56 -0
  29. data/lib/metanorma/ogc/version.rb +1 -1
  30. data/lib/relaton/render/config.yml +10 -0
  31. data/lib/relaton/render/date.rb +9 -0
  32. data/lib/relaton/render/fields.rb +23 -0
  33. data/lib/relaton/render/general.rb +25 -0
  34. data/lib/relaton/render/parse.rb +11 -0
  35. data/metanorma-ogc.gemspec +1 -1
  36. metadata +9 -4
@@ -2,6 +2,7 @@ require_relative "init"
2
2
  require_relative "reqt"
3
3
  require "isodoc"
4
4
  require "uuidtools"
5
+ require_relative "../../relaton/render/general"
5
6
 
6
7
  module IsoDoc
7
8
  module Ogc
@@ -97,7 +98,7 @@ module IsoDoc
97
98
 
98
99
  def example1(elem)
99
100
  lbl = @xrefs.anchor(elem["id"], :label, false) or return
100
- prefix_name(elem, " — ", l10n("#{@i18n.example} #{lbl}"),
101
+ prefix_name(elem, " — ", l10n("#{@i18n.example} #{lbl}"),
101
102
  "name")
102
103
  end
103
104
 
@@ -169,15 +170,6 @@ module IsoDoc
169
170
  references(docxml)
170
171
  end
171
172
 
172
- def references(docxml)
173
- super
174
- docxml.xpath(ns("//bibitem/date")).each do |d|
175
- d.xpath(ns("./on | ./from | ./to")).each do |d1|
176
- d1.children = d1.text.sub(/^(\d\d\d\d).*$/, "\\1")
177
- end
178
- end
179
- end
180
-
181
173
  def bibdata(docxml)
182
174
  docxml.xpath(ns("//bibdata/contributor[@type = 'author']")).each do |a|
183
175
  a.at(ns("./description"))&.text == "contributor" and
@@ -230,6 +222,18 @@ module IsoDoc
230
222
  bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
231
223
  end
232
224
 
225
+ def bibrenderer
226
+ ::Relaton::Render::Ogc::General.new(language: @lang)
227
+ end
228
+
229
+ def bibrender(xml)
230
+ unless xml.at(ns("./formattedref"))
231
+ xml.children =
232
+ "#{bibrenderer.render(xml.to_xml)}"\
233
+ "#{xml.xpath(ns('./docidentifier | ./uri | ./note | ./status')).to_xml}"
234
+ end
235
+ end
236
+
233
237
  include Init
234
238
  end
235
239
  end
@@ -102,7 +102,7 @@ module IsoDoc
102
102
  submitters docxml, div2
103
103
  preface docxml, div2
104
104
  acknowledgements docxml, div2
105
- div2.p { |p| p << "&nbsp;" } # placeholder
105
+ div2.p { |p| p << "&#xA0;" } # placeholder
106
106
  end
107
107
  section_break(body)
108
108
  end
@@ -157,15 +157,15 @@ module IsoDoc
157
157
 
158
158
  def toWord(result, filename, dir, header)
159
159
  result = from_xhtml(word_cleanup(to_xhtml(result)))
160
+ .gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
160
161
  @wordstylesheet = wordstylesheet_update
161
- Html2Doc.process(
162
- result,
162
+ Html2Doc.new(
163
163
  filename: filename, imagedir: @localdir,
164
164
  stylesheet: @wordstylesheet&.path,
165
165
  header_file: header&.path, dir: dir,
166
166
  asciimathdelims: [@openmathdelim, @closemathdelim],
167
167
  liststyles: { ul: @ulstyle, ol: @olstyle, steps: "l4" }
168
- )
168
+ ).process(result)
169
169
  header&.unlink
170
170
  @wordstylesheet.unlink if @wordstylesheet.is_a?(Tempfile)
171
171
  end
@@ -130,6 +130,7 @@ module IsoDoc
130
130
  end
131
131
 
132
132
  def initial_anchor_names(doc)
133
+ if @parse_settings.empty? || @parse_settings[:clauses]
133
134
  preface_anchor_names(doc)
134
135
  n = Counter.new
135
136
  n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
@@ -140,10 +141,13 @@ module IsoDoc
140
141
  n, 1
141
142
  )
142
143
  n = section_names(doc.at(ns("//sections/definitions")), n, 1)
143
- middle_section_asset_names(doc)
144
144
  clause_names(doc, n)
145
+ end
146
+ if @parse_settings.empty?
147
+ middle_section_asset_names(doc)
145
148
  termnote_anchor_names(doc)
146
149
  termexample_anchor_names(doc)
150
+ end
147
151
  end
148
152
 
149
153
  def preface_anchor_names(doc)
@@ -217,7 +221,7 @@ module IsoDoc
217
221
  super
218
222
  return unless @klass.ogc_draft_ref?(ref)
219
223
 
220
- @anchors[ref["id"]] = { xref: "#{@anchors[ref['id']][:xref]} (draft)" }
224
+ @anchors[ref["id"]] = { xref: "#{@anchors[ref['id']][:xref]} (draft)" }
221
225
  end
222
226
  end
223
227
  end
@@ -851,17 +851,46 @@
851
851
  </define>
852
852
  <define name="bplace">
853
853
  <element name="place">
854
- <optional>
855
- <attribute name="uri">
856
- <data type="anyURI"/>
857
- </attribute>
858
- </optional>
859
- <optional>
860
- <attribute name="region"/>
861
- </optional>
854
+ <choice>
855
+ <text/>
856
+ <group>
857
+ <ref name="bibliocity"/>
858
+ <zeroOrMore>
859
+ <ref name="biblioregion"/>
860
+ </zeroOrMore>
861
+ <zeroOrMore>
862
+ <ref name="bibliocountry"/>
863
+ </zeroOrMore>
864
+ </group>
865
+ </choice>
866
+ </element>
867
+ </define>
868
+ <define name="bibliocity">
869
+ <element name="city">
862
870
  <text/>
863
871
  </element>
864
872
  </define>
873
+ <define name="biblioregion">
874
+ <element name="region">
875
+ <ref name="RegionType"/>
876
+ </element>
877
+ </define>
878
+ <define name="bibliocountry">
879
+ <element name="country">
880
+ <ref name="RegionType"/>
881
+ </element>
882
+ </define>
883
+ <define name="RegionType">
884
+ <optional>
885
+ <attribute name="iso"/>
886
+ </optional>
887
+ <optional>
888
+ <attribute name="recommended">
889
+ <data type="boolean"/>
890
+ </attribute>
891
+ </optional>
892
+ <text/>
893
+ </define>
865
894
  <define name="bprice">
866
895
  <element name="price">
867
896
  <attribute name="currency"/>
@@ -32,6 +32,43 @@
32
32
  <ref name="DocumentType"/>
33
33
  </element>
34
34
  </define>
35
+ <define name="admonition">
36
+ <element name="admonition">
37
+ <attribute name="type">
38
+ <ref name="AdmonitionType"/>
39
+ </attribute>
40
+ <optional>
41
+ <attribute name="class"/>
42
+ </optional>
43
+ <attribute name="id">
44
+ <data type="ID"/>
45
+ </attribute>
46
+ <optional>
47
+ <attribute name="uri">
48
+ <data type="anyURI"/>
49
+ </attribute>
50
+ </optional>
51
+ <optional>
52
+ <attribute name="coverpage">
53
+ <data type="boolean"/>
54
+ </attribute>
55
+ </optional>
56
+ <optional>
57
+ <attribute name="notag">
58
+ <data type="boolean"/>
59
+ </attribute>
60
+ </optional>
61
+ <optional>
62
+ <ref name="tname"/>
63
+ </optional>
64
+ <zeroOrMore>
65
+ <ref name="paragraph-with-footnote"/>
66
+ </zeroOrMore>
67
+ <zeroOrMore>
68
+ <ref name="note"/>
69
+ </zeroOrMore>
70
+ </element>
71
+ </define>
35
72
  <define name="index">
36
73
  <element name="index">
37
74
  <optional>
@@ -851,6 +888,16 @@
851
888
  <ref name="MultilingualRenderingType"/>
852
889
  </attribute>
853
890
  </optional>
891
+ <optional>
892
+ <attribute name="coverpage">
893
+ <data type="boolean"/>
894
+ </attribute>
895
+ </optional>
896
+ <optional>
897
+ <attribute name="notag">
898
+ <data type="boolean"/>
899
+ </attribute>
900
+ </optional>
854
901
  <oneOrMore>
855
902
  <choice>
856
903
  <ref name="paragraph"/>
@@ -1178,6 +1225,7 @@
1178
1225
  <ref name="concept"/>
1179
1226
  <ref name="add"/>
1180
1227
  <ref name="del"/>
1228
+ <ref name="span"/>
1181
1229
  </choice>
1182
1230
  </define>
1183
1231
  <define name="add">
@@ -1204,6 +1252,14 @@
1204
1252
  </choice>
1205
1253
  </element>
1206
1254
  </define>
1255
+ <define name="span">
1256
+ <element name="span">
1257
+ <attribute name="class"/>
1258
+ <oneOrMore>
1259
+ <ref name="TextElement"/>
1260
+ </oneOrMore>
1261
+ </element>
1262
+ </define>
1207
1263
  <define name="concept">
1208
1264
  <element name="concept">
1209
1265
  <optional>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.0.8".freeze
3
+ VERSION = "2.1.1".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,10 @@
1
+ template:
2
+ # skip standardidentifier, it is inserted in front of formattedref within metanorma
3
+ standard: "{% if creatornames %}{{ creatornames }} ({{role}}){%else%}{{ publisher_abbrev}}{%endif%} : {{standardidentifier|first}} {{draft}} , <em>{{ title }}</em>. {{ publisher }}{%if place%},{%endif%} {{ place }} ({{date}}). {{uri}}."
4
+ misc: standard
5
+ techreport: standard
6
+ nametemplate:
7
+ one: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0]}}{% endif %}"
8
+ two: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0]}}{% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{ initials[1]}}{% endif %}"
9
+ more: "{% if nonpersonal[0] %}{{ nonpersonal[0] }}{% else %}{{surname[0] }} {{initials[0]}} {% endif %} , {% if nonpersonal[1] %}{{ nonpersonal[1] }}{% else %}{{surname[1]}} {{ initials[1]}} {% endif %} , {% if nonpersonal[2] %}{{ nonpersonal[2] }}{% else %}{{surname[2]}} {{initials[2]}}{% endif %}"
10
+
@@ -0,0 +1,9 @@
1
+ module Relaton
2
+ module Render
3
+ class Date
4
+ def render
5
+ @date&.sub(/-.*$/, "")
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ require_relative "date"
2
+
3
+ module Relaton
4
+ module Render
5
+ module Ogc
6
+ class Fields < ::Relaton::Render::Fields
7
+ def name_fields_format(hash)
8
+ super
9
+ hash[:publisher_abbrev] = hash[:publisher_abbrev_raw]&.join("/")
10
+ end
11
+
12
+ def draftformat(num, hash)
13
+ return nil unless hash[:publisher] == "Open Geospatial Consortium"
14
+ return nil unless num[:status]
15
+ return nil if %w(approved published deprecated retired)
16
+ .include?(num[:status])
17
+
18
+ "(Draft)"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ require "relaton-render"
2
+ require_relative "parse"
3
+ require_relative "fields"
4
+
5
+ module Relaton
6
+ module Render
7
+ module Ogc
8
+ class General < ::Relaton::Render::IsoDoc::General
9
+ def config_loc
10
+ YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
11
+ end
12
+
13
+ def klass_initialize(_options)
14
+ @nametemplateklass = Relaton::Render::Template::Name
15
+ @seriestemplateklass = Relaton::Render::Template::Series
16
+ @extenttemplateklass = Relaton::Render::Template::Extent
17
+ @sizetemplateklass = Relaton::Render::Template::Size
18
+ @generaltemplateklass = Relaton::Render::Template::General
19
+ @fieldsklass = Relaton::Render::Ogc::Fields
20
+ @parseklass = Relaton::Render::Ogc::Parse
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ module Relaton
2
+ module Render
3
+ module Ogc
4
+ class Parse < ::Relaton::Render::Parse
5
+ def creatornames_roles_allowed
6
+ %w(author performer adapter translator editor)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
26
 
27
27
  spec.add_dependency "iso-639"
28
- spec.add_dependency "metanorma-standoc", "~> 2.0.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 2.1.0"
29
29
 
30
30
  spec.add_development_dependency "debug"
31
31
  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.0.8
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-18 00:00:00.000000000 Z
11
+ date: 2022-05-16 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.0.0
33
+ version: 2.1.0
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.0.0
40
+ version: 2.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -265,6 +265,11 @@ files:
265
265
  - lib/metanorma/ogc/reqt.rng
266
266
  - lib/metanorma/ogc/validate.rb
267
267
  - lib/metanorma/ogc/version.rb
268
+ - lib/relaton/render/config.yml
269
+ - lib/relaton/render/date.rb
270
+ - lib/relaton/render/fields.rb
271
+ - lib/relaton/render/general.rb
272
+ - lib/relaton/render/parse.rb
268
273
  - metanorma-ogc.gemspec
269
274
  homepage: https://github.com/metanorma/metanorma-ogc
270
275
  licenses: