metanorma-ogc 1.1.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +0 -1
  3. data/.github/workflows/ubuntu.yml +10 -7
  4. data/.github/workflows/windows.yml +0 -1
  5. data/Rakefile +2 -0
  6. data/lib/asciidoctor/ogc/boilerplate.xml +3 -3
  7. data/lib/asciidoctor/ogc/converter.rb +11 -7
  8. data/lib/asciidoctor/ogc/front.rb +7 -19
  9. data/lib/asciidoctor/ogc/isodoc.rng +12 -6
  10. data/lib/asciidoctor/ogc/validate.rb +13 -25
  11. data/lib/isodoc/ogc/base_convert.rb +2 -26
  12. data/lib/isodoc/ogc/biblio.rb +33 -4
  13. data/lib/isodoc/ogc/html/_coverpage.css +195 -0
  14. data/lib/isodoc/ogc/html/header_wp.html +210 -0
  15. data/lib/isodoc/ogc/html/htmlstyle.css +1084 -0
  16. data/lib/isodoc/ogc/html/logo.png +0 -0
  17. data/lib/isodoc/ogc/html/ogc.css +838 -0
  18. data/lib/isodoc/ogc/html/ogc.scss +4 -2
  19. data/lib/isodoc/ogc/html/ogc_wp.css +758 -0
  20. data/lib/isodoc/ogc/html/ogc_wp.scss +724 -0
  21. data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +14 -0
  22. data/lib/isodoc/ogc/html/word_ogc_titlepage_wp.html +175 -0
  23. data/lib/isodoc/ogc/html/wordstyle.css +1253 -0
  24. data/lib/isodoc/ogc/html/wordstyle.scss +8 -9
  25. data/lib/isodoc/ogc/html/wordstyle_wp.css +1181 -0
  26. data/lib/isodoc/ogc/html/wordstyle_wp.scss +1093 -0
  27. data/lib/isodoc/ogc/html_convert.rb +2 -0
  28. data/lib/isodoc/ogc/i18n-en.yaml +1 -0
  29. data/lib/isodoc/ogc/i18n.rb +10 -0
  30. data/lib/isodoc/ogc/init.rb +41 -0
  31. data/lib/isodoc/ogc/metadata.rb +31 -28
  32. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1690 -1543
  33. data/lib/isodoc/ogc/ogc.best-practice.xsl +1690 -1543
  34. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1690 -1543
  35. data/lib/isodoc/ogc/ogc.community-practice.xsl +1690 -1543
  36. data/lib/isodoc/ogc/ogc.community-standard.xsl +1690 -1543
  37. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1690 -1543
  38. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1690 -1543
  39. data/lib/isodoc/ogc/ogc.other.xsl +1690 -1543
  40. data/lib/isodoc/ogc/ogc.policy.xsl +1690 -1543
  41. data/lib/isodoc/ogc/ogc.reference-model.xsl +1690 -1543
  42. data/lib/isodoc/ogc/ogc.release-notes.xsl +1690 -1543
  43. data/lib/isodoc/ogc/ogc.standard.xsl +1690 -1543
  44. data/lib/isodoc/ogc/ogc.test-suite.xsl +1690 -1543
  45. data/lib/isodoc/ogc/ogc.user-guide.xsl +1690 -1543
  46. data/lib/isodoc/ogc/ogc.white-paper.xsl +1776 -1864
  47. data/lib/isodoc/ogc/presentation_xml_convert.rb +128 -1
  48. data/lib/isodoc/ogc/reqt.rb +4 -26
  49. data/lib/isodoc/ogc/sections.rb +18 -64
  50. data/lib/isodoc/ogc/word_convert.rb +26 -7
  51. data/lib/isodoc/ogc/xref.rb +28 -23
  52. data/lib/metanorma/ogc/processor.rb +0 -4
  53. data/lib/metanorma/ogc/version.rb +1 -1
  54. data/metanorma-ogc.gemspec +3 -4
  55. metadata +34 -34
