metanorma-ogc 1.5.2 → 1.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/lib/asciidoctor/ogc/cleanup.rb +35 -9
  4. data/lib/asciidoctor/ogc/converter.rb +6 -4
  5. data/lib/asciidoctor/ogc/isodoc.rng +61 -18
  6. data/lib/asciidoctor/ogc/validate.rb +12 -0
  7. data/lib/isodoc/ogc/base_convert.rb +2 -1
  8. data/lib/isodoc/ogc/html/htmlstyle.css +33 -14
  9. data/lib/isodoc/ogc/html/htmlstyle.scss +16 -10
  10. data/lib/isodoc/ogc/html/ogc.css +0 -1
  11. data/lib/isodoc/ogc/html/ogc.scss +0 -1
  12. data/lib/isodoc/ogc/html/ogc_wp.css +0 -1
  13. data/lib/isodoc/ogc/html/ogc_wp.scss +0 -1
  14. data/lib/isodoc/ogc/html/scripts.html +0 -1
  15. data/lib/isodoc/ogc/html/wordstyle.css +30 -18
  16. data/lib/isodoc/ogc/html/wordstyle.scss +30 -18
  17. data/lib/isodoc/ogc/html/wordstyle_wp.css +22 -12
  18. data/lib/isodoc/ogc/html/wordstyle_wp.scss +22 -12
  19. data/lib/isodoc/ogc/html_convert.rb +1 -0
  20. data/lib/isodoc/ogc/metadata.rb +7 -2
  21. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +457 -123
  22. data/lib/isodoc/ogc/ogc.best-practice.xsl +457 -123
  23. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +457 -123
  24. data/lib/isodoc/ogc/ogc.community-practice.xsl +457 -123
  25. data/lib/isodoc/ogc/ogc.community-standard.xsl +457 -123
  26. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +457 -123
  27. data/lib/isodoc/ogc/ogc.engineering-report.xsl +457 -123
  28. data/lib/isodoc/ogc/ogc.other.xsl +457 -123
  29. data/lib/isodoc/ogc/ogc.policy.xsl +457 -123
  30. data/lib/isodoc/ogc/ogc.reference-model.xsl +457 -123
  31. data/lib/isodoc/ogc/ogc.release-notes.xsl +457 -123
  32. data/lib/isodoc/ogc/ogc.standard.xsl +457 -123
  33. data/lib/isodoc/ogc/ogc.test-suite.xsl +457 -123
  34. data/lib/isodoc/ogc/ogc.user-guide.xsl +457 -123
  35. data/lib/isodoc/ogc/ogc.white-paper.xsl +334 -95
  36. data/lib/isodoc/ogc/presentation_xml_convert.rb +54 -4
  37. data/lib/isodoc/ogc/reqt.rb +1 -1
  38. data/lib/isodoc/ogc/sections.rb +9 -2
  39. data/lib/isodoc/ogc/word_convert.rb +28 -4
  40. data/lib/isodoc/ogc/xref.rb +4 -2
  41. data/lib/metanorma/ogc/version.rb +1 -1
  42. data/metanorma-ogc.gemspec +1 -1
  43. metadata +8 -8
@@ -13,9 +13,10 @@ module IsoDoc
13
13
  end
14
14
 
15
15
  def insert_preface_sections(docxml)
16
- insert_keywords(docxml)
16
+ insert_executivesummary(docxml)
17
17
  insert_submitting_orgs(docxml)
18
18
  insert_security(docxml)
19
+ insert_keywords(docxml)
19
20
  end
20
21
 
21
22
  def preface_init_insert_pt(docxml)
@@ -42,6 +43,17 @@ module IsoDoc
42
43
  end
43
44
  end
44
45
 
46
+ def insert_executivesummary(docxml)
47
+ s = docxml&.at(ns("//preface/clause[@type = 'executivesummary']"))
48
+ &.remove or return
49
+ if a = docxml.at(ns("//preface/abstract"))
50
+ a.next = s
51
+ else
52
+ preface_init_insert_pt(docxml)&.children&.first
53
+ &.add_previous_sibling(s)
54
+ end
55
+ end
56
+
45
57
  def insert_submitting_orgs(docxml)
46
58
  orgs = docxml.xpath(ns(submittingorgs_path))
47
59
  .each_with_object([]) do |org, m|
@@ -81,7 +93,9 @@ module IsoDoc
81
93
  def insert_keywords(docxml)
82
94
  kw = @meta.get[:keywords]
83
95
  kw.empty? and return
