isodoc 1.0.29 → 1.1.3.pre.alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +6 -12
- data/.github/workflows/ubuntu.yml +18 -20
- data/.github/workflows/windows.yml +6 -12
- data/Rakefile +3 -1
- data/isodoc.gemspec +2 -2
- data/lib/isodoc.rb +2 -0
- data/lib/isodoc/base_style/all.css +207 -0
- data/lib/isodoc/base_style/blocks.css +0 -0
- data/lib/isodoc/base_style/coverpage.css +0 -0
- data/lib/isodoc/base_style/defaults.css +0 -0
- data/lib/isodoc/base_style/metanorma_word.css +34 -0
- data/lib/isodoc/base_style/metanorma_word.scss +0 -1
- data/lib/isodoc/base_style/nav.css +0 -0
- data/lib/isodoc/base_style/reset.css +105 -0
- data/lib/isodoc/base_style/reset.scss +3 -3
- data/lib/isodoc/base_style/typography.css +0 -0
- data/lib/isodoc/common.rb +0 -4
- data/lib/isodoc/convert.rb +121 -58
- data/lib/isodoc/function/blocks.rb +3 -3
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/inline.rb +5 -5
- data/lib/isodoc/function/references.rb +29 -34
- data/lib/isodoc/function/reqt.rb +1 -1
- data/lib/isodoc/function/section.rb +7 -11
- data/lib/isodoc/function/table.rb +1 -1
- data/lib/isodoc/function/terms.rb +2 -2
- data/lib/isodoc/function/to_word_html.rb +2 -2
- data/lib/isodoc/function/utils.rb +57 -51
- data/lib/isodoc/gem_tasks.rb +117 -0
- data/lib/isodoc/headlesshtml_convert.rb +7 -6
- data/lib/isodoc/html_convert.rb +2 -1
- data/lib/isodoc/html_function/html.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +1 -1
- data/lib/isodoc/metadata.rb +69 -63
- data/lib/isodoc/pdf_convert.rb +8 -6
- data/lib/isodoc/presentation_xml_convert.rb +29 -0
- data/lib/isodoc/sassc_importer.rb +11 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +2 -1
- data/lib/isodoc/word_function/body.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +1 -0
- data/lib/isodoc/xref.rb +59 -0
- data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
- data/lib/isodoc/xref/xref_counter.rb +74 -0
- data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
- data/lib/isodoc/{function → xref}/xref_gen_seq.rb +34 -26
- data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
- data/lib/isodoc/xslfo_convert.rb +16 -4
- data/spec/assets/{html.css → html.scss} +0 -0
- data/spec/isodoc/footnotes_spec.rb +2 -2
- data/spec/isodoc/postproc_spec.rb +1319 -1345
- data/spec/isodoc/presentation_xml_spec.rb +20 -0
- data/spec/isodoc/ref_spec.rb +1 -1
- data/spec/isodoc/section_spec.rb +52 -0
- metadata +40 -28
- data/lib/isodoc/function/xref_counter.rb +0 -84
@@ -1,7 +1,7 @@
|
|
1
1
|
require "singleton"
|
2
2
|
|
3
|
-
module IsoDoc::
|
4
|
-
module
|
3
|
+
module IsoDoc::XrefGen
|
4
|
+
module Anchor
|
5
5
|
class Seen_Anchor
|
6
6
|
include Singleton
|
7
7
|
|
@@ -12,34 +12,23 @@ module IsoDoc::Function
|
|
12
12
|
def seen(x)
|
13
13
|
@seen.has_key?(x)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def add(x)
|
17
17
|
@seen[x] = true
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
21
|
+
def initialize()
|
22
|
+
@anchors = {}
|
23
|
+
end
|
22
24
|
|
23
25
|
def get_anchors
|
24
26
|
@anchors
|
25
27
|
end
|
26
28
|
|
27
|
-
def anchor(id, lbl, warning = true)
|
28
|
-
return nil if id.nil? || id.empty?
|
29
|
-
unless @anchors[id]
|
30
|
-
if warning
|
31
|
-
@seen ||= Seen_Anchor.instance
|
32
|
-
@seen.seen(id) or warn "No label has been processed for ID #{id}"
|
33
|
-
@seen.add(id)
|
34
|
-
return "[#{id}]"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
@anchors.dig(id, lbl)
|
38
|
-
end
|
39
|
-
|
40
29
|
def anchor_struct_label(lbl, elem)
|
41
30
|
case elem
|
42
|
-
when @
|
31
|
+
when @labels["appendix"] then l10n("#{elem} #{lbl}")
|
43
32
|
else
|
44
33
|
lbl.to_s
|
45
34
|
end
|
@@ -47,8 +36,8 @@ module IsoDoc::Function
|
|
47
36
|
|
48
37
|
def anchor_struct_xref(lbl, elem)
|
49
38
|
case elem
|
50
|
-
when @
|
51
|
-
when @
|
39
|
+
when @labels["formula"] then l10n("#{elem} (#{lbl})")
|
40
|
+
when @labels["inequality"] then l10n("#{elem} (#{lbl})")
|
52
41
|
else
|
53
42
|
l10n("#{elem} #{lbl}")
|
54
43
|
end
|
@@ -59,7 +48,7 @@ module IsoDoc::Function
|
|
59
48
|
ret[:label] = unnumbered == "true" ? nil : anchor_struct_label(lbl, elem)
|
60
49
|
ret[:xref] = anchor_struct_xref(unnumbered == "true" ? "(??)" : lbl, elem)
|
61
50
|
ret[:xref].gsub!(/ $/, "")
|
62
|
-
ret[:container] = get_clause_id(container) unless container.nil?
|
51
|
+
ret[:container] = @klass.get_clause_id(container) unless container.nil?
|
63
52
|
ret[:type] = type
|
64
53
|
ret
|
65
54
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require "roman-numerals"
|
2
|
+
|
3
|
+
module IsoDoc::XrefGen
|
4
|
+
class Counter
|
5
|
+
def initialize
|
6
|
+
@num = 0
|
7
|
+
@letter = ""
|
8
|
+
@subseq = ""
|
9
|
+
@letter_override = nil
|
10
|
+
@number_override = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def new_subseq_increment(node)
|
14
|
+
@subseq = node["subsequence"]
|
15
|
+
@num += 1
|
16
|
+
@letter = node["subsequence"] ? "a" : ""
|
17
|
+
if node["number"]
|
18
|
+
/^(?<n>\d*)(?<a>[a-z]*)$/ =~ node["number"]
|
19
|
+
if n || a
|
20
|
+
@letter_override = @letter = a if a
|
21
|
+
@number_override = @num = n.to_i if n
|
22
|
+
else
|
23
|
+
@letter_override = node["number"]
|
24
|
+
@letter = @letter_override if /^[a-z]$/.match(@letter_override)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def sequence_increment(node)
|
30
|
+
if node["number"]
|
31
|
+
@number_override = node["number"]
|
32
|
+
@num = @number_override.to_i if /^\d+$/.match(@number_override)
|
33
|
+
else
|
34
|
+
@num += 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def subsequence_increment(node)
|
39
|
+
if node["number"]
|
40
|
+
@letter_override = node["number"]
|
41
|
+
@letter = @letter_override if /^[a-z]$/.match(@letter_override)
|
42
|
+
else
|
43
|
+
@letter = (@letter.ord + 1).chr.to_s
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def increment(node)
|
48
|
+
return self if node["unnumbered"]
|
49
|
+
@letter_override = nil
|
50
|
+
@number_override = nil
|
51
|
+
if node["subsequence"] != @subseq
|
52
|
+
new_subseq_increment(node)
|
53
|
+
elsif @letter.empty?
|
54
|
+
sequence_increment(node)
|
55
|
+
else
|
56
|
+
subsequence_increment(node)
|
57
|
+
end
|
58
|
+
self
|
59
|
+
end
|
60
|
+
|
61
|
+
def print
|
62
|
+
"#{@number_override || @num}#{@letter_override || @letter}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def listlabel(depth)
|
66
|
+
return @num.to_s if [2, 7].include? depth
|
67
|
+
return (96 + @num).chr.to_s if [1, 6].include? depth
|
68
|
+
return (64 + @num).chr.to_s if [4, 9].include? depth
|
69
|
+
return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
|
70
|
+
return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
|
71
|
+
return @num.to_s
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
require_relative "
|
2
|
-
require_relative "xref_anchor"
|
3
|
-
require_relative "xref_gen_seq"
|
1
|
+
require_relative "xref_gen_seq.rb"
|
4
2
|
|
5
|
-
module IsoDoc::
|
6
|
-
module
|
3
|
+
module IsoDoc::XrefGen
|
4
|
+
module Blocks
|
7
5
|
def termnote_label(n)
|
8
|
-
@
|
6
|
+
@labels["termnote"].gsub(/%/, n.to_s)
|
9
7
|
end
|
10
8
|
|
11
9
|
def termnote_anchor_names(docxml)
|
@@ -17,7 +15,7 @@ module IsoDoc::Function
|
|
17
15
|
@anchors[n["id"]] =
|
18
16
|
{ label: termnote_label(c.print), type: "termnote",
|
19
17
|
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
20
|
-
"#{@
|
18
|
+
"#{@labels["note_xref"]} #{c.print}") }
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
@@ -33,7 +31,7 @@ module IsoDoc::Function
|
|
33
31
|
@anchors[n["id"]] = {
|
34
32
|
type: "termexample", label: idx,
|
35
33
|
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
36
|
-
"#{@
|
34
|
+
"#{@labels["example_xref"]} #{c.print}") }
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
@@ -57,7 +55,7 @@ module IsoDoc::Function
|
|
57
55
|
notes.each do |n|
|
58
56
|
next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
|
59
57
|
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
60
|
-
@anchors[n["id"]] = anchor_struct(idx, n, @
|
58
|
+
@anchors[n["id"]] = anchor_struct(idx, n, @labels["note_xref"],
|
61
59
|
"note", false)
|
62
60
|
end
|
63
61
|
note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
@@ -79,7 +77,7 @@ module IsoDoc::Function
|
|
79
77
|
next if @anchors[n["id"]]
|
80
78
|
next if n["id"].nil? || n["id"].empty?
|
81
79
|
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
82
|
-
@anchors[n["id"]] = anchor_struct(idx, n, @
|
80
|
+
@anchors[n["id"]] = anchor_struct(idx, n, @labels["example_xref"],
|
83
81
|
"example", n["unnumbered"])
|
84
82
|
end
|
85
83
|
example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
@@ -94,7 +92,7 @@ module IsoDoc::Function
|
|
94
92
|
notes.each do |n|
|
95
93
|
next if n["id"].nil? || n["id"].empty?
|
96
94
|
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
97
|
-
@anchors[n["id"]] = anchor_struct(idx, n, @
|
95
|
+
@anchors[n["id"]] = anchor_struct(idx, n, @labels["list"], "list", false)
|
98
96
|
list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
|
99
97
|
end
|
100
98
|
list_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
@@ -115,16 +113,5 @@ module IsoDoc::Function
|
|
115
113
|
end
|
116
114
|
end
|
117
115
|
end
|
118
|
-
|
119
|
-
# extract names for all anchors, xref and label
|
120
|
-
def anchor_names(docxml)
|
121
|
-
initial_anchor_names(docxml)
|
122
|
-
back_anchor_names(docxml)
|
123
|
-
# preempt clause notes with all other types of note (ISO default)
|
124
|
-
note_anchor_names(docxml.xpath(ns("//table | //figure")))
|
125
|
-
note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
|
126
|
-
example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
|
127
|
-
list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
|
128
|
-
end
|
129
116
|
end
|
130
117
|
end
|
@@ -1,11 +1,19 @@
|
|
1
|
-
module IsoDoc::
|
2
|
-
module
|
1
|
+
module IsoDoc::XrefGen
|
2
|
+
module Blocks
|
3
|
+
def hiersep
|
4
|
+
"."
|
5
|
+
end
|
6
|
+
|
7
|
+
def hierfigsep
|
8
|
+
"-"
|
9
|
+
end
|
10
|
+
|
3
11
|
def subfigure_increment(j, c, t)
|
4
12
|
if t.parent.name == "figure" then j += 1
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
13
|
+
else
|
14
|
+
j = 0
|
15
|
+
c.increment(t)
|
16
|
+
end
|
9
17
|
j
|
10
18
|
end
|
11
19
|
|
@@ -18,7 +26,7 @@ module IsoDoc::Function
|
|
18
26
|
label = c.print + (j.zero? ? "" : "-#{j}")
|
19
27
|
next if t["id"].nil? || t["id"].empty?
|
20
28
|
@anchors[t["id"]] =
|
21
|
-
anchor_struct(label, nil, @
|
29
|
+
anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
22
30
|
end
|
23
31
|
end
|
24
32
|
|
@@ -27,7 +35,7 @@ module IsoDoc::Function
|
|
27
35
|
clause.xpath(ns(".//table")).each do |t|
|
28
36
|
next if t["id"].nil? || t["id"].empty?
|
29
37
|
@anchors[t["id"]] = anchor_struct(c.increment(t).print, nil,
|
30
|
-
@
|
38
|
+
@labels["table"], "table", t["unnumbered"])
|
31
39
|
end
|
32
40
|
end
|
33
41
|
|
@@ -37,7 +45,7 @@ module IsoDoc::Function
|
|
37
45
|
next if t["id"].nil? || t["id"].empty?
|
38
46
|
@anchors[t["id"]] =
|
39
47
|
anchor_struct(c.increment(t).print, t,
|
40
|
-
t["inequality"] ? @
|
48
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
41
49
|
"formula", t["unnumbered"])
|
42
50
|
end
|
43
51
|
end
|
@@ -56,9 +64,9 @@ module IsoDoc::Function
|
|
56
64
|
end
|
57
65
|
|
58
66
|
def sequential_permission_names2(t, id)
|
59
|
-
sequential_permission_names1(t, id, "permission", @
|
60
|
-
sequential_permission_names1(t, id, "requirement", @
|
61
|
-
sequential_permission_names1(t, id, "recommendation", @
|
67
|
+
sequential_permission_names1(t, id, "permission", @labels["permission"])
|
68
|
+
sequential_permission_names1(t, id, "requirement", @labels["requirement"])
|
69
|
+
sequential_permission_names1(t, id, "recommendation", @labels["recommendation"])
|
62
70
|
end
|
63
71
|
|
64
72
|
def sequential_permission_names1(block, lbl, klass, label)
|
@@ -75,9 +83,9 @@ module IsoDoc::Function
|
|
75
83
|
sequential_table_names(clause)
|
76
84
|
sequential_figure_names(clause)
|
77
85
|
sequential_formula_names(clause)
|
78
|
-
sequential_permission_names(clause, "permission", @
|
79
|
-
sequential_permission_names(clause, "requirement", @
|
80
|
-
sequential_permission_names(clause, "recommendation", @
|
86
|
+
sequential_permission_names(clause, "permission", @labels["permission"])
|
87
|
+
sequential_permission_names(clause, "requirement", @labels["requirement"])
|
88
|
+
sequential_permission_names(clause, "recommendation", @labels["recommendation"])
|
81
89
|
end
|
82
90
|
|
83
91
|
def hierarchical_figure_names(clause, num)
|
@@ -89,7 +97,7 @@ module IsoDoc::Function
|
|
89
97
|
label = "#{num}#{hiersep}#{c.print}" +
|
90
98
|
(j.zero? ? "" : "#{hierfigsep}#{j}")
|
91
99
|
next if t["id"].nil? || t["id"].empty?
|
92
|
-
@anchors[t["id"]] = anchor_struct(label, nil, @
|
100
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure",
|
93
101
|
t["unnumbered"])
|
94
102
|
end
|
95
103
|
end
|
@@ -100,7 +108,7 @@ module IsoDoc::Function
|
|
100
108
|
next if t["id"].nil? || t["id"].empty?
|
101
109
|
@anchors[t["id"]] =
|
102
110
|
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
|
103
|
-
nil, @
|
111
|
+
nil, @labels["table"], "table", t["unnumbered"])
|
104
112
|
end
|
105
113
|
end
|
106
114
|
|
@@ -108,11 +116,11 @@ module IsoDoc::Function
|
|
108
116
|
hierarchical_table_names(clause, num)
|
109
117
|
hierarchical_figure_names(clause, num)
|
110
118
|
hierarchical_formula_names(clause, num)
|
111
|
-
hierarchical_permission_names(clause, num, "permission", @
|
119
|
+
hierarchical_permission_names(clause, num, "permission", @labels["permission"])
|
112
120
|
hierarchical_permission_names(clause, num, "requirement",
|
113
|
-
@
|
121
|
+
@labels["requirement"])
|
114
122
|
hierarchical_permission_names(clause, num, "recommendation",
|
115
|
-
@
|
123
|
+
@labels["recommendation"])
|
116
124
|
end
|
117
125
|
|
118
126
|
def hierarchical_formula_names(clause, num)
|
@@ -121,7 +129,7 @@ module IsoDoc::Function
|
|
121
129
|
next if t["id"].nil? || t["id"].empty?
|
122
130
|
@anchors[t["id"]] =
|
123
131
|
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", nil,
|
124
|
-
t["inequality"] ? @
|
132
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
125
133
|
"formula", t["unnumbered"])
|
126
134
|
end
|
127
135
|
end
|
@@ -136,13 +144,13 @@ module IsoDoc::Function
|
|
136
144
|
end
|
137
145
|
end
|
138
146
|
|
139
|
-
|
140
|
-
hierarchical_permission_names1(t, id, "permission", @
|
141
|
-
hierarchical_permission_names1(t, id, "requirement", @
|
142
|
-
hierarchical_permission_names1(t, id, "recommendation", @
|
147
|
+
def hierarchical_permission_names2(t, id)
|
148
|
+
hierarchical_permission_names1(t, id, "permission", @labels["permission"])
|
149
|
+
hierarchical_permission_names1(t, id, "requirement", @labels["requirement"])
|
150
|
+
hierarchical_permission_names1(t, id, "recommendation", @labels["recommendation"])
|
143
151
|
end
|
144
152
|
|
145
|
-
|
153
|
+
def hierarchical_permission_names1(block, lbl, klass, label)
|
146
154
|
c = Counter.new
|
147
155
|
block.xpath(ns("./#{klass}")).each do |t|
|
148
156
|
next if t["id"].nil? || t["id"].empty?
|
@@ -1,18 +1,16 @@
|
|
1
|
-
module IsoDoc::
|
2
|
-
module
|
1
|
+
module IsoDoc::XrefGen
|
2
|
+
module Sections
|
3
3
|
def back_anchor_names(docxml)
|
4
4
|
docxml.xpath(ns("//annex")).each_with_index do |c, i|
|
5
5
|
annex_names(c, (65 + i).chr.to_s)
|
6
6
|
end
|
7
7
|
docxml.xpath(
|
8
|
-
ns(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
reference_names(ref)
|
15
|
-
end
|
8
|
+
ns(@klass.bibliography_xpath)).each do |b|
|
9
|
+
preface_names(b)
|
10
|
+
end
|
11
|
+
docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
|
12
|
+
reference_names(ref)
|
13
|
+
end
|
16
14
|
end
|
17
15
|
|
18
16
|
def initial_anchor_names(d)
|
@@ -20,9 +18,7 @@ module IsoDoc::Function
|
|
20
18
|
# potentially overridden in middle_section_asset_names()
|
21
19
|
sequential_asset_names(d.xpath(ns("//preface/*")))
|
22
20
|
n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
|
23
|
-
n = section_names(d.at(ns(
|
24
|
-
"//bibliography/clause[.//references[@normative = 'true']] | "\
|
25
|
-
"//bibliography/references[@normative = 'true']")), n, 1)
|
21
|
+
n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
|
26
22
|
n = section_names(d.at(ns("//sections/terms | "\
|
27
23
|
"//sections/clause[descendant::terms]")), n, 1)
|
28
24
|
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
@@ -65,15 +61,14 @@ module IsoDoc::Function
|
|
65
61
|
|
66
62
|
def middle_section_asset_names(d)
|
67
63
|
middle_sections = "//clause[title = 'Scope'] | "\
|
68
|
-
"
|
64
|
+
"#{@klass.norm_ref_xpath} | "\
|
69
65
|
"//sections/terms | //preface/* | "\
|
70
66
|
"//sections/definitions | //clause[parent::sections]"
|
71
67
|
sequential_asset_names(d.xpath(ns(middle_sections)))
|
72
68
|
end
|
73
69
|
|
74
70
|
def clause_names(docxml, sect_num)
|
75
|
-
|
76
|
-
docxml.xpath(ns(q)).each_with_index do |c, i|
|
71
|
+
docxml.xpath(ns(@klass.middle_clause)).each_with_index do |c, i|
|
77
72
|
section_names(c, (i + sect_num), 1)
|
78
73
|
end
|
79
74
|
end
|
@@ -82,7 +77,7 @@ module IsoDoc::Function
|
|
82
77
|
return num if clause.nil?
|
83
78
|
num = num + 1
|
84
79
|
@anchors[clause["id"]] =
|
85
|
-
{ label: num.to_s, xref: l10n("#{@
|
80
|
+
{ label: num.to_s, xref: l10n("#{@labels["clause"]} #{num}"), level: lvl,
|
86
81
|
type: "clause" }
|
87
82
|
clause.xpath(ns(SUBCLAUSES)).
|
88
83
|
each_with_index do |c, i|
|
@@ -93,7 +88,7 @@ module IsoDoc::Function
|
|
93
88
|
|
94
89
|
def section_names1(clause, num, level)
|
95
90
|
@anchors[clause["id"]] =
|
96
|
-
{ label: num, level: level, xref: l10n("#{@
|
91
|
+
{ label: num, level: level, xref: l10n("#{@labels["clause"]} #{num}"),
|
97
92
|
type: "clause" }
|
98
93
|
clause.xpath(ns(SUBCLAUSES)).
|
99
94
|
each_with_index do |c, i|
|
@@ -102,9 +97,9 @@ module IsoDoc::Function
|
|
102
97
|
end
|
103
98
|
|
104
99
|
def annex_name_lbl(clause, num)
|
105
|
-
obl = l10n("(#{@
|
106
|
-
obl = l10n("(#{@
|
107
|
-
l10n("<b>#{@
|
100
|
+
obl = l10n("(#{@labels["inform_annex"]})")
|
101
|
+
obl = l10n("(#{@labels["norm_annex"]})") if clause["obligation"] == "normative"
|
102
|
+
l10n("<b>#{@labels["annex"]} #{num}</b><br/>#{obl}")
|
108
103
|
end
|
109
104
|
|
110
105
|
def single_annex_special_section(clause)
|
@@ -119,7 +114,7 @@ module IsoDoc::Function
|
|
119
114
|
def annex_names(clause, num)
|
120
115
|
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num),
|
121
116
|
type: "clause",
|
122
|
-
xref: "#{@
|
117
|
+
xref: "#{@labels["annex"]} #{num}", level: 1 }
|
123
118
|
if a = single_annex_special_section(clause)
|
124
119
|
annex_names1(a, "#{num}", 1)
|
125
120
|
else
|
@@ -131,11 +126,26 @@ module IsoDoc::Function
|
|
131
126
|
end
|
132
127
|
|
133
128
|
def annex_names1(clause, num, level)
|
134
|
-
@anchors[clause["id"]] = { label: num, xref: "#{@
|
129
|
+
@anchors[clause["id"]] = { label: num, xref: "#{@labels["annex"]} #{num}",
|
135
130
|
level: level, type: "clause" }
|
136
131
|
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
137
132
|
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
138
133
|
end
|
139
134
|
end
|
135
|
+
|
136
|
+
ISO_PUBLISHER_XPATH =
|
137
|
+
"./contributor[xmlns:role/@type = 'publisher']/"\
|
138
|
+
"organization[abbreviation = 'ISO' or xmlns:abbreviation = 'IEC' or "\
|
139
|
+
"xmlns:name = 'International Organization for Standardization' or "\
|
140
|
+
"xmlns:name = 'International Electrotechnical Commission']".freeze
|
141
|
+
|
142
|
+
def reference_names(ref)
|
143
|
+
isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
|
144
|
+
ids = @klass.bibitem_ref_code(ref)
|
145
|
+
identifiers = @klass.render_identifier(ids)
|
146
|
+
date = ref.at(ns("./date[@type = 'published']"))
|
147
|
+
reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
|
148
|
+
@anchors[ref["id"]] = { xref: reference }
|
149
|
+
end
|
140
150
|
end
|
141
151
|
end
|