metanorma-ogc 1.1.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -0
  3. data/lib/asciidoctor/ogc/boilerplate.xml +3 -3
  4. data/lib/asciidoctor/ogc/converter.rb +12 -8
  5. data/lib/asciidoctor/ogc/front.rb +8 -20
  6. data/lib/asciidoctor/ogc/isodoc.rng +16 -7
  7. data/lib/asciidoctor/ogc/validate.rb +13 -25
  8. data/lib/isodoc/ogc/base_convert.rb +33 -48
  9. data/lib/isodoc/ogc/biblio.rb +33 -4
  10. data/lib/isodoc/ogc/html/_coverpage.css +195 -0
  11. data/lib/isodoc/ogc/html/header_wp.html +210 -0
  12. data/lib/isodoc/ogc/html/htmlstyle.css +1084 -0
  13. data/lib/isodoc/ogc/html/logo.png +0 -0
  14. data/lib/isodoc/ogc/html/ogc.css +838 -0
  15. data/lib/isodoc/ogc/html/ogc.scss +4 -2
  16. data/lib/isodoc/ogc/html/ogc_wp.css +758 -0
  17. data/lib/isodoc/ogc/html/ogc_wp.scss +724 -0
  18. data/lib/isodoc/ogc/html/word_ogc_intro_wp.html +14 -0
  19. data/lib/isodoc/ogc/html/word_ogc_titlepage_wp.html +175 -0
  20. data/lib/isodoc/ogc/html/wordstyle.css +1253 -0
  21. data/lib/isodoc/ogc/html/wordstyle.scss +8 -9
  22. data/lib/isodoc/ogc/html/wordstyle_wp.css +1181 -0
  23. data/lib/isodoc/ogc/html/wordstyle_wp.scss +1093 -0
  24. data/lib/isodoc/ogc/html_convert.rb +3 -0
  25. data/lib/isodoc/ogc/i18n-en.yaml +1 -0
  26. data/lib/isodoc/ogc/i18n.rb +10 -0
  27. data/lib/isodoc/ogc/init.rb +41 -0
  28. data/lib/isodoc/ogc/metadata.rb +31 -28
  29. data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1899 -1618
  30. data/lib/isodoc/ogc/ogc.best-practice.xsl +1899 -1618
  31. data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1899 -1618
  32. data/lib/isodoc/ogc/ogc.community-practice.xsl +1899 -1618
  33. data/lib/isodoc/ogc/ogc.community-standard.xsl +1899 -1618
  34. data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1899 -1618
  35. data/lib/isodoc/ogc/ogc.engineering-report.xsl +1899 -1618
  36. data/lib/isodoc/ogc/ogc.other.xsl +1899 -1618
  37. data/lib/isodoc/ogc/ogc.policy.xsl +1899 -1618
  38. data/lib/isodoc/ogc/ogc.reference-model.xsl +1899 -1618
  39. data/lib/isodoc/ogc/ogc.release-notes.xsl +1899 -1618
  40. data/lib/isodoc/ogc/ogc.standard.xsl +1899 -1618
  41. data/lib/isodoc/ogc/ogc.test-suite.xsl +1899 -1618
  42. data/lib/isodoc/ogc/ogc.user-guide.xsl +1899 -1618
  43. data/lib/isodoc/ogc/ogc.white-paper.xsl +2264 -2218
  44. data/lib/isodoc/ogc/presentation_xml_convert.rb +134 -1
  45. data/lib/isodoc/ogc/reqt.rb +91 -124
  46. data/lib/isodoc/ogc/sections.rb +18 -64
  47. data/lib/isodoc/ogc/word_convert.rb +23 -3
  48. data/lib/isodoc/ogc/xref.rb +28 -23
  49. data/lib/metanorma/ogc/version.rb +1 -1
  50. data/metanorma-ogc.gemspec +3 -4
  51. metadata +34 -34
@@ -1,9 +1,142 @@
1
- require_relative "base_convert"
1
+ require_relative "init"
2
+ require_relative "reqt"
2
3
  require "isodoc"