@@ -1,9 +1,136 @@
1
- require_relative "base_convert"
1
+ require_relative "init"
2
2
  require "isodoc"
3
+ require "uuidtools"
3
4
 
4
5
  module IsoDoc
5
6
  module Ogc
6
7
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
8
+ def convert1(docxml, filename, dir)
9
+ info docxml, nil
10
+ insert_preface_sections(docxml)
11
+ super
12
+ end
13
+
14
+ def insert_preface_sections(docxml)
15
+ insert_keywords(docxml)
16
+ insert_submitting_orgs(docxml)
17
+ end
18
+
19
+ def preface_init_insert_pt(docxml)
20
+ docxml.at(ns("//preface")) ||
21
+ docxml.at(ns("//sections")).
22
+ add_previous_sibling("<preface> </preface>").first
23
+ end
24
+
25
+ def submit_orgs_append_pt(docxml)
26
+ docxml.at(ns("//introduction")) ||
27
+ docxml.at(ns("//foreword")) ||
28
+ docxml.at(ns("//preface/clause[@type = 'keywords']")) ||
29
+ docxml.at(ns("//preface/abstract"))
30
+ end
31
+
32
+ def insert_submitting_orgs(docxml)
33
+ orgs = []
34
+ docxml.xpath(ns(submittingorgs_path)).each { |org| orgs << org.text }
35
+ return if orgs.empty?
36
+ if a = submit_orgs_append_pt(docxml)
37
+ a.next = submitting_orgs_clause(orgs)
38
+ else
39
+ preface_init_insert_pt(docxml)&.children&.first&.
40
+ add_previous_sibling(submitting_orgs_clause(orgs))
41
+ end
42
+ end
43
+
44
+ def submitting_orgs_clause(orgs)
45
+ <<~END
46
+ <clause id="_#{UUIDTools::UUID.random_create}" type="submitting_orgs">
47
+ <title>Submitting Organizations</title>
48
+ <p>The following organizations submitted this Document to the
49
+ Open Geospatial Consortium (OGC):</p>
50
+ <ul>#{orgs.map { |m| "<li>#{m}</li>" }.join("\n")}</ul>
51
+ </clause>
52
+ END
53
+ end
54
+
55
+ def keyword_clause(kw)
56
+ <<~END
57
+ <clause id="_#{UUIDTools::UUID.random_create}" type="keywords">
58
+ <title>Keywords</title>
59
+ <p>The following are keywords to be used by search engines and
60
+ document catalogues.</p>
61
+ <p>#{kw.join(", ")}</p></clause>
62
+ END
63
+ end
64
+
65
+ def insert_keywords(docxml)
66
+ kw = @meta.get[:keywords]
67
+ kw.empty? and return
68
+ if abstract = docxml.at(ns("//preface/abstract"))
69
+ abstract.next = keyword_clause(kw)
70
+ else
71
+ preface_init_insert_pt(docxml)&.children&.first&.
72
+ add_previous_sibling(keyword_clause(kw))
73
+ end
74
+ end
75
+
76
+ def example1(f)
77
+ lbl = @xrefs.anchor(f['id'], :label, false) or return
78
+ prefix_name(f, "&nbsp;&mdash; ", l10n("#{@i18n.example} #{lbl}"), "name")
79
+ end
80
+
81
+ def recommendation1(f, type)
82
+ type = recommendation_class(f)
83
+ label = f&.at(ns("./label"))&.text
84
+ if inject_crossreference_reqt?(f, label)
85
+ n = @xrefs.anchor(@xrefs.reqtlabels[label], :xref, false)
86
+ lbl = (n.nil? ? type : n)
87
+ f&.at(ns("./title"))&.remove # suppress from display if embedded
88
+ else
89
+ n = @xrefs.anchor(f['id'], :label, false)
90
+ lbl = (n.nil? ? type : l10n("#{type} #{n}"))
91
+ end
92
+ prefix_name(f, "", lbl, "name")
93
+ end
94
+
95
+ # embedded reqts xref to top level reqts via label lookup
96
+ def inject_crossreference_reqt?(node, label)
97
+ !node.ancestors("requirement, recommendation, permission").empty? &&
98
+ @xrefs.reqtlabels[label]
99
+ end
100
+
101
+ def recommendation_class(node)
102
+ case node["type"]
103
+ when "verification" then @i18n.get["#{node.name}test"]
104
+ when "class" then @i18n.get["#{node.name}class"]
105
+ when "abstracttest" then @i18n.get["abstracttest"]
106
+ when "conformanceclass" then @i18n.get["conformanceclass"]
107
+ else
108
+ case node.name
109
+ when "recommendation" then @i18n.recommendation
110
+ when "requirement" then @i18n.requirement
111
+ when "permission" then @i18n.permission
112
+ end
113
+ end
114
+ end
115
+
116
+ def annex1(f)
117
+ lbl = @xrefs.anchor(f['id'], :label)
118
+ if t = f.at(ns("./title"))
119
+ t.children = "<strong>#{t.children.to_xml}</strong>"
120
+ end
121
+ prefix_name(f, "<br/>", lbl, "title")
122
+ end
123
+
124
+ def clause(docxml)
125
+ super
126
+ docxml.xpath(ns("//foreword | //preface/abstract | "\
127
+ "//submitters | //introduction | //acknowledgements")).
128
+ each do |f|
129
+ clause1(f)
130
+ end
131
+ end
132
+
133
+ include Init
7
134
  end
