metanorma-ogc 1.0.9 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +0 -1
- data/.github/workflows/ubuntu.yml +10 -7
- data/.github/workflows/windows.yml +0 -1
- data/Rakefile +2 -0
- data/lib/asciidoctor/ogc/converter.rb +19 -20
- data/lib/asciidoctor/ogc/isodoc.rng +12 -6
- data/lib/asciidoctor/ogc/validate.rb +13 -25
- data/lib/isodoc/ogc.rb +2 -0
- data/lib/isodoc/ogc/base_convert.rb +3 -71
- data/lib/isodoc/ogc/html/_coverpage.css +195 -0
- data/lib/isodoc/ogc/html/htmlstyle.css +1084 -0
- data/lib/isodoc/ogc/html/ogc.css +835 -0
- data/lib/isodoc/ogc/html/wordstyle.css +1253 -0
- data/lib/isodoc/ogc/html/wordstyle.scss +0 -1
- data/lib/isodoc/ogc/html_convert.rb +2 -5
- data/lib/isodoc/ogc/i18n-en.yaml +1 -0
- data/lib/isodoc/ogc/i18n.rb +10 -0
- data/lib/isodoc/ogc/init.rb +32 -0
- data/lib/isodoc/ogc/metadata.rb +1 -1
- data/lib/isodoc/ogc/ogc.abstract-specification-topic.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.best-practice.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.change-request-supporting-document.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.community-practice.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.community-standard.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.discussion-paper.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.engineering-report.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.other.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.policy.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.reference-model.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.release-notes.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.standard.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.test-suite.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.user-guide.xsl +1862 -1447
- data/lib/isodoc/ogc/ogc.white-paper.xsl +1966 -1799
- data/lib/isodoc/ogc/pdf_convert.rb +0 -13
- data/lib/isodoc/ogc/presentation_xml_convert.rb +137 -0
- data/lib/isodoc/ogc/reqt.rb +4 -27
- data/lib/isodoc/ogc/sections.rb +18 -63
- data/lib/isodoc/ogc/word_convert.rb +6 -9
- data/lib/isodoc/ogc/{reqt_xref.rb → xref.rb} +65 -5
- data/lib/metanorma/ogc/processor.rb +6 -8
- data/lib/metanorma/ogc/version.rb +1 -1
- data/metanorma-ogc.gemspec +3 -4
- metadata +32 -40
@@ -19,19 +19,6 @@ module IsoDoc
|
|
19
19
|
standard user-guide test-suite white-paper).include? doctype
|
20
20
|
"ogc.#{doctype}.xsl"
|
21
21
|
end
|
22
|
-
|
23
|
-
def convert(filename, file = nil, debug = false)
|
24
|
-
file = File.read(filename, encoding: "utf-8") if file.nil?
|
25
|
-
docxml, outname_html, dir = convert_init(file, filename, debug)
|
26
|
-
/\.xml$/.match(filename) or
|
27
|
-
filename = Tempfile.open([outname_html, ".xml"], encoding: "utf-8") do |f|
|
28
|
-
f.write file
|
29
|
-
f.path
|
30
|
-
end
|
31
|
-
FileUtils.rm_rf dir
|
32
|
-
::Metanorma::Output::XslfoPdf.new.convert(
|
33
|
-
filename, outname_html + ".pdf", File.join(@libdir, pdf_stylesheet(docxml)))
|
34
|
-
end
|
35
22
|
end
|
36
23
|
end
|
37
24
|
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require_relative "init"
|
2
|
+
require "isodoc"
|
3
|
+
require "uuidtools"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module Ogc
|
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, " — ", 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
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
data/lib/isodoc/ogc/reqt.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "isodoc"
|
2
|
-
require_relative "reqt_xref"
|
3
2
|
|
4
3
|
module IsoDoc
|
5
4
|
module Ogc
|
@@ -29,18 +28,14 @@ module IsoDoc
|
|
29
28
|
def recommendation_name(node, out, type)
|
30
29
|
label, title, lbl = recommendation_labels(node)
|
31
30
|
out.p **{ class: recommendation_class(node) } do |b|
|
32
|
-
|
33
|
-
|
34
|
-
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{lbl}:"))
|
35
|
-
else
|
36
|
-
b << (lbl.nil? ? l10n("#{type}:") : l10n("#{type} #{lbl}:"))
|
37
|
-
end
|
31
|
+
lbl and lbl.children.each { |n| parse(n, b) }
|
32
|
+
b << l10n(":")
|
38
33
|
recommendation_name1(title, node, label, b)
|
39
34
|
end
|
40
35
|
end
|
41
36
|
|
42
37
|
def recommendation_name1(title, node, label, b)
|
43
|
-
return unless
|
38
|
+
return unless title
|
44
39
|
b << " "
|
45
40
|
title.children.each { |n| parse(n,b) }
|
46
41
|
end
|
@@ -56,12 +51,6 @@ module IsoDoc
|
|
56
51
|
end
|
57
52
|
end
|
58
53
|
|
59
|
-
# embedded reqts xref to top level reqts via label lookup
|
60
|
-
def inject_crossreference_reqt?(node, label)
|
61
|
-
!node.ancestors("requirement, recommendation, permission").empty? &&
|
62
|
-
@reqtlabels[label&.text]
|
63
|
-
end
|
64
|
-
|
65
54
|
def recommendation_attributes1(node)
|
66
55
|
out = []
|
67
56
|
oblig = node["obligation"] and out << ["Obligation", oblig]
|
@@ -164,19 +153,7 @@ module IsoDoc
|
|
164
153
|
end
|
165
154
|
|
166
155
|
def recommendation_parse0(node, out, r)
|
167
|
-
|
168
|
-
when "verification" then @labels["#{r}test"]
|
169
|
-
when "class" then @labels["#{r}class"]
|
170
|
-
when "abstracttest" then @labels["abstracttest"]
|
171
|
-
when "conformanceclass" then @labels["conformanceclass"]
|
172
|
-
else
|
173
|
-
case r
|
174
|
-
when "recommendation" then @recommendation_lbl
|
175
|
-
when "requirement" then @requirement_lbl
|
176
|
-
when "permission" then @permission_lbl
|
177
|
-
end
|
178
|
-
end
|
179
|
-
recommendation_parse1(node, out, label)
|
156
|
+
recommendation_parse1(node, out, nil)
|
180
157
|
end
|
181
158
|
|
182
159
|
def requirement_parse(node, out)
|
data/lib/isodoc/ogc/sections.rb
CHANGED
@@ -1,107 +1,62 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Ogc
|
3
3
|
module BaseConvert
|
4
|
-
def
|
5
|
-
div
|
6
|
-
|
7
|
-
|
8
|
-
t.b do |b|
|
9
|
-
name&.children&.each { |c2| parse(c2, b) }
|
10
|
-
end
|
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" }
|
11
8
|
end
|
12
9
|
end
|
13
10
|
|
14
|
-
def keywords(
|
15
|
-
|
16
|
-
|
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(", ")
|
24
|
-
end
|
11
|
+
def keywords(docxml, out)
|
12
|
+
f = docxml.at(ns("//preface/clause[@type = 'keywords']")) || return
|
13
|
+
intro_clause(f, out)
|
25
14
|
end
|
26
15
|
|
27
|
-
SUBMITTINGORGS =
|
28
|
-
"//bibdata/contributor[role/@type = 'author']/organization/name".freeze
|
29
|
-
|
30
16
|
def submittingorgs(docxml, out)
|
31
|
-
|
32
|
-
|
33
|
-
return if orgs.empty?
|
34
|
-
@prefacenum += 1
|
35
|
-
out.div **{ class: "Section3" } do |div|
|
36
|
-
clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
|
37
|
-
"Submitting Organizations", div, class: "IntroTitle")
|
38
|
-
div.p "The following organizations submitted this Document to the "\
|
39
|
-
"Open Geospatial Consortium (OGC):"
|
40
|
-
div.ul do |ul|
|
41
|
-
orgs.each { |org| ul.li org }
|
42
|
-
end
|
43
|
-
end
|
17
|
+
f = docxml.at(ns("//preface/clause[@type = 'submitting_orgs']")) || return
|
18
|
+
intro_clause(f, out)
|
44
19
|
end
|
45
20
|
|
46
21
|
def submitters(docxml, out)
|
47
22
|
f = docxml.at(ns("//submitters")) || return
|
48
|
-
|
49
|
-
out.div **{ class: "Section3" } do |div|
|
50
|
-
clause_name(anchor(f['id'], :label), "Submitters", div,
|
51
|
-
class: "IntroTitle")
|
52
|
-
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
53
|
-
end
|
23
|
+
intro_clause(f, out)
|
54
24
|
end
|
55
25
|
|
56
26
|
def preface(isoxml, out)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
out.div **{ class: "Section3", id: f["id"] } do |div|
|
61
|
-
clause_name(RomanNumerals.to_roman(@prefacenum).downcase,
|
62
|
-
f&.at(ns("./title")), div, title_attr)
|
63
|
-
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
64
|
-
end
|
27
|
+
isoxml.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
|
28
|
+
"@type = 'submitting_orgs')]")).each do |f|
|
29
|
+
intro_clause(f, out)
|
65
30
|
end
|
66
31
|
end
|
67
32
|
|
68
33
|
def abstract(isoxml, out)
|
69
34
|
f = isoxml.at(ns("//preface/abstract")) || return
|
70
|
-
@prefacenum += 1
|
71
35
|
page_break(out)
|
72
36
|
out.div **attr_code(id: f["id"]) do |s|
|
73
|
-
clause_name(
|
74
|
-
class: "AbstractTitle")
|
37
|
+
clause_name(nil, f&.at(ns("./title")), s, class: "AbstractTitle")
|
75
38
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
76
39
|
end
|
77
40
|
end
|
78
41
|
|
79
42
|
def foreword(isoxml, out)
|
80
43
|
f = isoxml.at(ns("//foreword")) || return
|
81
|
-
@prefacenum += 1
|
82
44
|
page_break(out)
|
83
45
|
out.div **attr_code(id: f["id"]) do |s|
|
84
|
-
clause_name(
|
85
|
-
class: "ForewordTitle")
|
46
|
+
clause_name(nil, f&.at(ns("./title")), s, class: "ForewordTitle")
|
86
47
|
f.elements.each { |e| parse(e, s) unless e.name == "title" }
|
87
48
|
end
|
88
49
|
end
|
89
50
|
|
90
51
|
def acknowledgements(isoxml, out)
|
91
52
|
f = isoxml.at(ns("//acknowledgements")) || return
|
92
|
-
|
93
|
-
out.div **{ class: "Section3", id: f["id"] } do |div|
|
94
|
-
clause_name(anchor(f["id"], :label), f&.at(ns("./title")), div,
|
95
|
-
class: "IntroTitle")
|
96
|
-
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
97
|
-
end
|
53
|
+
intro_clause(f, out)
|
98
54
|
end
|
99
55
|
|
100
56
|
def conformance(isoxml, out, num)
|
101
|
-
f = isoxml.at(ns("//clause[
|
57
|
+
f = isoxml.at(ns("//clause[@type = 'conformance']")) or return num
|
102
58
|
out.div **attr_code(id: f["id"]) do |div|
|
103
|
-
|
104
|
-
clause_name(num, "Conformance", div, nil)
|
59
|
+
clause_name(nil, f&.at(ns("./title")), div, nil)
|
105
60
|
f.elements.each { |e| parse(e, div) unless e.name == "title" }
|
106
61
|
end
|
107
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"
|
@@ -11,7 +12,6 @@ module IsoDoc
|
|
11
12
|
class WordConvert < IsoDoc::WordConvert
|
12
13
|
def initialize(options)
|
13
14
|
@libdir = File.dirname(__FILE__)
|
14
|
-
@reqtlabels = {}
|
15
15
|
super
|
16
16
|
end
|
17
17
|
|
@@ -37,10 +37,6 @@ module IsoDoc
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
|
-
def metadata_init(lang, script, labels)
|
41
|
-
@meta = Metadata.new(lang, script, labels)
|
42
|
-
end
|
43
|
-
|
44
40
|
def make_body(xml, docxml)
|
45
41
|
body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
|
46
42
|
xml.body **body_attr do |body|
|
@@ -72,15 +68,15 @@ module IsoDoc
|
|
72
68
|
<span lang="EN-GB"><span
|
73
69
|
style='mso-element:field-begin'></span><span
|
74
70
|
style='mso-spacerun:yes'> </span>TOC
|
75
|
-
\\h \\z \\t "RecommendationTitle,
|
76
|
-
style='mso-element:field-separator'></span></span>
|
71
|
+
\\h \\z \\t "RecommendationTitle,recommendationtitle"
|
72
|
+
<span style='mso-element:field-separator'></span></span>
|
77
73
|
TOC
|
78
74
|
|
79
75
|
WORD_TOC_TABLE_PREFACE1 = <<~TOC.freeze
|
80
76
|
<span lang="EN-GB"><span
|
81
77
|
style='mso-element:field-begin'></span><span
|
82
78
|
style='mso-spacerun:yes'> </span>TOC
|
83
|
-
\\h \\z \\t "TableTitle,
|
79
|
+
\\h \\z \\t "TableTitle,tabletitle" <span
|
84
80
|
style='mso-element:field-separator'></span></span>
|
85
81
|
TOC
|
86
82
|
|
@@ -88,7 +84,7 @@ module IsoDoc
|
|
88
84
|
<span lang="EN-GB"><span
|
89
85
|
style='mso-element:field-begin'></span><span
|
90
86
|
style='mso-spacerun:yes'> </span>TOC
|
91
|
-
\\h \\z \\t "FigureTitle,
|
87
|
+
\\h \\z \\t "FigureTitle,figuretitle" <span
|
92
88
|
style='mso-element:field-separator'></span></span>
|
93
89
|
TOC
|
94
90
|
|
@@ -187,6 +183,7 @@ module IsoDoc
|
|
187
183
|
end
|
188
184
|
|
189
185
|
include BaseConvert
|
186
|
+
include Init
|
190
187
|
end
|
191
188
|
end
|
192
189
|
end
|
@@ -1,10 +1,19 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module Ogc
|
3
|
-
|
4
|
-
|
3
|
+
class Xref < IsoDoc::Xref
|
4
|
+
def initialize(lang, script, klass, labels, options)
|
5
|
+
@reqtlabels = {}
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def reqtlabels
|
10
|
+
@reqtlabels
|
11
|
+
end
|
12
|
+
|
13
|
+
FIRST_LVL_REQ = IsoDoc::XrefGen::Blocks::FIRST_LVL_REQ
|
5
14
|
|
6
15
|
def sequential_permission_names(clause, klass, label)
|
7
|
-
c = ::IsoDoc::
|
16
|
+
c = ::IsoDoc::XrefGen::Counter.new
|
8
17
|
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
9
18
|
next if t["id"].nil? || t["id"].empty?
|
10
19
|
id = c.increment(t).print
|
@@ -40,7 +49,7 @@ module IsoDoc
|
|
40
49
|
end
|
41
50
|
|
42
51
|
def sequential_permission_names1(block, lbl, klass, label)
|
43
|
-
c = ::IsoDoc::
|
52
|
+
c = ::IsoDoc::XrefGen::Counter.new
|
44
53
|
block.xpath(ns("./#{klass}")).each do |t|
|
45
54
|
next if t["id"].nil? || t["id"].empty?
|
46
55
|
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
@@ -82,7 +91,7 @@ module IsoDoc
|
|
82
91
|
end
|
83
92
|
|
84
93
|
def hierarchical_permission_names(clause, num, klass, label)
|
85
|
-
c = ::IsoDoc::
|
94
|
+
c = ::IsoDoc::XrefGen::Counter.new
|
86
95
|
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
87
96
|
next if t["id"].nil? || t["id"].empty?
|
88
97
|
lbl = "#{num}#{hiersep}#{c.increment(t).print}"
|
@@ -91,6 +100,57 @@ module IsoDoc
|
|
91
100
|
sequential_permission_children(t, lbl)
|
92
101
|
end
|
93
102
|
end
|
103
|
+
|
104
|
+
def initial_anchor_names(d)
|
105
|
+
@prefacenum = 0
|
106
|
+
preface_names_numbered(d.at(ns("//preface/abstract")))
|
107
|
+
preface_names_numbered(d.at(ns("//preface/clause[@type = 'keywords']")))
|
108
|
+
preface_names_numbered(d.at(ns("//foreword")))
|
109
|
+
preface_names_numbered(d.at(ns("//introduction")))
|
110
|
+
preface_names_numbered(d.at(ns("//preface/clause[@type = 'submitting_orgs']")))
|
111
|
+
preface_names_numbered(d.at(ns("//submitters")))
|
112
|
+
d.xpath(ns("//preface/clause[not(@type = 'keywords' or "\
|
113
|
+
"@type = 'submitting_orgs')]")).each do |c|
|
114
|
+
preface_names_numbered(c)
|
115
|
+
end
|
116
|
+
preface_names_numbered(d.at(ns("//acknowledgements")))
|
117
|
+
sequential_asset_names(d.xpath(ns(
|
118
|
+
"//preface/abstract | //foreword | //introduction | "\
|
119
|
+
"//submitters | //acknowledgements | //preface/clause")))
|
120
|
+
n = section_names(d.at(ns("//clause[@type = 'scope']")), 0, 1)
|
121
|
+
n = section_names(d.at(ns("//clause[@type = 'conformance']")), n, 1)
|
122
|
+
n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
|
123
|
+
n = section_names(
|
124
|
+
d.at(ns("//sections/terms | //sections/clause[descendant::terms]")),
|
125
|
+
n, 1)
|
126
|
+
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
127
|
+
middle_section_asset_names(d)
|
128
|
+
clause_names(d, n)
|
129
|
+
termnote_anchor_names(d)
|
130
|
+
termexample_anchor_names(d)
|
131
|
+
end
|
132
|
+
|
133
|
+
def middle_section_asset_names(d)
|
134
|
+
middle_sections = "//clause[@type = 'scope' or @type = 'conformance'] "\
|
135
|
+
"| //foreword | //introduction | //preface/abstract | "\
|
136
|
+
"//submitters | //acknowledgements | //preface/clause | "\
|
137
|
+
" #{@klass.norm_ref_xpath} | //sections/terms | "\
|
138
|
+
"//sections/definitions | //clause[parent::sections]"
|
139
|
+
sequential_asset_names(d.xpath(ns(middle_sections)))
|
140
|
+
end
|
141
|
+
|
142
|
+
def preface_names_numbered(clause)
|
143
|
+
return if clause.nil?
|
144
|
+
@prefacenum += 1
|
145
|
+
pref = RomanNumerals.to_roman(@prefacenum).downcase
|
146
|
+
@anchors[clause["id"]] =
|
147
|
+
{ label: pref,
|
148
|
+
level: 1, xref: preface_clause_name(clause), type: "clause" }
|
149
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./definitions | "\
|
150
|
+
"./references")).each_with_index do |c, i|
|
151
|
+
section_names1(c, "#{pref}.#{i + 1}", 2)
|
152
|
+
end
|
153
|
+
end
|
94
154
|
end
|
95
155
|
end
|
96
156
|
end
|