84
- if abstract = docxml.at(ns("//preface/abstract"))
96
+ if abstract =
97
+ docxml.at(ns("//preface/clause[@type = 'executivesummary']")) ||
98
+ docxml.at(ns("//preface/abstract"))
85
99
  abstract.next = keyword_clause(kw)
86
100
  else
87
101
  preface_init_insert_pt(docxml)&.children&.first
@@ -157,6 +171,7 @@ module IsoDoc
157
171
  def block(docxml)
158
172
  super
159
173
  recommendation_to_table(docxml)
174
+ ol docxml
160
175
  end
161
176
 
162
177
  def section(docxml)
@@ -174,14 +189,49 @@ module IsoDoc
174
189
  end
175
190
 
176
191
  def bibdata_i18n(bib)
177
- stage = bib&.at(ns("./status/stage"))
178
192
  doctype = bib&.at(ns("./ext/doctype"))
193
+ rename_stage(bib&.at(ns("./status/stage")), doctype, bib)
194
+ rename_doctype(doctype, bib&.at(ns("./date[@type = 'published']")) ||
195
+ bib&.at(ns("./date[@type = 'issued']")))
196
+ super
197
+ end
198
+
199
+ def rename_stage(stage, doctype, _bib)
179
200
  if stage&.text == "approved" &&
180
201
  !%w(standard abstract-specification-topic
181
202
  community-standard).include?(doctype&.text)
182
203
  stage.children = "published"
183
204
  end
184
- super
205
+ end
206
+
207
+ def rename_doctype(doctype, date)
208
+ return unless doctype&.text == "white-paper" && date
209
+
210
+ if Date.iso8601(date.text) >= Date.iso8601("2021-12-16")
211
+ doctype.children = "technical-paper"
212
+ end
213
+ end
214
+
215
+ def ol(docxml)
216
+ docxml.xpath(ns("//ol")).each do |f|
217
+ ol1(f)
218
+ end
219
+ end
220
+
221
+ def ol1(elem)
222
+ return unless elem["class"] == "steps"
223
+
224
+ idx = elem.xpath("./ancestor-or-self::xmlns:ol[@class = 'steps']").size
225
+ elem["type"] = %w(arabic alphabet roman alphabet_upper
226
+ roman_upper)[(idx - 1) % 5]
227
+ end
228
+
229
+ def termsource1(elem)
230
+ while elem&.next_element&.name == "termsource"
231
+ elem << "; #{elem.next_element.remove.children.to_xml}"
232
+ end
233
+ elem.children = l10n("[<strong>#{@i18n.source}:</strong> "\
234
+ "#{elem.children.to_xml.strip}]")
185
235
  end
186
236
 
187
237
  include Init
@@ -114,7 +114,7 @@ module IsoDoc
114
114
 
115
115
  def preserve_in_nested_table?(node)
116
116
  return true if %w(recommendation requirement permission
117
- table).include?(node.name)
117
+ table ol dl ul).include?(node.name)
118
118
 
119
119
  false
120
120
  end
@@ -20,7 +20,13 @@ module IsoDoc
20
20
  end
21
21
 
22
22
  def security(docxml, out)
23
- f = docxml.at(ns("//preface/clause[@type = 'security']")) || return
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
24
30
  intro_clause(f, out)
25
31
  end
26
32
 
@@ -31,7 +37,8 @@ module IsoDoc
31
37
 
32
38
  def preface(isoxml, out)
33
39
  isoxml.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
34
- "@type = 'submitting_orgs' or @type = 'security')]"))
40
+ "@type = 'submitting_orgs' or @type = 'security' or "\
41
+ "@type = 'executivesummary')]"))
35
42
  .each do |f|
36
43
  intro_clause(f, out)
37
44
  end
@@ -86,7 +86,7 @@ module IsoDoc
86
86
  <span lang="EN-GB"><span
87
87
  style='mso-element:field-begin'></span><span
88
88
  style='mso-spacerun:yes'>&#xA0;</span>TOC
89
- \\h \\z \\t &quot;RecommendationTitle,recommendationtitle&quot;#{' '}
89
+ \\h \\z \\t &quot;RecommendationTitle,RecommendationTestTitle,recommendationtitle,recommendationtesttitle&quot;#{' '}
90
90
  <span style='mso-element:field-separator'></span></span>
91
91
  TOC
92
92
 
@@ -131,13 +131,37 @@ module IsoDoc
131
131
 
132
132
  def make_RecommendationWordToC(docxml)
133
133
  toc = ""