8
135
  end
9
136
  end
@@ -28,18 +28,14 @@ module IsoDoc
28
28
  def recommendation_name(node, out, type)
29
29
  label, title, lbl = recommendation_labels(node)
30
30
  out.p **{ class: recommendation_class(node) } do |b|
31
- if inject_crossreference_reqt?(node, label)
32
- lbl = @xrefs.anchor(@xrefs.reqtlabels[label.text], :xref, false)
33
- b << (lbl.nil? ? l10n("#{type}:") : l10n("#{lbl}:"))
34
- else
35
- b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
36
- end
31
+ lbl and lbl.children.each { |n| parse(n, b) }
32
+ b << l10n(":")
37
33
  recommendation_name1(title, node, label, b)
38
34
  end
39
35
  end
40
36
 
41
37
  def recommendation_name1(title, node, label, b)
42
- return unless title && !inject_crossreference_reqt?(node, label)
38
+ return unless title
43
39
  b << " "
44
40
  title.children.each { |n| parse(n,b) }
45
41
  end
@@ -55,12 +51,6 @@ module IsoDoc
55
51
  end
56
52
  end
57
53
 
58
- # embedded reqts xref to top level reqts via label lookup
59
- def inject_crossreference_reqt?(node, label)
60
- !node.ancestors("requirement, recommendation, permission").empty? &&
61
- @xrefs.reqtlabels[label&.text]
62
- end
63
-
64
54
  def recommendation_attributes1(node)
65
55
  out = []
66
56
  oblig = node["obligation"] and out << ["Obligation", oblig]
@@ -163,19 +153,7 @@ module IsoDoc
163
153
  end
164
154
 
165
155
  def recommendation_parse0(node, out, r)
166
- label = case node["type"]
167
- when "verification" then @labels["#{r}test"]
168
- when "class" then @labels["#{r}class"]
169
- when "abstracttest" then @labels["abstracttest"]
170
- when "conformanceclass" then @labels["conformanceclass"]
171
- else
172
- case r
173
- when "recommendation" then @recommendation_lbl
174
- when "requirement" then @requirement_lbl
175
- when "permission" then @permission_lbl
176
- end
177
- end
178
- recommendation_parse1(node, out, label)
156
+ recommendation_parse1(node, out, nil)
179
157
  end
180
158
 
181
159
  def requirement_parse(node, out)
@@ -1,108 +1,62 @@
1
1
  module IsoDoc
2
2
  module Ogc
3
3
  module BaseConvert