4
+ require "uuidtools"
3
5
 
4
6
  module IsoDoc
5
7
  module Ogc
6
8
  class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
9
+ def convert1(docxml, filename, dir)
10
+ info docxml, nil
11
+ insert_preface_sections(docxml)
12
+ super
13
+ end
14
+
15
+ def insert_preface_sections(docxml)
16
+ insert_keywords(docxml)
17
+ insert_submitting_orgs(docxml)
18
+ end
19
+
20
+ def preface_init_insert_pt(docxml)
21
+ docxml.at(ns("//preface")) ||
22
+ docxml.at(ns("//sections")).
23
+ add_previous_sibling("<preface> </preface>").first
24
+ end
25
+
26
+ def submit_orgs_append_pt(docxml)
27
+ docxml.at(ns("//introduction")) ||
28
+ docxml.at(ns("//foreword")) ||
29
+ docxml.at(ns("//preface/clause[@type = 'keywords']")) ||
30
+ docxml.at(ns("//preface/abstract"))
31
+ end
32
+
33
+ def insert_submitting_orgs(docxml)
34
+ orgs = []
35
+ docxml.xpath(ns(submittingorgs_path)).each { |org| orgs << org.text }
36
+ return if orgs.empty?
37
+ if a = submit_orgs_append_pt(docxml)
38
+ a.next = submitting_orgs_clause(orgs)
39
+ else
40
+ preface_init_insert_pt(docxml)&.children&.first&.
41
+ add_previous_sibling(submitting_orgs_clause(orgs))
42
+ end
43
+ end
44
+
45
+ def submitting_orgs_clause(orgs)
46
+ <<~END
47
+ <clause id="_#{UUIDTools::UUID.random_create}" type="submitting_orgs">
48
+ <title>Submitting Organizations</title>
49
+ <p>The following organizations submitted this Document to the
50
+ Open Geospatial Consortium (OGC):</p>
51
+ <ul>#{orgs.map { |m| "<li>#{m}</li>" }.join("\n")}</ul>
52
+ </clause>
53
+ END
54
+ end
55
+
56
+ def keyword_clause(kw)
57
+ <<~END
58
+ <clause id="_#{UUIDTools::UUID.random_create}" type="keywords">
59
+ <title>Keywords</title>
60
+ <p>The following are keywords to be used by search engines and
61
+ document catalogues.</p>
62
+ <p>#{kw.join(", ")}</p></clause>
63
+ END
64
+ end
65
+
66
+ def insert_keywords(docxml)
67
+ kw = @meta.get[:keywords]
68
+ kw.empty? and return
69
+ if abstract = docxml.at(ns("//preface/abstract"))
70
+ abstract.next = keyword_clause(kw)
71
+ else
72
+ preface_init_insert_pt(docxml)&.children&.first&.
73
+ add_previous_sibling(keyword_clause(kw))
74
+ end
75
+ end
76
+
77
+ def example1(f)
78
+ lbl = @xrefs.anchor(f['id'], :label, false) or return
79
+ prefix_name(f, "&nbsp;&mdash; ", l10n("#{@i18n.example} #{lbl}"), "name")
80
+ end
81
+
82
+ def recommendation1(f, type)
83
+ type = recommendation_class_label(f)
84
+ label = f&.at(ns("./label"))&.text
85
+ if inject_crossreference_reqt?(f, label)
86
+ n = @xrefs.anchor(@xrefs.reqtlabels[label], :xref, false)
87
+ lbl = (n.nil? ? type : n)
88
+ f&.at(ns("./title"))&.remove # suppress from display if embedded
89
+ else
90
+ n = @xrefs.anchor(f['id'], :label, false)
91
+ lbl = (n.nil? ? type : l10n("#{type} #{n}"))
92
+ end
93
+ prefix_name(f, "", lbl, "name")
94
+ end
95
+
96
+ # embedded reqts xref to top level reqts via label lookup
97
+ def inject_crossreference_reqt?(node, label)
98
+ !node.ancestors("requirement, recommendation, permission").empty? &&
99
+ @xrefs.reqtlabels[label]
100
+ end
101
+
102
+ def recommendation_class_label(node)
103
+ case node["type"]
104
+ when "verification" then @i18n.get["#{node.name}test"]
105
+ when "class" then @i18n.get["#{node.name}class"]
106
+ when "abstracttest" then @i18n.get["abstracttest"]
107
+ when "conformanceclass" then @i18n.get["conformanceclass"]
108
+ else
109
+ case node.name
110
+ when "recommendation" then @i18n.recommendation
111
+ when "requirement" then @i18n.requirement
112
+ when "permission" then @i18n.permission
113
+ end
114
+ end
115
+ end
116
+
117
+ def annex1(f)
118
+ lbl = @xrefs.anchor(f['id'], :label)
119
+ if t = f.at(ns("./title"))
120
+ t.children = "<strong>#{t.children.to_xml}</strong>"
121
+ end
122
+ prefix_name(f, "<br/>", lbl, "title")
123
+ end
124
+
125
+ def clause(docxml)
126
+ super
127
+ docxml.xpath(ns("//foreword | //preface/abstract | "\
128
+ "//submitters | //introduction | //acknowledgements")).
129
+ each do |f|
130
+ clause1(f)
131
+ end
132
+ end
133
+
134
+ def block(docxml)
135
+ super
136
+ recommendation_to_table(docxml)
137
+ end
138
+
139
+ include Init
7
140
  end
