isodoc 3.4.1 → 3.4.3
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/lib/isodoc/base_style/typography.scss +5 -0
- data/lib/isodoc/convert.rb +3 -2
- data/lib/isodoc/function/blocks.rb +33 -5
- data/lib/isodoc/function/blocks_example_note.rb +5 -3
- data/lib/isodoc/function/cleanup.rb +5 -4
- data/lib/isodoc/function/inline.rb +9 -27
- data/lib/isodoc/function/inline_simple.rb +25 -0
- data/lib/isodoc/function/references.rb +11 -4
- data/lib/isodoc/function/setup.rb +2 -1
- data/lib/isodoc/function/table.rb +2 -2
- data/lib/isodoc/function/to_word_html.rb +1 -0
- data/lib/isodoc/function/utils.rb +1 -1
- data/lib/isodoc/init.rb +17 -7
- data/lib/isodoc/metadata.rb +10 -6
- data/lib/isodoc/metadata_contributor.rb +15 -2
- data/lib/isodoc/presentation_function/autonum.rb +65 -4
- data/lib/isodoc/presentation_function/bibdata.rb +15 -4
- data/lib/isodoc/presentation_function/block.rb +36 -78
- data/lib/isodoc/presentation_function/docid.rb +18 -10
- data/lib/isodoc/presentation_function/erefs.rb +55 -28
- data/lib/isodoc/presentation_function/erefs_locality.rb +18 -10
- data/lib/isodoc/presentation_function/footnotes.rb +2 -1
- data/lib/isodoc/presentation_function/image.rb +15 -5
- data/lib/isodoc/presentation_function/index.rb +1 -5
- data/lib/isodoc/presentation_function/inline.rb +2 -20
- data/lib/isodoc/presentation_function/list.rb +3 -3
- data/lib/isodoc/presentation_function/metadata.rb +50 -32
- data/lib/isodoc/presentation_function/refs.rb +70 -86
- data/lib/isodoc/presentation_function/section.rb +0 -3
- data/lib/isodoc/presentation_function/section_refs.rb +55 -0
- data/lib/isodoc/presentation_function/source.rb +73 -0
- data/lib/isodoc/presentation_function/terms.rb +7 -5
- data/lib/isodoc/presentation_function/xrefs.rb +17 -6
- data/lib/isodoc/presentation_xml_convert.rb +10 -4
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/lists.rb +4 -2
- data/lib/isodoc/word_function/postprocess_table.rb +3 -1
- data/lib/isodoc/xref/xref_gen.rb +72 -119
- data/lib/isodoc/xref/xref_gen_seq.rb +18 -14
- data/lib/isodoc/xref/xref_list_gen.rb +107 -0
- data/lib/isodoc/xref/xref_sect_asset.rb +0 -1
- data/lib/isodoc/xref/xref_sect_gen.rb +0 -2
- data/lib/isodoc/xref.rb +1 -0
- data/lib/isodoc/xslfo_convert.rb +5 -1
- data/lib/isodoc-yaml/i18n-ar.yaml +9 -0
- data/lib/isodoc-yaml/i18n-de.yaml +9 -0
- data/lib/isodoc-yaml/i18n-en.yaml +9 -0
- data/lib/isodoc-yaml/i18n-es.yaml +9 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +9 -0
- data/lib/isodoc-yaml/i18n-ja.yaml +9 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +9 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +9 -0
- metadata +5 -2
data/lib/isodoc/xref/xref_gen.rb
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
require_relative "xref_gen_seq"
|
|
2
|
-
require_relative "xref_util"
|
|
3
|
-
|
|
4
1
|
module IsoDoc
|
|
5
2
|
module XrefGen
|
|
6
3
|
module Blocks
|
|
@@ -10,13 +7,17 @@ module IsoDoc
|
|
|
10
7
|
|
|
11
8
|
def amend_preprocess(xmldoc)
|
|
12
9
|
xmldoc.xpath(ns("//amend[newcontent]")).each do |a|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
amend_preprocess1(a)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def amend_preprocess1(amend, subclause: false)
|
|
15
|
+
autonum = amend_autonums(amend)
|
|
16
|
+
NUMBERED_BLOCKS.each do |b|
|
|
17
|
+
amend_blocks(amend, autonum, b, subclause)
|
|
18
|
+
end
|
|
19
|
+
amend.xpath(ns(".#{amend_newcontent(subclause)}/clause")).each do |c|
|
|
20
|
+
amend_preprocess1(c, subclause: true)
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
@@ -28,6 +29,20 @@ module IsoDoc
|
|
|
28
29
|
autonum
|
|
29
30
|
end
|
|
30
31
|
|
|
32
|
+
def amend_blocks(amend, autonum, blocktype, subclause)
|
|
33
|
+
newc = amend_newcontent(subclause)
|
|
34
|
+
(amend.xpath(ns(".#{newc}//#{blocktype}")) -
|
|
35
|
+
amend.xpath(ns(".#{newc}/clause//#{blocktype}")))
|
|
36
|
+
.each_with_index do |e, i|
|
|
37
|
+
autonum[blocktype] && i.zero? and e["number"] = autonum[blocktype]
|
|
38
|
+
!autonum[blocktype] and e["unnumbered"] = "true"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def amend_newcontent(subclause)
|
|
43
|
+
subclause ? "" : "/newcontent"
|
|
44
|
+
end
|
|
45
|
+
|
|
31
46
|
def termnote_label(node, label)
|
|
32
47
|
if label.blank?
|
|
33
48
|
@labels["termnote"].gsub(/%\s?/, "")
|
|
@@ -50,17 +65,42 @@ module IsoDoc
|
|
|
50
65
|
end
|
|
51
66
|
end
|
|
52
67
|
|
|
68
|
+
# processed from Presentation XML notes_inside_bibitem(),
|
|
69
|
+
# after notes moved: need docid from references processing
|
|
70
|
+
def bibitem_note_names(bib)
|
|
71
|
+
notes = bib.xpath(ns("./formattedref/note"))
|
|
72
|
+
counter = Counter.new
|
|
73
|
+
notes.noblank.each do |n|
|
|
74
|
+
lbl = increment_label(notes, n, counter)
|
|
75
|
+
@anchors[n["id"]] =
|
|
76
|
+
{ label: lbl, value: lbl, container: bib["id"],
|
|
77
|
+
xref: anchor_struct_xref(lbl, n, @labels["note_xref"]),
|
|
78
|
+
elem: @labels["note_xref"], type: "note" }
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# note within an asset: table, figure, provision
|
|
83
|
+
def nested_notes(asset, container: true)
|
|
84
|
+
notes = asset.xpath(ns(".//note"))
|
|
85
|
+
counter = Counter.new
|
|
86
|
+
notes.noblank.each do |n|
|
|
87
|
+
lbl = increment_label(notes, n, counter)
|
|
88
|
+
@anchors[n["id"]] =
|
|
89
|
+
{ label: lbl, value: lbl, container: container ? asset["id"] : nil,
|
|
90
|
+
xref: anchor_struct_xref(lbl, n, @labels["note_xref"]),
|
|
91
|
+
elem: @labels["note_xref"], type: "note" }.compact
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
53
95
|
def termexample_anchor_names(docxml)
|
|
54
96
|
docxml.xpath(ns("//*[termexample]")).each do |t|
|
|
55
97
|
examples = t.xpath(ns("./termexample"))
|
|
56
|
-
|
|
57
|
-
examples.noblank.each do |n|
|
|
98
|
+
examples.noblank.each_with_object(Counter.new) do |n, c|
|
|
58
99
|
c.increment(n)
|
|
59
100
|
idx = increment_label(examples, n, c, increment: false)
|
|
60
101
|
@anchors[n["id"]] =
|
|
61
|
-
{ label: idx, type: "termexample",
|
|
62
|
-
|
|
63
|
-
container: t["id"],
|
|
102
|
+
{ label: idx, type: "termexample", value: idx,
|
|
103
|
+
elem: @labels["example_xref"], container: t["id"],
|
|
64
104
|
xref: anchor_struct_xref(idx, n, @labels["example_xref"]) }
|
|
65
105
|
end
|
|
66
106
|
end
|
|
@@ -69,7 +109,8 @@ module IsoDoc
|
|
|
69
109
|
def note_anchor_names(sections)
|
|
70
110
|
sections.each do |s|
|
|
71
111
|
notes = s.xpath(child_asset_path("note")) -
|
|
72
|
-
s.xpath(ns(".//figure//note | .//table//note"
|
|
112
|
+
s.xpath(ns(".//figure//note | .//table//note | //permission//note | " \
|
|
113
|
+
"//recommendation//note | //requirement//note"))
|
|
73
114
|
note_anchor_names1(notes, Counter.new)
|
|
74
115
|
note_anchor_names(s.xpath(ns(child_sections)))
|
|
75
116
|
end
|
|
@@ -102,9 +143,23 @@ module IsoDoc
|
|
|
102
143
|
end
|
|
103
144
|
end
|
|
104
145
|
|
|
146
|
+
# note within an asset: provision
|
|
147
|
+
def nested_examples(asset, container: true)
|
|
148
|
+
notes = asset.xpath(ns(".//example"))
|
|
149
|
+
notes.noblank.each_with_object(Counter.new) do |n, counter|
|
|
150
|
+
@anchors[n["id"]] ||=
|
|
151
|
+
anchor_struct(increment_label(notes, n, counter), n,
|
|
152
|
+
@labels["example_xref"], "example",
|
|
153
|
+
{ unnumb: n["unnumbered"] })
|
|
154
|
+
@anchors[n["id"]][:container] = container ? asset["id"] : nil
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
105
158
|
def example_anchor_names(sections)
|
|
106
159
|
sections.each do |s|
|
|
107
|
-
notes = s.xpath(child_asset_path("example"))
|
|
160
|
+
notes = s.xpath(child_asset_path("example")) -
|
|
161
|
+
s.xpath(ns("//permission//note | " \
|
|
162
|
+
"//recommendation//note | //requirement//note"))
|
|
108
163
|
example_anchor_names1(notes, Counter.new)
|
|
109
164
|
example_anchor_names(s.xpath(ns(child_sections)))
|
|
110
165
|
end
|
|
@@ -119,108 +174,6 @@ module IsoDoc
|
|
|
119
174
|
end
|
|
120
175
|
end
|
|
121
176
|
|
|
122
|
-
def list_anchor_names(sections)
|
|
123
|
-
sections.each do |s|
|
|
124
|
-
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
|
125
|
-
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
|
126
|
-
c = list_counter(0, {})
|
|
127
|
-
notes.noblank.each do |n|
|
|
128
|
-
@anchors[n["id"]] =
|
|
129
|
-
anchor_struct(increment_label(notes, n, c), n,
|
|
130
|
-
@labels["list"], "list",
|
|
131
|
-
{ unnumb: false, container: true })
|
|
132
|
-
list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
|
|
133
|
-
end
|
|
134
|
-
list_anchor_names(s.xpath(ns(child_sections)))
|
|
135
|
-
end
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def list_item_delim
|
|
139
|
-
")"
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def list_item_anchor_names(list, list_anchor, depth, prev_label,
|
|
143
|
-
refer_list)
|
|
144
|
-
c = list_counter(list["start"] ? list["start"].to_i - 1 : 0, {})
|
|
145
|
-
list.xpath(ns("./li")).each do |li|
|
|
146
|
-
bare_label, label =
|
|
147
|
-
list_item_value(li, c, depth,
|
|
148
|
-
{ list_anchor:, prev_label:,
|
|
149
|
-
refer_list: depth == 1 ? refer_list : nil })
|
|
150
|
-
@anchors[li["id"]] =
|
|
151
|
-
{ label: bare_label, bare_xref: "#{label})", type: "listitem",
|
|
152
|
-
xref: %[#{label}#{delim_wrap(list_item_delim)}], refer_list:,
|
|
153
|
-
container: list_anchor[:container] }
|
|
154
|
-
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
|
155
|
-
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
|
156
|
-
refer_list)
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def list_item_value(entry, counter, depth, opts)
|
|
162
|
-
label = counter.increment(entry).listlabel(entry.parent, depth)
|
|
163
|
-
s = semx(entry, label)
|
|
164
|
-
[label,
|
|
165
|
-
list_item_anchor_label(s, opts[:list_anchor], opts[:prev_label],
|
|
166
|
-
opts[:refer_list])]
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
def list_item_anchor_label(label, list_anchor, prev_label, refer_list)
|
|
170
|
-
prev_label.empty? or
|
|
171
|
-
label = @klass.connectives_spans(@i18n.list_nested_xref
|
|
172
|
-
.sub("%1", %[#{prev_label}#{delim_wrap(list_item_delim)}])
|
|
173
|
-
.sub("%2", label))
|
|
174
|
-
refer_list and
|
|
175
|
-
label = @klass.connectives_spans(@i18n.list_nested_xref
|
|
176
|
-
.sub("%1", list_anchor[:xref])
|
|
177
|
-
.sub("%2", label))
|
|
178
|
-
label
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def deflist_anchor_names(sections)
|
|
182
|
-
sections.each do |s|
|
|
183
|
-
notes = s.xpath(ns(".//dl")) - s.xpath(ns(".//clause//dl")) -
|
|
184
|
-
s.xpath(ns(".//appendix//dl")) - s.xpath(ns(".//dl//dl"))
|
|
185
|
-
deflist_anchor_names1(notes, Counter.new)
|
|
186
|
-
deflist_anchor_names(s.xpath(ns(child_sections)))
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
def deflist_anchor_names1(notes, counter)
|
|
191
|
-
notes.noblank.each do |n|
|
|
192
|
-
@anchors[n["id"]] =
|
|
193
|
-
anchor_struct(increment_label(notes, n, counter), n,
|
|
194
|
-
@labels["deflist"], "deflist",
|
|
195
|
-
{ unnumb: false, container: true })
|
|
196
|
-
deflist_term_anchor_names(n, @anchors[n["id"]])
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
def deflist_term_anchor_names(list, list_anchor)
|
|
201
|
-
list.xpath(ns("./dt")).each do |li|
|
|
202
|
-
label = deflist_term_anchor_lbl(li, list_anchor)
|
|
203
|
-
li["id"] and @anchors[li["id"]] =
|
|
204
|
-
{ xref: label, type: "deflistitem",
|
|
205
|
-
container: list_anchor[:container] }
|
|
206
|
-
li.xpath(ns("./dl")).each do |dl|
|
|
207
|
-
deflist_term_anchor_names(dl, list_anchor)
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
def deflist_term_anchor_lbl(listitem, list_anchor)
|
|
213
|
-
s = semx(listitem, dt2xreflabel(listitem))
|
|
214
|
-
%(#{list_anchor[:xref]}#{delim_wrap(":")} #{s}</semx>)
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def dt2xreflabel(dterm)
|
|
218
|
-
label = dterm.dup
|
|
219
|
-
label.xpath(ns(".//p")).each { |x| x.replace(x.children) }
|
|
220
|
-
label.xpath(ns(".//index")).each(&:remove)
|
|
221
|
-
Common::to_xml(label.children)
|
|
222
|
-
end
|
|
223
|
-
|
|
224
177
|
def id_ancestor(node)
|
|
225
178
|
parent = nil
|
|
226
179
|
node.ancestors.each do |a|
|
|
@@ -56,6 +56,7 @@ module IsoDoc
|
|
|
56
56
|
{ unnumb: elem["unnumbered"], container: }
|
|
57
57
|
)
|
|
58
58
|
end
|
|
59
|
+
nested_notes(elem)
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
def fig_subfig_label(label, sublabel)
|
|
@@ -87,6 +88,7 @@ module IsoDoc
|
|
|
87
88
|
c.increment(t).print, t, @labels["table"], "table",
|
|
88
89
|
{ unnumb: t["unnumbered"], container: container }
|
|
89
90
|
)
|
|
91
|
+
nested_notes(t)
|
|
90
92
|
end
|
|
91
93
|
end
|
|
92
94
|
|
|
@@ -114,11 +116,6 @@ module IsoDoc
|
|
|
114
116
|
end
|
|
115
117
|
end
|
|
116
118
|
|
|
117
|
-
def delim_wrap(delim, klass = "fmt-autonum-delim")
|
|
118
|
-
delim.blank? and return ""
|
|
119
|
-
"<span class='#{klass}'><esc>#{delim}</esc></span>"
|
|
120
|
-
end
|
|
121
|
-
|
|
122
119
|
def sequential_permission_children(elem, lbl, klass, container: false)
|
|
123
120
|
elem.xpath(ns(req_children)).noblank
|
|
124
121
|
.each_with_object(ReqCounter.new) do |t, c|
|
|
@@ -137,23 +134,29 @@ container: false)
|
|
|
137
134
|
lbl = parent_id ? "#{parent_id}#{subreqt_separator}#{id}" : id
|
|
138
135
|
e = elem["id"] || elem["original-id"]
|
|
139
136
|
@anchors[e] = model.postprocess_anchor_struct(
|
|
140
|
-
elem, anchor_struct(lbl, elem,
|
|
141
|
-
|
|
137
|
+
elem, anchor_struct(lbl, elem, label, klass,
|
|
138
|
+
{ unnumb: elem["unnumbered"], container: })
|
|
142
139
|
)
|
|
140
|
+
nested_notes(elem)
|
|
141
|
+
nested_examples(elem)
|
|
143
142
|
@anchors[e][:semx] = semx(elem, lbl)
|
|
144
|
-
|
|
145
|
-
x = "#{subreqt_separator(markup: true)}#{semx(elem, id)}"
|
|
146
|
-
@anchors[e][:semx] = @anchors[elem.parent["id"] || elem.parent["original-id"]][:semx] + x
|
|
147
|
-
@anchors[e][:label] =
|
|
148
|
-
"<span class='fmt-element-name'>#{label}</span> #{@anchors[e][:semx]}"
|
|
149
|
-
@anchors[e][:xref] = @anchors[e][:label]
|
|
150
|
-
end
|
|
143
|
+
sequential_permission_body_parent_id(id, parent_id, elem, label, e)
|
|
151
144
|
model.permission_parts(elem, id, label, klass).each do |n|
|
|
152
145
|
@anchors[n[:id]] = anchor_struct(n[:number], n[:elem], n[:label],
|
|
153
146
|
n[:klass], { unnumb: false, container: })
|
|
154
147
|
end
|
|
155
148
|
end
|
|
156
149
|
|
|
150
|
+
def sequential_permission_body_parent_id(id, parent_id, elem, label, e)
|
|
151
|
+
parent_id or return
|
|
152
|
+
x = "#{subreqt_separator(markup: true)}#{semx(elem, id)}"
|
|
153
|
+
@anchors[e][:semx] =
|
|
154
|
+
@anchors[elem.parent["id"] || elem.parent["original-id"]][:semx] + x
|
|
155
|
+
@anchors[e][:label] =
|
|
156
|
+
"<span class='fmt-element-name'>#{label}</span> #{@anchors[e][:semx]}"
|
|
157
|
+
@anchors[e][:xref] = @anchors[e][:label]
|
|
158
|
+
end
|
|
159
|
+
|
|
157
160
|
def reqt2class_label(elem, model)
|
|
158
161
|
elem["class"] and return [elem["class"], elem["class"]]
|
|
159
162
|
model.req_class_paths.each do |n|
|
|
@@ -207,6 +210,7 @@ container: false)
|
|
|
207
210
|
anchor_struct(hiersemx(clause, num, c.increment(t), t),
|
|
208
211
|
t, @labels["table"], "table",
|
|
209
212
|
{ unnumb: t["unnumbered"], container: false })
|
|
213
|
+
nested_notes(t)
|
|
210
214
|
end
|
|
211
215
|
end
|
|
212
216
|
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
module IsoDoc
|
|
2
|
+
module XrefGen
|
|
3
|
+
module Blocks
|
|
4
|
+
def list_anchor_names(sections)
|
|
5
|
+
sections.each do |s|
|
|
6
|
+
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
|
7
|
+
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
|
8
|
+
c = list_counter(0, {})
|
|
9
|
+
notes.noblank.each do |n|
|
|
10
|
+
@anchors[n["id"]] =
|
|
11
|
+
anchor_struct(increment_label(notes, n, c), n,
|
|
12
|
+
@labels["list"], "list",
|
|
13
|
+
{ unnumb: false, container: true })
|
|
14
|
+
list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
|
|
15
|
+
end
|
|
16
|
+
list_anchor_names(s.xpath(ns(child_sections)))
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def list_item_delim
|
|
21
|
+
")"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def list_item_anchor_names(list, list_anchor, depth, prev_label,
|
|
25
|
+
refer_list)
|
|
26
|
+
c = list_counter(list["start"] ? list["start"].to_i - 1 : 0, {})
|
|
27
|
+
list.xpath(ns("./li")).each do |li|
|
|
28
|
+
bare_label, label =
|
|
29
|
+
list_item_value(li, c, depth,
|
|
30
|
+
{ list_anchor:, prev_label:,
|
|
31
|
+
refer_list: depth == 1 ? refer_list : nil })
|
|
32
|
+
@anchors[li["id"]] =
|
|
33
|
+
{ label: bare_label, bare_xref: "#{label})", type: "listitem",
|
|
34
|
+
xref: %[#{label}#{delim_wrap(list_item_delim)}], refer_list:,
|
|
35
|
+
container: list_anchor[:container] }
|
|
36
|
+
(li.xpath(ns(".//ol")) - li.xpath(ns(".//ol//ol"))).each do |ol|
|
|
37
|
+
list_item_anchor_names(ol, list_anchor, depth + 1, label,
|
|
38
|
+
refer_list)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def list_item_value(entry, counter, depth, opts)
|
|
44
|
+
label = counter.increment(entry).listlabel(entry.parent, depth)
|
|
45
|
+
s = semx(entry, label)
|
|
46
|
+
[label,
|
|
47
|
+
list_item_anchor_label(s, opts[:list_anchor], opts[:prev_label],
|
|
48
|
+
opts[:refer_list])]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def list_item_anchor_label(label, list_anchor, prev_label, refer_list)
|
|
52
|
+
prev_label.empty? or
|
|
53
|
+
label = @klass.connectives_spans(@i18n.list_nested_xref
|
|
54
|
+
.sub("%1", %[#{prev_label}#{delim_wrap(list_item_delim)}])
|
|
55
|
+
.sub("%2", label))
|
|
56
|
+
refer_list and
|
|
57
|
+
label = @klass.connectives_spans(@i18n.list_nested_xref
|
|
58
|
+
.sub("%1", list_anchor[:xref])
|
|
59
|
+
.sub("%2", label))
|
|
60
|
+
label
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def deflist_anchor_names(sections)
|
|
64
|
+
sections.each do |s|
|
|
65
|
+
notes = s.xpath(ns(".//dl")) - s.xpath(ns(".//clause//dl")) -
|
|
66
|
+
s.xpath(ns(".//appendix//dl")) - s.xpath(ns(".//dl//dl"))
|
|
67
|
+
deflist_anchor_names1(notes, Counter.new)
|
|
68
|
+
deflist_anchor_names(s.xpath(ns(child_sections)))
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def deflist_anchor_names1(notes, counter)
|
|
73
|
+
notes.noblank.each do |n|
|
|
74
|
+
@anchors[n["id"]] =
|
|
75
|
+
anchor_struct(increment_label(notes, n, counter), n,
|
|
76
|
+
@labels["deflist"], "deflist",
|
|
77
|
+
{ unnumb: false, container: true })
|
|
78
|
+
deflist_term_anchor_names(n, @anchors[n["id"]])
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def deflist_term_anchor_names(list, list_anchor)
|
|
83
|
+
list.xpath(ns("./dt")).each do |li|
|
|
84
|
+
label = deflist_term_anchor_lbl(li, list_anchor)
|
|
85
|
+
li["id"] and @anchors[li["id"]] =
|
|
86
|
+
{ xref: label, type: "deflistitem",
|
|
87
|
+
container: list_anchor[:container] }
|
|
88
|
+
li.xpath(ns("./dl")).each do |dl|
|
|
89
|
+
deflist_term_anchor_names(dl, list_anchor)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def deflist_term_anchor_lbl(listitem, list_anchor)
|
|
95
|
+
s = semx(listitem, dt2xreflabel(listitem))
|
|
96
|
+
%(#{list_anchor[:xref]}#{delim_wrap(":")} #{s}</semx>)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def dt2xreflabel(dterm)
|
|
100
|
+
label = dterm.dup
|
|
101
|
+
label.xpath(ns(".//p")).each { |x| x.replace(x.children) }
|
|
102
|
+
label.xpath(ns(".//index")).each(&:remove)
|
|
103
|
+
Common::to_xml(label.children)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -7,7 +7,6 @@ module IsoDoc
|
|
|
7
7
|
middle_section_asset_names(doc)
|
|
8
8
|
termnote_anchor_names(doc)
|
|
9
9
|
termexample_anchor_names(doc)
|
|
10
|
-
note_anchor_names(doc.xpath(ns("//table | //figure")))
|
|
11
10
|
sections = doc.xpath(ns(sections_xpath))
|
|
12
11
|
note_anchor_names(sections)
|
|
13
12
|
admonition_anchor_names(sections)
|
|
@@ -162,7 +162,6 @@ module IsoDoc
|
|
|
162
162
|
xref = labelled_autonum(@labels["clause"], num)
|
|
163
163
|
label = num
|
|
164
164
|
c = clause_title(clause) and title = semx(clause, c, "title")
|
|
165
|
-
#clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
|
166
165
|
@anchors[clause["id"]] =
|
|
167
166
|
{ label:, xref:, title:, level:, type: "clause",
|
|
168
167
|
elem: @labels["clause"] }
|
|
@@ -184,7 +183,6 @@ module IsoDoc
|
|
|
184
183
|
level == 1 && clause.name == "annex" and
|
|
185
184
|
label = annex_name_lbl(clause, label)
|
|
186
185
|
c = clause_title(clause) and title = semx(clause, c, "title")
|
|
187
|
-
#clause["id"] ||= "_#{UUIDTools::UUID.random_create}"
|
|
188
186
|
@anchors[clause["id"]] =
|
|
189
187
|
{ label:, xref: labelled_autonum(@labels["annex"], num), title:,
|
|
190
188
|
elem: @labels["annex"], type: "clause",
|
data/lib/isodoc/xref.rb
CHANGED
|
@@ -3,6 +3,7 @@ require_relative "xref/xref_counter"
|
|
|
3
3
|
require_relative "xref/xref_counter_types"
|
|
4
4
|
require_relative "xref/xref_gen_seq"
|
|
5
5
|
require_relative "xref/xref_gen"
|
|
6
|
+
require_relative "xref/xref_list_gen"
|
|
6
7
|
require_relative "xref/xref_sect_gen"
|
|
7
8
|
require_relative "xref/xref_util"
|
|
8
9
|
require_relative "class_utils"
|
data/lib/isodoc/xslfo_convert.rb
CHANGED
|
@@ -15,7 +15,11 @@ module IsoDoc
|
|
|
15
15
|
pdfallowprinthq: "--allow-print-hq",
|
|
16
16
|
pdfstylesheet: "--xsl-file",
|
|
17
17
|
pdfstylesheet_override: "--xsl-file-override",
|
|
18
|
-
|
|
18
|
+
pdfportfolio: "--pdf-portfolio",
|
|
19
|
+
pdfencryptmetadata: "--encrypt-metadata",
|
|
20
|
+
pdfkeystore: "--keystore",
|
|
21
|
+
pdfkeystorepassword: "--keystore-password",
|
|
22
|
+
}.freeze
|
|
19
23
|
MN2PDF_DEFAULT_ARGS = { "--syntax-highlight": nil }.freeze
|
|
20
24
|
|
|
21
25
|
def initialize(options)
|
|
@@ -83,6 +83,7 @@ no_identifier: (لا يوجد معرف)
|
|
|
83
83
|
and: و
|
|
84
84
|
all_parts: كل الأجزاء
|
|
85
85
|
edition_ordinal: "ﺎﻠﻄﺒﻋﺓ {{ var1 | ordinal_word: 'edition', '' }}"
|
|
86
|
+
edition_cardinal: "ﺎﻠﻄﺒﻋﺓ {{ var1' }}"
|
|
86
87
|
edition: الطبعة
|
|
87
88
|
version: الإصدار
|
|
88
89
|
toc_figures: جدول الأرقام
|
|
@@ -108,6 +109,14 @@ admonition:
|
|
|
108
109
|
important: مهم
|
|
109
110
|
safety precautions: احتياطات السلامة
|
|
110
111
|
editorial: ملاحظة تحريرية
|
|
112
|
+
title_prefixes:
|
|
113
|
+
part: الجملة
|
|
114
|
+
amendment: مسودة التعديل
|
|
115
|
+
corrigendum: التصحيح
|
|
116
|
+
addendum: الملحق
|
|
117
|
+
supplement: ملحق
|
|
118
|
+
annex: ملحق
|
|
119
|
+
appendix: ملحق
|
|
111
120
|
locality:
|
|
112
121
|
section: قسم
|
|
113
122
|
clause: فقرة
|
|
@@ -95,6 +95,7 @@ and: und
|
|
|
95
95
|
no_identifier: (KEIN KENNUNG)
|
|
96
96
|
all_parts: Alle Teile
|
|
97
97
|
edition_ordinal: "{{ var1 | ordinal_word: 'edition', '' }} Auflage"
|
|
98
|
+
edition_cardinal: "Auflage {{ var1 }}"
|
|
98
99
|
edition: Auflage
|
|
99
100
|
version: Version
|
|
100
101
|
toc_figures: Abbildungsverzeichnis
|
|
@@ -121,6 +122,14 @@ admonition: {
|
|
|
121
122
|
safety precautions: Sicherheitsvorkehrungen,
|
|
122
123
|
editorial: Redaktioneller Hinweis
|
|
123
124
|
}
|
|
125
|
+
title_prefixes:
|
|
126
|
+
part: Satz
|
|
127
|
+
amendment: Änderungsentwurf
|
|
128
|
+
corrigendum: Berichtigung
|
|
129
|
+
addendum: Nachtrag
|
|
130
|
+
supplement: Ergänzung
|
|
131
|
+
annex: Anhang
|
|
132
|
+
appendix: Anhang
|
|
124
133
|
locality: {
|
|
125
134
|
section: Abschnitt,
|
|
126
135
|
clause: Klausel,
|
|
@@ -95,6 +95,7 @@ source: SOURCE
|
|
|
95
95
|
and: and
|
|
96
96
|
all_parts: All Parts
|
|
97
97
|
edition_ordinal: "{{ var1 | ordinal_word: '', '' }} edition"
|
|
98
|
+
edition_cardinal: "edition {{ var1 }}"
|
|
98
99
|
edition: edition
|
|
99
100
|
version: version
|
|
100
101
|
toc_figures: List of figures
|
|
@@ -121,6 +122,14 @@ admonition: {
|
|
|
121
122
|
safety precautions: Safety Precautions,
|
|
122
123
|
editorial: Editorial Note
|
|
123
124
|
}
|
|
125
|
+
title_prefixes:
|
|
126
|
+
part: Part
|
|
127
|
+
amendment: Amendment
|
|
128
|
+
corrigendum: Corrigendum
|
|
129
|
+
addendum: Addendum
|
|
130
|
+
supplement: Supplement
|
|
131
|
+
annex: Annex
|
|
132
|
+
appendix: Appendix
|
|
124
133
|
locality: {
|
|
125
134
|
section: Section,
|
|
126
135
|
clause: Clause,
|
|
@@ -93,6 +93,7 @@ and: y
|
|
|
93
93
|
no_identifier: (SIN IDENTIFICADOR)
|
|
94
94
|
all_parts: Todas las partes
|
|
95
95
|
edition_ordinal: "{{ var1 | ordinal_word: 'edition', '' }} edición"
|
|
96
|
+
edition_cardinal: "edición {{ var1 }}"
|
|
96
97
|
edition: edición
|
|
97
98
|
version: versión
|
|
98
99
|
toc_figures: Table de figuras
|
|
@@ -119,6 +120,14 @@ admonition: {
|
|
|
119
120
|
safety precautions: Precauciones de seguridad,
|
|
120
121
|
editorial: Note editorial
|
|
121
122
|
}
|
|
123
|
+
title_prefixes:
|
|
124
|
+
part: Parte
|
|
125
|
+
amendment: Nnmienda
|
|
126
|
+
corrigendum: Corrección
|
|
127
|
+
addendum: Apéndice
|
|
128
|
+
supplement: Suplemento
|
|
129
|
+
annex: Anexo
|
|
130
|
+
appendix: Apéndice
|
|
122
131
|
locality: {
|
|
123
132
|
section: Sección,
|
|
124
133
|
clause: Cláusula,
|
|
@@ -92,6 +92,7 @@ and: et
|
|
|
92
92
|
no_identifier: (PAS D'IDENTIFIANT)
|
|
93
93
|
all_parts: toutes les parties
|
|
94
94
|
edition_ordinal: "{{ var1 | ordinal_word: 'edition', '' }} édition"
|
|
95
|
+
edition_cardinal: "édition {{ var1 }}"
|
|
95
96
|
edition: édition
|
|
96
97
|
toc_figures: Table des figures
|
|
97
98
|
toc_tables: Table des tableaux
|
|
@@ -117,6 +118,14 @@ admonition: {
|
|
|
117
118
|
safety precautions: Précautions de Sécurité,
|
|
118
119
|
editorial: Note éditoriale
|
|
119
120
|
}
|
|
121
|
+
title_prefixes:
|
|
122
|
+
part: Partie
|
|
123
|
+
amendment: Amendement
|
|
124
|
+
corrigendum: Rectificatif
|
|
125
|
+
addendum: Additif
|
|
126
|
+
supplement: Supplément
|
|
127
|
+
annex: Annexe
|
|
128
|
+
appendix: Appendice
|
|
120
129
|
locality: {
|
|
121
130
|
section: Section,
|
|
122
131
|
clause: Article,
|
|
@@ -95,6 +95,7 @@ and: and
|
|
|
95
95
|
no_identifier: (識別子なし)
|
|
96
96
|
all_parts: 規格群
|
|
97
97
|
edition_ordinal: "第{{ var1 }}版"
|
|
98
|
+
edition_cardinal: "第{{ var1 }}版"
|
|
98
99
|
edition: 版
|
|
99
100
|
version: 版
|
|
100
101
|
toc_figures: List of figures
|
|
@@ -121,6 +122,14 @@ admonition: {
|
|
|
121
122
|
safety precautions: 安全上の注意,
|
|
122
123
|
editorial: 編集者注
|
|
123
124
|
}
|
|
125
|
+
title_prefixes:
|
|
126
|
+
part: その
|
|
127
|
+
amendment: Amendment
|
|
128
|
+
corrigendum: Corrigendum
|
|
129
|
+
addendum: Addendum
|
|
130
|
+
supplement: Supplement
|
|
131
|
+
annex: Annex
|
|
132
|
+
appendix: Appendix
|
|
124
133
|
locality: {
|
|
125
134
|
section: セクション,
|
|
126
135
|
clause: 箇条,
|
|
@@ -157,6 +157,7 @@ and: и
|
|
|
157
157
|
no_identifier: (БЕЗ ИДЕНТИФИКАТОРА)
|
|
158
158
|
all_parts: Все части
|
|
159
159
|
edition_ordinal: "{{ var1 | ordinal_word: 'edition', '' }} издание"
|
|
160
|
+
edition_cardinal: "издание {{ var1 }}"
|
|
160
161
|
edition: издание
|
|
161
162
|
version: версия
|
|
162
163
|
toc_figures: Таблица фигур
|
|
@@ -183,6 +184,14 @@ admonition: {
|
|
|
183
184
|
safety precautions: Меры безопасности,
|
|
184
185
|
editorial: Редакционная Заметка
|
|
185
186
|
}
|
|
187
|
+
title_prefixes:
|
|
188
|
+
part: Часть
|
|
189
|
+
amendment: Поправка
|
|
190
|
+
corrigendum: Исправление
|
|
191
|
+
addendum: Дополнение
|
|
192
|
+
supplement: Дополнение
|
|
193
|
+
annex: Приложение
|
|
194
|
+
appendix: Приложение
|
|
186
195
|
locality: {
|
|
187
196
|
section: Раздел,
|
|
188
197
|
clause: Пункт,
|
|
@@ -84,6 +84,7 @@ and: 和
|
|
|
84
84
|
no_identifier: (无标识符)
|
|
85
85
|
all_parts: 所有部分
|
|
86
86
|
edition_ordinal: "第{{ var1 | ordinal_word: '', '' }}版"
|
|
87
|
+
edition_cardinal: "第{{ var1 }}版"
|
|
87
88
|
edition: 版
|
|
88
89
|
version: 版本
|
|
89
90
|
toc_figures: 数字列表
|
|
@@ -110,6 +111,14 @@ admonition: {
|
|
|
110
111
|
safety precautions: 安全须知,
|
|
111
112
|
editorial: 编辑说明
|
|
112
113
|
}
|
|
114
|
+
title_prefixes:
|
|
115
|
+
part: 部分
|
|
116
|
+
amendment: 修正
|
|
117
|
+
corrigendum: 更正
|
|
118
|
+
addendum: 附录
|
|
119
|
+
supplement: 补充文件
|
|
120
|
+
annex: 附件
|
|
121
|
+
appendix: 附录
|
|
113
122
|
locality: {
|
|
114
123
|
section: 条,
|
|
115
124
|
clause: 条,
|