4
- def annex_name(annex, name, div)
5
- div.h1 **{ class: "Annex" } do |t|
6
- t << "#{@xrefs.anchor(annex['id'], :label)} "
7
- t.br
8
- t.b do |b|
9
- name&.children&.each { |c2| parse(c2, b) }
10
- end
11
- end
12
- end
13
-
14
- def keywords(_docxml, out)
15
- kw = @meta.get[:keywords]
16
- kw.empty? and return
17
- @prefacenum += 1
18
- out.div **{ class: "Section3" } do |div|
19
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
20
- "Keywords", div, class: "IntroTitle")
21
- div.p "The following are keywords to be used by search engines and "\
22
- "document catalogues."
23
- div.p kw.join(", ")
4
+ def intro_clause(f, out)
5
+ out.div **{ class: "Section3", id: f["id"] } do |div|
6
+ clause_name(nil, f&.at(ns("./title")), div, class: "IntroTitle")
7
+ f.elements.each { |e| parse(e, div) unless e.name == "title" }
24
8
  end
25
9
  end
26
10
 
27
- def submittingorgs_path
28
- "//bibdata/contributor[role/@type = 'author']/organization/name"
11
+ def keywords(docxml, out)
12
+ f = docxml.at(ns("//preface/clause[@type = 'keywords']")) || return
13
+ intro_clause(f, out)
29
14
  end
30
15
 
31
16
  def submittingorgs(docxml, out)
32
- orgs = []
33
- docxml.xpath(ns(submittingorgs_path)).each { |org| orgs << org.text }
34
- return if orgs.empty?
35
- @prefacenum += 1
36
- out.div **{ class: "Section3" } do |div|
37
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
38
- "Submitting Organizations", div, class: "IntroTitle")
39
- div.p "The following organizations submitted this Document to the "\
40
- "Open Geospatial Consortium (OGC):"
41
- div.ul do |ul|
42
- orgs.each { |org| ul.li org }
43
- end
44
- end
17
+ f = docxml.at(ns("//preface/clause[@type = 'submitting_orgs']")) || return
18
+ intro_clause(f, out)
45
19
  end
46
20
 
47
21
  def submitters(docxml, out)
48
22
  f = docxml.at(ns("//submitters")) || return
49
- @prefacenum += 1
50
- out.div **{ class: "Section3" } do |div|
51
- clause_name(@xrefs.anchor(f['id'], :label), "Submitters", div,
52
- class: "IntroTitle")
53
- f.elements.each { |e| parse(e, div) unless e.name == "title" }
54
- end
23
+ intro_clause(f, out)
55
24
  end
56
25
 
57
26
  def preface(isoxml, out)
58
- title_attr = { class: "IntroTitle" }
59
- isoxml.xpath(ns("//preface/clause")).each do |f|
60
- @prefacenum += 1
61
- out.div **{ class: "Section3", id: f["id"] } do |div|
62
- clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
63
- f&.at(ns("./title")), div, title_attr)
64
- f.elements.each { |e| parse(e, div) unless e.name == "title" }
65
- end
27
+ isoxml.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
28
+ "@type = 'submitting_orgs')]")).each do |f|
29
+ intro_clause(f, out)
66
30
  end
67
31
  end
68
32
 
69
33
  def abstract(isoxml, out)
70
34
  f = isoxml.at(ns("//preface/abstract")) || return
71
- @prefacenum += 1
72
35
  page_break(out)
73
36
  out.div **attr_code(id: f["id"]) do |s|
74
- clause_name(@xrefs.anchor(f["id"], :label), @abstract_lbl, s,
75
- class: "AbstractTitle")
37
+ clause_name(nil, f&.at(ns("./title")), s, class: "AbstractTitle")
76
38
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
77
39
  end
78
40
  end
79
41
 
80
42
  def foreword(isoxml, out)
81
43
  f = isoxml.at(ns("//foreword")) || return
82
- @prefacenum += 1
83
44
  page_break(out)
84
45
  out.div **attr_code(id: f["id"]) do |s|
85
- clause_name(@xrefs.anchor(f["id"], :label), @foreword_lbl, s,
86
- class: "ForewordTitle")
46
+ clause_name(nil, f&.at(ns("./title")), s, class: "ForewordTitle")
87
47
  f.elements.each { |e| parse(e, s) unless e.name == "title" }