8
141
  end
9
142
  end
@@ -2,7 +2,7 @@ require "isodoc"
2
2
 
3
3
  module IsoDoc
4
4
  module Ogc
5
- module BaseConvert
5
+ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
6
6
  def recommend_class(node)
7
7
  return "recommendtest" if node["type"] == "verification"
8
8
  return "recommendtest" if node["type"] == "abstracttest"
@@ -11,62 +11,41 @@ module IsoDoc
11
11
  "recommend"
12
12
  end
13
13
 
14
- def recommend_table_attr(node)
15
- attr_code(id: node["id"], class: recommend_class(node),
16
- style: "border-collapse:collapse;border-spacing:0;"\
17
- "#{keep_style(node)}")
18
- end
19
-
20
- REQ_TBL_ATTR =
21
- { style: "vertical-align:top;", class: "recommend" }.freeze
22
-
23
14
  def recommendation_class(node)
24
- %w(verification abstracttest).include?(node["type"]) ?
25
- "RecommendationTestTitle" : "RecommendationTitle"
26
- end
27
-
28
- def recommendation_name(node, out, type)
29
- label, title, lbl = recommendation_labels(node)
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
37
- recommendation_name1(title, node, label, b)
38
- end
15
+ node["type"] == "recommendtest" ?
16
+ "RecommendationTestTitle" : "RecommendationTitle"
39
17
  end
40
18
 
41
- def recommendation_name1(title, node, label, b)
42
- return unless title && !inject_crossreference_reqt?(node, label)
43
- b << " "
44
- title.children.each { |n| parse(n,b) }
19
+ def recommendation_header(r)
20
+ h = r.add_child("<thead><tr><th scope='colgroup' colspan='2'></th></tr></thead>")
21
+ recommendation_name(r, h.at(ns(".//th")))
45
22
  end
46
23
 
47
- def recommend_title(node, out)
48
- label = node.at(ns("./label")) or return
49
- out.tr do |tr|
50
- tr.td **REQ_TBL_ATTR.merge(colspan: 2) do |td|
51
- td.p do |p|
52
- label.children.each { |n| parse(n, p) }
53
- end
54
- end
24
+ def recommendation_name(node, out)
25
+ b = out.add_child("<p class='#{recommendation_class(node)}'></p>").first
26
+ if name = node&.at(ns("./name"))&.remove
27
+ name.children.each { |n| b << n }
28
+ b << l10n(":")
29
+ end
30
+ if title = node&.at(ns("./title"))&.remove
31
+ b << l10n(" ") if name
32
+ title.children.each { |n| b << n }
55
33
  end