134
- docxml.xpath("//p[@class = 'RecommendationTitle']").each do |h|
134
+ docxml.xpath("//p[@class = 'RecommendationTitle' or @class = 'RecommendationTestTitle']").sort_by do |h|
135
+ recommmendation_sort_key(h.text)
136
+ end.each do |h|
135
137
  toc += word_toc_entry(1, header_strip(h))
136
138
  end
137
139
  toc.sub(/(<p class="MsoToc1">)/,
138
140
  %{\\1#{WORD_TOC_RECOMMENDATION_PREFACE1}}) + WORD_TOC_SUFFIX1
139
141
  end
140
142
 
143
+ def recommmendation_sort_key(header)
144
+ m = /^([^0-9]+) (\d+)/.match(header) || /^([^:]+)/.match(header)
145
+ "#{recommmendation_sort_key1(m[1])}::#{'%04d' % m[2].to_i}"
146
+ end
147
+
148
+ def recommmendation_sort_key1(type)
149
+ case type.downcase
150
+ when "requirements class" then "01"
151
+ when "recommendations class" then "02"
152
+ when "permissions class" then "03"
153
+ when "requirement" then "04"
154
+ when "recommendation" then "05"
155
+ when "permission" then "06"
156
+ when "conformance class" then "07"
157
+ when "abstract test" then "08"
158
+ when "requirements test" then "09"
159
+ when "recommendations test" then "10"
160
+ when "permissions test" then "11"
161
+ else "z"
162
+ end
163
+ end
164
+
141
165
  def make_body2(body, docxml)
142
166
  body.div **{ class: "WordSection2" } do |div2|
143
167
  @prefacenum = 0
@@ -145,6 +169,7 @@ module IsoDoc
145
169
  boilerplate docxml, div2
146
170
  preface_block docxml, div2
147
171
  abstract docxml, div2
172
+ executivesummary docxml, div2
148
173
  keywords docxml, div2
149
174
  foreword docxml, div2
150
175
  introduction docxml, div2
@@ -211,8 +236,7 @@ module IsoDoc
211
236
  @wordstylesheet = wordstylesheet_update
212
237
  Html2Doc.process(
213
238
  result,
214
- filename: filename,
215
- imagedir: @localdir,
239
+ filename: filename, imagedir: @localdir,
216
240
  stylesheet: @wordstylesheet&.path,
217
241
  header_file: header&.path, dir: dir,
218
242
  asciimathdelims: [@openmathdelim, @closemathdelim],
@@ -141,14 +141,16 @@ module IsoDoc
141
141
 
142
142
  def preface_anchor_names(doc)
143
143
  @prefacenum = 0
144
- ["//preface/abstract", "//preface/clause[@type = 'keywords']",
144
+ ["//preface/abstract", "//preface/clause[@type = 'executivesummary']",
145
+ "//preface/clause[@type = 'keywords']",
145
146
  "//foreword", "//introduction", "//preface/clause[@type = 'security']",
146
147
  "//preface/clause[@type = 'submitting_orgs']",
147
148
  "//submitters"].each do |path|
148
149
  preface_names_numbered(doc.at(ns(path)))
149
150
  end
150
151
  doc.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
151
- "@type = 'submitting_orgs' or @type = 'security')]"))
152
+ "@type = 'submitting_orgs' or @type = 'security' or "\
153
+ "@type = 'executivesummary')]"))
152
154
  .each { |c| preface_names_numbered(c) }
153
155
  preface_names_numbered(doc.at(ns("//acknowledgements")))
154
156
  sequential_asset_names(
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "1.5.2".freeze
3
+ VERSION = "1.5.5".freeze
4
4
  end
5
5
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "iso-639"
28
28
  spec.add_dependency "metanorma-standoc", "~> 1.11.0"
29
29
 
30
- spec.add_development_dependency "byebug", "~> 9.1"
30
+ spec.add_development_dependency "debug"
31
31
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
32
32
  spec.add_development_dependency "guard", "~> 2.14"
33
33
  spec.add_development_dependency "guard-rspec", "~> 4.7"
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: 1.5.2
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2021-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.11.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: byebug
42
+ name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '9.1'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '9.1'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: equivalent-xml
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -286,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
286
  - !ruby/object:Gem::Version
287
287
  version: '0'
288
288
  requirements: []
289
- rubygems_version: 3.2.22
289
+ rubygems_version: 3.2.32
290
290
  signing_key:
291
291
  specification_version: 4
292
292
  summary: Metanorma for the Open Geospatial Consortium.