88
48
  end
89
49
  end
90
50
 
91
51
  def acknowledgements(isoxml, out)
92
52
  f = isoxml.at(ns("//acknowledgements")) || return
93
- @prefacenum += 1
94
- out.div **{ class: "Section3", id: f["id"] } do |div|
95
- clause_name(@xrefs.anchor(f["id"], :label), f&.at(ns("./title")), div,
96
- class: "IntroTitle")
97
- f.elements.each { |e| parse(e, div) unless e.name == "title" }
98
- end
53
+ intro_clause(f, out)
99
54
  end
100
55
 
101
56
  def conformance(isoxml, out, num)
102
- f = isoxml.at(ns("//clause[title = 'Conformance']")) or return num
57
+ f = isoxml.at(ns("//clause[@type = 'conformance']")) or return num
103
58
  out.div **attr_code(id: f["id"]) do |div|
104
- num = num + 1
105
- clause_name(num, "Conformance", div, nil)
59
+ clause_name(nil, f&.at(ns("./title")), div, nil)
106
60
  f.elements.each { |e| parse(e, div) unless e.name == "title" }
107
61
  end
108
62
  num
@@ -1,4 +1,5 @@
1
1
  require_relative "base_convert"
2
+ require_relative "init"
2
3
  require "fileutils"
3
4
  require "isodoc"
4
5
  require_relative "metadata"
@@ -36,6 +37,20 @@ module IsoDoc
36
37
  }
37
38
  end
38
39
 
40
+ def convert1(docxml, filename, dir)
41
+ if docxml&.at(ns('//bibdata/ext/doctype'))&.text == "white-paper"
42
+ @wordstylesheet_name = html_doc_path("wordstyle_wp.scss")
43
+ @standardstylesheet_name = html_doc_path("ogc_wp.scss")
44
+ @wordcoverpage = html_doc_path("word_ogc_titlepage_wp.html")
45
+ @wordintropage = html_doc_path("word_ogc_intro_wp.html")
46
+ @header = html_doc_path("header_wp.html")
47
+ @doctype = "white-paper"
48
+ options[:bodyfont] = '"Arial",sans-serif'
49
+ options[:headerfont] = '"Lato",sans-serif'
50
+ end
51
+ super
52
+ end
53
+
39
54
  def make_body(xml, docxml)
40
55
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
41
56
  xml.body **body_attr do |body|
@@ -67,15 +82,15 @@ module IsoDoc
67
82
  <span lang="EN-GB"><span
68
83
  style='mso-element:field-begin'></span><span
69
84
  style='mso-spacerun:yes'>&#xA0;</span>TOC
70
- \\h \\z \\t &quot;RecommendationTitle,1&quot; <span
71
- style='mso-element:field-separator'></span></span>
85
+ \\h \\z \\t &quot;RecommendationTitle,recommendationtitle&quot;
86
+ <span style='mso-element:field-separator'></span></span>
72
87
  TOC
73
88
 
74
89
  WORD_TOC_TABLE_PREFACE1 = <<~TOC.freeze
75
90
  <span lang="EN-GB"><span
76
91
  style='mso-element:field-begin'></span><span
77
92
  style='mso-spacerun:yes'>&#xA0;</span>TOC
78
- \\h \\z \\t &quot;TableTitle,1&quot; <span
93
+ \\h \\z \\t &quot;TableTitle,tabletitle&quot; <span
79
94
  style='mso-element:field-separator'></span></span>
80
95
  TOC
81
96
 
@@ -83,7 +98,7 @@ module IsoDoc
83
98
  <span lang="EN-GB"><span
84
99
  style='mso-element:field-begin'></span><span
85
100
  style='mso-spacerun:yes'>&#xA0;</span>TOC
86
- \\h \\z \\t &quot;FigureTitle,1&quot; <span
101
+ \\h \\z \\t &quot;FigureTitle,figuretitle&quot; <span
87
102
  style='mso-element:field-separator'></span></span>