56
34
  end
57
35
 
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]
36
+ def recommend_title(node, out)
37
+ label = node&.at(ns("./label"))&.remove or return
38
+ b = out.add_child("<tr><td colspan='2'><p></p></td></tr>")
39
+ p = b.at(ns(".//p"))
40
+ p << label.children
62
41
  end
63
42
 
64
43
  def recommendation_attributes1(node)
65
44
  out = []
66
45
  oblig = node["obligation"] and out << ["Obligation", oblig]
67
- subj = node&.at(ns("./subject"))&.text and out << [rec_subj(node), subj]
46
+ subj = node&.at(ns("./subject"))&.remove&.children and out << [rec_subj(node), subj]
68
47
  node.xpath(ns("./inherit")).each do |i|
69
- out << recommendation_attr_parse(i, "Dependency")
48
+ out << ["Dependency", i.remove.children]
70
49
  end
71
50
  node.xpath(ns("./classification")).each do |c|
72
51
  line = recommendation_attr_keyvalue(c, "tag", "value") and out << line
@@ -75,115 +54,103 @@ module IsoDoc
75
54
  end
76
55
 
77
56
  def rec_subj(node)
78
- %w(class conformanceclass).include?(node["type"]) ?
79
- "Target Type" : "Subject"
80
- end
81
-
82
- def recommendation_attr_parse(node, label)
83
- text = noko do |xml|
84
- node.children.each { |n| parse(n, xml) }
85
- end.join
86
- [label, text]
57
+ node["type"] == "recommendclass" ? "Target Type" : "Subject"
87
58
  end
88
59
 
89
60
  def recommendation_attr_keyvalue(node, key, value)
90
- tag = node.at(ns("./#{key}")) or return nil
91
- value = node.at(ns("./#{value}")) or return nil
92
- [tag.text.capitalize, value.text]
61
+ tag = node&.at(ns("./#{key}"))&.remove
62
+ value = node.at(ns("./#{value}"))&.remove
63
+ tag && value or return nil
64
+ node.remove
65
+ [tag.text.capitalize, value.children]
93
66
  end
94
67
 
95
68
  def recommendation_attributes(node, out)
96
69
  recommendation_attributes1(node).each do |i|
97
- out.tr do |tr|
98
- tr.td **REQ_TBL_ATTR do |td|
99
- td << i[0]
100
- end
101
- tr.td **REQ_TBL_ATTR do |td|
102
- td << i[1]
103
- end
104
- end
70
+ out.add_child("<tr><td>#{i[0]}</td><td>#{i[1]}</td></tr>")
105
71
  end
106
72
  end
107
73
 
108
- def reqt_component_attrs(node)
109
- attr_code(style: keep_style(node))
74
+ def preserve_in_nested_table?(node)
75
+ return true if %w(recommendation requirement permission table).include?(node.name)
76
+ false
110
77
  end
111
78
 
112
79
  def requirement_component_parse(node, out)
80
+ node.remove
113
81
  return if node["exclude"] == "true"
114
82
  node.elements.size == 1 && node.first_element_child.name == "dl" and
115
83
  return reqt_dl(node.first_element_child, out)
116
- out.tr do |tr|
117
- tr.td **REQ_TBL_ATTR.merge(colspan: 2).
118
- merge(reqt_component_attrs(node)) do |td|
119
- node.children.each { |n| parse(n, td) }
120
- end
121
- end
84
+ b = out.add_child("<tr><td colspan='2'></td></tr>").first
85
+ b.at(ns(".//td")) << (preserve_in_nested_table?(node) ? node : node.children)
122
86
  end
123
87
 
124
88
  def reqt_dl(node, out)
125
89
  node.xpath(ns("./dt")).each do |dt|