88
103
  TOC
89
104
 
@@ -156,9 +171,12 @@ module IsoDoc
156
171
  # center only the Copyright notice
157
172
  def word_copyright_cleanup(docxml)
158
173
  x = "//div[@class = 'boilerplate-copyright']/div[1]/p[not(@class)]"
159
- docxml.xpath(x).each do |p|
160
- p["align"] = "center"
161
- end
174
+ docxml.xpath(x).each { |p| p["align"] = "center" }
175
+ return unless @doctype == "white-paper"
176
+ docxml.xpath("//div[@class = 'boilerplate-copyright']//p[not(@class)]").
177
+ each { |p| p["class"] = "license" }
178
+ docxml.xpath("//div[@class = 'boilerplate-legal']//p[not(@class)]").
179
+ each { |p| p["class"] = "license" }
162
180
  end
163
181
 
164
182
  def word_term_cleanup(docxml)
@@ -182,6 +200,7 @@ module IsoDoc
182
200
  end
183
201
 
184
202
  include BaseConvert
203
+ include Init
185
204
  end
186
205
  end
187
206
  end
@@ -17,7 +17,8 @@ module IsoDoc
17
17
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
18
18
  next if t["id"].nil? || t["id"].empty?
19
19
  id = c.increment(t).print
20
- @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
20
+ @anchors[t["id"]] = anchor_struct(id, t, label, klass,
21
+ t["unnumbered"])
21
22
  l = t.at(ns("./label"))&.text and @reqtlabels[l] = t["id"]
22
23
  sequential_permission_children(t, id)
23
24
  end
@@ -38,9 +39,8 @@ module IsoDoc
38
39
  def sequential_permission_children(t, id)
39
40
  req_class_paths.each do |k, v|
40
41
  %w(permission requirement recommendation).each do |r|
41
- sequential_permission_names1(t, id, "#{r}[#{v}]", @labels["#{r}#{k}"])
42
- sequential_permission_names1(t, id, "#{r}[#{v}]", @labels["#{r}#{k}"])
43
- sequential_permission_names1(t, id, "#{r}[#{v}]", @labels["#{r}#{k}"])
42
+ sequential_permission_names1(t, id, "#{r}[#{v}]",
43
+ @labels["#{r}#{k}"])
44
44
  end
45
45
  end
46
46
  req_class_paths2.each do |k, v|
@@ -53,7 +53,8 @@ module IsoDoc
53
53
  block.xpath(ns("./#{klass}")).each do |t|
54
54
  next if t["id"].nil? || t["id"].empty?
55
55
  id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
56
- @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
56
+ @anchors[t["id"]] = anchor_struct(id, t, label, klass,
57
+ t["unnumbered"])
57
58
  sequential_permission_children(t, id)
58
59
  end
59
60
  end
@@ -64,9 +65,8 @@ module IsoDoc
64
65
  sequential_formula_names(clause)
65
66
  req_class_paths.each do |k, v|
66
67
  %w(permission requirement recommendation).each do |r|
67
- sequential_permission_names(clause, "#{r}[#{v}]", @labels["#{r}#{k}"])
68
- sequential_permission_names(clause, "#{r}[#{v}]", @labels["#{r}#{k}"])
69
- sequential_permission_names(clause, "#{r}[#{v}]", @labels["#{r}#{k}"])
68
+ sequential_permission_names(clause, "#{r}[#{v}]",
69
+ @labels["#{r}#{k}"])
70
70
  end
71
71
  end
72
72
  req_class_paths2.each do |k, v|
@@ -80,9 +80,8 @@ module IsoDoc
80
80
  hierarchical_formula_names(clause, num)
81
81
  req_class_paths.each do |k, v|
82
82
  %w(permission requirement recommendation).each do |r|
83
- hierarchical_permission_names(clause, num, "#{r}[#{v}]", @labels["#{r}#{k}"])
84
- hierarchical_permission_names(clause, num, "#{r}[#{v}]", @labels["#{r}#{k}"])
85
- hierarchical_permission_names(clause, num, "#{r}[#{v}]", @labels["#{r}#{k}"])
83
+ hierarchical_permission_names(clause, num, "#{r}[#{v}]",
84
+ @labels["#{r}#{k}"])
86
85
  end
87
86
  end
88
87
  req_class_paths2.each do |k, v|
@@ -95,7 +94,8 @@ module IsoDoc
95
94
  clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
96
95
  next if t["id"].nil? || t["id"].empty?
97
96
  lbl = "#{num}#{hiersep}#{c.increment(t).print}"
98
- @anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
97
+ @anchors[t["id"]] = anchor_struct(lbl, t, label, klass,
98
+ t["unnumbered"])
99
99
  l = t.at(ns("./label"))&.text and @reqtlabels[l] = t["id"]
100
100
  sequential_permission_children(t, lbl)
101
101
  end
@@ -104,23 +104,23 @@ module IsoDoc
104
104
  def initial_anchor_names(d)
105
105
  @prefacenum = 0
106
106
  preface_names_numbered(d.at(ns("//preface/abstract")))
107
- @prefacenum += 1 if d.at(ns("//keyword"))
107
+ preface_names_numbered(d.at(ns("//preface/clause[@type = 'keywords']")))
108
108
  preface_names_numbered(d.at(ns("//foreword")))
109
109
  preface_names_numbered(d.at(ns("//introduction")))
110
- @prefacenum += 1 if d.at(ns(@klass.submittingorgs_path))
110
+ preface_names_numbered(d.at(ns("//preface/clause"\
111
+ "[@type = 'submitting_orgs']")))
111
112
  preface_names_numbered(d.at(ns("//submitters")))
112
- d.xpath(ns("//preface/clause")).each do |c|
113
+ d.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
114
+ "@type = 'submitting_orgs')]")).each do |c|
113
115
  preface_names_numbered(c)
114
116
  end
115
117
  preface_names_numbered(d.at(ns("//acknowledgements")))
116
118
  sequential_asset_names(d.xpath(ns(
117
119
  "//preface/abstract | //foreword | //introduction | "\
118
120
  "//submitters | //acknowledgements | //preface/clause")))
119
- n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
120
- n = section_names(d.at(ns("//clause[title = 'Conformance']")), n, 1)
121
- n = section_names(d.at(ns(
122
- "//references[title = 'Normative References' or "\
123
- "title = 'Normative references']")), n, 1)
121
+ n = section_names(d.at(ns("//clause[@type = 'scope']")), 0, 1)
122
+ n = section_names(d.at(ns("//clause[@type = 'conformance']")), n, 1)
123
+ n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
124
124
  n = section_names(
125
125
  d.at(ns("//sections/terms | //sections/clause[descendant::terms]")),
126
126
  n, 1)
@@ -132,11 +132,10 @@ module IsoDoc
132
132
  end
133
133
 
134
134
  def middle_section_asset_names(d)
135
- middle_sections = "//clause[title = 'Scope' or title = 'Conformance'] "\
135
+ middle_sections = "//clause[@type = 'scope' or @type = 'conformance'] "\
136
136
  "| //foreword | //introduction | //preface/abstract | "\
137
137
  "//submitters | //acknowledgements | //preface/clause | "\
138
- "//references[title = 'Normative References' or title = "\
139
- "'Normative references'] | //sections/terms | "\
138
+ " #{@klass.norm_ref_xpath} | //sections/terms | "\
140
139
  "//sections/definitions | //clause[parent::sections]"
141
140
  sequential_asset_names(d.xpath(ns(middle_sections)))
142
141
  end
@@ -153,6 +152,12 @@ module IsoDoc
153
152
  section_names1(c, "#{pref}.#{i + 1}", 2)
154
153
  end
155
154
  end
155
+
156
+ def reference_names(ref)
157
+ super
158
+ return unless @klass.ogc_draft_ref?(ref)
159
+ @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref] + " (draft)" }
160
+ end
156
161
  end
157
162
  end
158
163
  end