126
- out.tr do |tr|
127
- tr.td **REQ_TBL_ATTR do |td|
128
- dt.children.each { |n| parse(n, td) }
129
- end
130
- dd = dt&.next_element and dd.name == "dd" or next
131
- tr.td **REQ_TBL_ATTR do |td|
132
- dd.children.each { |n| parse(n, td) }
133
- end
134
- end
90
+ dd = dt&.next_element
91
+ dt.remove
92
+ dd&.name == "dd" or next
93
+ b = out.add_child("<tr><td></td><td></td></tr>")
94
+ b.at(ns(".//td[1]")) << dt.children
95
+ b.at(ns(".//td[2]")) << dd.remove.children
135
96
  end
136
97
  end
137
98
 
138
- def recommendation_header(node, out, label)
139
- out.thead do |h|
140
- h.tr do |tr|
141
- tr.th **REQ_TBL_ATTR.merge(colspan: 2) do |td|
142
- recommendation_name(node, td, label)
143
- end
144
- end
145
- end
99
+ def recommendation_base(node, klass)
100
+ node.name = "table"
101
+ node["class"] = klass
102
+ node["type"] = recommend_class(node)
146
103
  end
147
104
 
148
- def recommendation_parse1(node, out, label)
149
- out.table **recommend_table_attr(node) do |t|
150
- recommendation_header(node, out, label)
151
- t.tbody do |b|
152
- recommend_title(node, b)
153
- recommendation_attributes(node, b)
154
- node.children.each do |n|
155
- parse(n, t) unless reqt_metadata_node(n)
156
- end
157
- end
105
+ def recommendation_parse1(node, klass)
106
+ recommendation_base(node, klass)
107
+ recommendation_header(node)
108
+ b = node.add_child("<tbody></tbody>").first
109
+ recommend_title(node, b)
110
+ recommendation_attributes(node, b)
111
+ node.elements.each do |n|
112
+ next if %w(thead tbody).include?(n.name)
113
+ requirement_component_parse(n, b)
158
114
  end
159
115
  end
160
116
 
161
- def recommendation_parse(node, out)
162
- recommendation_parse0(node, out, "recommendation")
163
- end
164
-
165
- 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)
179
- end
180
-
181
- def requirement_parse(node, out)
182
- recommendation_parse0(node, out, "requirement")
183
- end
184
-
185
- def permission_parse(node, out)
186
- recommendation_parse0(node, out, "permission")
117
+ def recommendation_to_table(docxml)
118
+ docxml.xpath(ns("//recommendation")).each do |r|
119
+ recommendation_parse1(r, "recommendation")
120
+ end
121
+ docxml.xpath(ns("//requirement")).each do |r|
122
+ recommendation_parse1(r, "requirement")
123
+ end
124
+ docxml.xpath(ns("//permission")).each do |r|
125
+ recommendation_parse1(r, "permission")
126
+ end
127
+ requirement_table_cleanup(docxml)
128
+ end
129
+
130
+ # table nested in table: merge label and caption into a single row
131
+ def requirement_table_cleanup1(x, y)
132
+ x.delete("colspan")
133
+ x.delete("scope")
134
+ y.delete("colspan")
135
+ y.delete("scope")
136
+ x.name = "td"
137
+ p = x.at(ns("./p[@class = 'RecommendationTitle']")) and
138
+ p.delete("class")
139
+ x.parent << y.dup
140
+ y.parent.remove
141
+ end
142
+
143
+ def requirement_table_cleanup(docxml)
144
+ docxml.xpath(ns("//table[@type = 'recommendclass']/tbody/tr/td/table")).each do |t|
145
+ x = t.at(ns("./thead")) and x.replace(x.children)
146
+ x = t.at(ns("./tbody")) and x.replace(x.children)
147
+ x = t.at(ns("./tfoot")) and x.replace(x.children)
148
+ if x = t.at(ns("./tr/th[@colspan = '2']")) and
149
+ y = t.at(ns("./tr/td[@colspan = '2']"))
150
+ requirement_table_cleanup1(x, y)
151
+ end
152
+ t.parent.parent.replace(t.children)
153
+ end
187
154
  end
188
155
  end
189
156
  end
@@ -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