isodoc 1.0.2 → 1.0.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/Gemfile.lock +5 -5
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/function/i18n.rb +1 -0
- data/lib/isodoc/function/table.rb +10 -0
- data/lib/isodoc/function/xref_counter.rb +42 -0
- data/lib/isodoc/function/xref_gen.rb +88 -159
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +1 -1
- data/spec/isodoc/table_spec.rb +6 -3
- data/spec/isodoc/xref_spec.rb +94 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d07c6881a991def663f5734c7db5def02b9c0d850571f34200ea9df32868ca
|
4
|
+
data.tar.gz: 5c0f1b18f7cdca0d7673613540d62b92c4a6a426916f3199ebc9dbca75a4144e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7282cbd6ea762709618aa7c690eaa52e88235f5acf208ccd11cbb2495456d706aec612c00b2b0989e5f4f10b0e8bea0eef5e2aa8ad70f325449d673b584c9f64
|
7
|
+
data.tar.gz: 9e7ee5294eb3c0214e2b73709ce1dbbf3fafc2cb6d4fcb4cbc518cdb56bb999d58011dfe5357fe3ff45a39eb846905edf4f3b26cd99b74102f8bff285f166632
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
isodoc (1.0.
|
4
|
+
isodoc (1.0.3)
|
5
5
|
asciimath
|
6
6
|
html2doc (~> 0.8.11)
|
7
7
|
htmlentities (~> 4.3.4)
|
@@ -42,12 +42,12 @@ GEM
|
|
42
42
|
guard (~> 2.1)
|
43
43
|
guard-compat (~> 1.1)
|
44
44
|
rspec (>= 2.99.0, < 4.0)
|
45
|
-
html2doc (0.8.
|
45
|
+
html2doc (0.8.13)
|
46
46
|
asciimath (~> 1.0.7)
|
47
47
|
htmlentities (~> 4.3.4)
|
48
48
|
image_size
|
49
49
|
mime-types
|
50
|
-
nokogiri
|
50
|
+
nokogiri (>= 1.10.4)
|
51
51
|
thread_safe
|
52
52
|
uuidtools
|
53
53
|
htmlentities (4.3.4)
|
@@ -108,10 +108,10 @@ GEM
|
|
108
108
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
109
109
|
ruby-progressbar (1.10.1)
|
110
110
|
ruby_dep (1.5.0)
|
111
|
-
sassc (2.2.
|
111
|
+
sassc (2.2.1)
|
112
112
|
ffi (~> 1.9)
|
113
113
|
shellany (0.0.1)
|
114
|
-
simplecov (0.17.
|
114
|
+
simplecov (0.17.1)
|
115
115
|
docile (~> 1.1)
|
116
116
|
json (>= 1.8, < 3)
|
117
117
|
simplecov-html (~> 0.10.0)
|
data/lib/isodoc/function/i18n.rb
CHANGED
@@ -51,10 +51,20 @@ module IsoDoc::Function
|
|
51
51
|
)
|
52
52
|
end
|
53
53
|
|
54
|
+
def tcaption(node, t)
|
55
|
+
return unless node["summary"]
|
56
|
+
t.caption do |c|
|
57
|
+
c.span **{ style: "display:none" } do |s|
|
58
|
+
s << node["summary"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
54
63
|
def table_parse(node, out)
|
55
64
|
@in_table = true
|
56
65
|
table_title_parse(node, out)
|
57
66
|
out.table **make_table_attr(node) do |t|
|
67
|
+
tcaption(node, t)
|
58
68
|
thead_parse(node, t)
|
59
69
|
tbody_parse(node, t)
|
60
70
|
tfoot_parse(node, t)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "roman-numerals"
|
2
|
+
|
3
|
+
module IsoDoc::Function
|
4
|
+
module XrefGen
|
5
|
+
class Counter
|
6
|
+
def initialize
|
7
|
+
@num = 0
|
8
|
+
@letter = ""
|
9
|
+
@subseq = ""
|
10
|
+
end
|
11
|
+
|
12
|
+
def increment(node)
|
13
|
+
return self if node["unnumbered"]
|
14
|
+
if node["subsequence"] != @subseq
|
15
|
+
@subseq = node["subsequence"]
|
16
|
+
@num += 1
|
17
|
+
@letter = node["subsequence"] ? "a" : ""
|
18
|
+
else
|
19
|
+
if @letter.empty?
|
20
|
+
@num += 1
|
21
|
+
else
|
22
|
+
@letter = (@letter.ord + 1).chr.to_s
|
23
|
+
end
|
24
|
+
end
|
25
|
+
self
|
26
|
+
end
|
27
|
+
|
28
|
+
def print
|
29
|
+
"#{@num}#{@letter}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def listlabel(depth)
|
33
|
+
return @num.to_s if [2, 7].include? depth
|
34
|
+
return (96 + @num).chr.to_s if [1, 6].include? depth
|
35
|
+
return (64 + @num).chr.to_s if [4, 9].include? depth
|
36
|
+
return RomanNumerals.to_roman(@num).downcase if [3, 8].include? depth
|
37
|
+
return RomanNumerals.to_roman(@num).upcase if [5, 10].include? depth
|
38
|
+
return @num.to_s
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "roman-numerals"
|
2
|
+
require_relative "xref_counter"
|
2
3
|
|
3
4
|
module IsoDoc::Function
|
4
5
|
module XrefGen
|
@@ -12,7 +13,7 @@ module IsoDoc::Function
|
|
12
13
|
def anchor(id, lbl, warning = true)
|
13
14
|
unless @anchors[id]
|
14
15
|
warning and warn "No label has been processed for ID #{id}"
|
15
|
-
return
|
16
|
+
return "[#{id}]"
|
16
17
|
end
|
17
18
|
@anchors.dig(id, lbl)
|
18
19
|
end
|
@@ -23,13 +24,15 @@ module IsoDoc::Function
|
|
23
24
|
|
24
25
|
def termnote_anchor_names(docxml)
|
25
26
|
docxml.xpath(ns("//term[descendant::termnote]")).each do |t|
|
26
|
-
|
27
|
+
c = Counter.new
|
28
|
+
t.xpath(ns(".//termnote")).each do |n|
|
27
29
|
return if n["id"].nil? || n["id"].empty?
|
30
|
+
c.increment(n)
|
28
31
|
@anchors[n["id"]] =
|
29
|
-
{ label: termnote_label(
|
32
|
+
{ label: termnote_label(c.print),
|
30
33
|
type: "termnote",
|
31
34
|
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
32
|
-
"#{@note_xref_lbl} #{
|
35
|
+
"#{@note_xref_lbl} #{c.print}") }
|
33
36
|
end
|
34
37
|
end
|
35
38
|
end
|
@@ -37,13 +40,15 @@ module IsoDoc::Function
|
|
37
40
|
def termexample_anchor_names(docxml)
|
38
41
|
docxml.xpath(ns("//term[descendant::termexample]")).each do |t|
|
39
42
|
examples = t.xpath(ns(".//termexample"))
|
40
|
-
|
43
|
+
c = Counter.new
|
44
|
+
examples.each do |n|
|
41
45
|
return if n["id"].nil? || n["id"].empty?
|
42
|
-
|
46
|
+
c.increment(n)
|
47
|
+
idx = examples.size == 1 ? "" : c.print
|
43
48
|
@anchors[n["id"]] = {
|
44
49
|
type: "termexample",
|
45
50
|
label: idx, xref: l10n("#{anchor(t['id'], :xref)}, "\
|
46
|
-
"#{@
|
51
|
+
"#{@example_xref_lbl} #{c.print}") }
|
47
52
|
end
|
48
53
|
end
|
49
54
|
end
|
@@ -61,11 +66,12 @@ module IsoDoc::Function
|
|
61
66
|
def note_anchor_names(sections)
|
62
67
|
sections.each do |s|
|
63
68
|
notes = s.xpath(CHILD_NOTES_XPATH)
|
64
|
-
|
65
|
-
|
66
|
-
next if n["id"].nil? || n["id"].empty?
|
67
|
-
idx = notes.size == 1 ? "" : " #{
|
68
|
-
@anchors[n["id"]] = anchor_struct(idx, n, @note_xref_lbl,
|
69
|
+
c = Counter.new
|
70
|
+
notes.each do |n|
|
71
|
+
next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
|
72
|
+
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
73
|
+
@anchors[n["id"]] = anchor_struct(idx, n, @note_xref_lbl,
|
74
|
+
"note", false)
|
69
75
|
end
|
70
76
|
note_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
71
77
|
end
|
@@ -81,14 +87,13 @@ module IsoDoc::Function
|
|
81
87
|
def example_anchor_names(sections)
|
82
88
|
sections.each do |s|
|
83
89
|
notes = s.xpath(CHILD_EXAMPLES_XPATH)
|
84
|
-
|
90
|
+
c = Counter.new
|
85
91
|
notes.each do |n|
|
86
92
|
next if @anchors[n["id"]]
|
87
93
|
next if n["id"].nil? || n["id"].empty?
|
88
|
-
idx = notes.size == 1 ? "" : " #{
|
94
|
+
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
89
95
|
@anchors[n["id"]] = anchor_struct(idx, n, @example_xref_lbl,
|
90
96
|
"example", n["unnumbered"])
|
91
|
-
i += 1 unless n["unnumbered"]
|
92
97
|
end
|
93
98
|
example_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
|
94
99
|
end
|
@@ -98,9 +103,10 @@ module IsoDoc::Function
|
|
98
103
|
sections.each do |s|
|
99
104
|
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
100
105
|
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
101
|
-
|
106
|
+
c = Counter.new
|
107
|
+
notes.each do |n|
|
102
108
|
next if n["id"].nil? || n["id"].empty?
|
103
|
-
idx = notes.size == 1 ? "" : " #{
|
109
|
+
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
104
110
|
@anchors[n["id"]] = anchor_struct(idx, n, @list_lbl, "list", false)
|
105
111
|
list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
|
106
112
|
end
|
@@ -108,21 +114,13 @@ module IsoDoc::Function
|
|
108
114
|
end
|
109
115
|
end
|
110
116
|
|
111
|
-
def listlabel(depth, i)
|
112
|
-
return i.to_s if [2, 7].include? depth
|
113
|
-
return (96 + i).chr.to_s if [1, 6].include? depth
|
114
|
-
return (64 + i).chr.to_s if [4, 9].include? depth
|
115
|
-
return RomanNumerals.to_roman(i).downcase if [3, 8].include? depth
|
116
|
-
return RomanNumerals.to_roman(i).upcase if [5, 10].include? depth
|
117
|
-
return i.to_s
|
118
|
-
end
|
119
|
-
|
120
117
|
def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
|
121
|
-
|
122
|
-
|
118
|
+
c = Counter.new
|
119
|
+
list.xpath(ns("./li")).each do |li|
|
120
|
+
label = c.increment(li).listlabel(depth)
|
123
121
|
label = "#{prev_label}.#{label}" unless prev_label.empty?
|
124
122
|
label = "#{list_anchor[:xref]} #{label}" if refer_list
|
125
|
-
li["id"]
|
123
|
+
li["id"] and @anchors[li["id"]] = { xref: "#{label})",
|
126
124
|
type: "listitem",
|
127
125
|
container: list_anchor[:container] }
|
128
126
|
li.xpath(ns("./ol")).each do |ol|
|
@@ -144,16 +142,18 @@ module IsoDoc::Function
|
|
144
142
|
end
|
145
143
|
|
146
144
|
def sequential_figure_names(clause)
|
147
|
-
|
145
|
+
c = Counter.new
|
146
|
+
j = 0
|
148
147
|
clause.xpath(ns(".//figure")).each do |t|
|
149
148
|
if t.parent.name == "figure" then j += 1
|
150
149
|
else
|
151
150
|
j = 0
|
152
|
-
|
151
|
+
c.increment(t)
|
153
152
|
end
|
154
|
-
label =
|
153
|
+
label = c.print + (j.zero? ? "" : "-#{j}")
|
155
154
|
next if t["id"].nil? || t["id"].empty?
|
156
|
-
@anchors[t["id"]] =
|
155
|
+
@anchors[t["id"]] =
|
156
|
+
anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
@@ -168,6 +168,7 @@ module IsoDoc::Function
|
|
168
168
|
def anchor_struct_xref(lbl, elem)
|
169
169
|
case elem
|
170
170
|
when @formula_lbl then l10n("#{elem} (#{lbl})")
|
171
|
+
when @inequality_lbl then l10n("#{elem} (#{lbl})")
|
171
172
|
else
|
172
173
|
l10n("#{elem} #{lbl}")
|
173
174
|
end
|
@@ -184,97 +185,48 @@ module IsoDoc::Function
|
|
184
185
|
end
|
185
186
|
|
186
187
|
def sequential_table_names(clause)
|
187
|
-
|
188
|
+
c = Counter.new
|
188
189
|
clause.xpath(ns(".//table")).each do |t|
|
189
190
|
next if t["id"].nil? || t["id"].empty?
|
190
|
-
@anchors[t["id"]] = anchor_struct(
|
191
|
-
|
191
|
+
@anchors[t["id"]] = anchor_struct(c.increment(t).print, nil,
|
192
|
+
@table_lbl, "table", t["unnumbered"])
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
195
196
|
def sequential_formula_names(clause)
|
196
|
-
|
197
|
+
c = Counter.new
|
197
198
|
clause.xpath(ns(".//formula")).each do |t|
|
198
199
|
next if t["id"].nil? || t["id"].empty?
|
199
|
-
@anchors[t["id"]] =
|
200
|
-
|
200
|
+
@anchors[t["id"]] =
|
201
|
+
anchor_struct(c.increment(t).print, t,
|
202
|
+
t["inequality"] ? @inequality_lbl : @formula_lbl,
|
203
|
+
"formula", t["unnumbered"])
|
201
204
|
end
|
202
205
|
end
|
203
206
|
|
204
207
|
FIRST_LVL_REQ = "[not(ancestor::permission or ancestor::requirement or ancestor::recommendation)]".freeze
|
205
208
|
|
206
|
-
def sequential_permission_names(clause)
|
207
|
-
|
208
|
-
clause.xpath(ns("
|
209
|
-
next if t["id"].nil? || t["id"].empty?
|
210
|
-
@anchors[t["id"]] = anchor_struct(i + 1, t, @permission_lbl, "permission", t["unnumbered"])
|
211
|
-
sequential_permission_names1(t, i + 1)
|
212
|
-
sequential_requirement_names1(t, i + 1)
|
213
|
-
sequential_recommendation_names1(t, i + 1)
|
214
|
-
i += 1 unless t["unnumbered"]
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
def sequential_permission_names1(block, lbl)
|
219
|
-
i = 0
|
220
|
-
block.xpath(ns("./permission")).each do |t|
|
221
|
-
next if t["id"].nil? || t["id"].empty?
|
222
|
-
newlbl = "#{lbl}#{hierfigsep}#{i + 1}"
|
223
|
-
@anchors[t["id"]] = anchor_struct(newlbl, t, @permission_lbl, "permission", t["unnumbered"])
|
224
|
-
sequential_permission_names1(t, newlbl)
|
225
|
-
sequential_requirement_names1(t, newlbl)
|
226
|
-
sequential_recommendation_names1(t, newlbl)
|
227
|
-
i += 1 unless t["unnumbered"]
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
def sequential_requirement_names(clause)
|
232
|
-
i = 0
|
233
|
-
clause.xpath(ns(".//requirement#{FIRST_LVL_REQ}")).each do |t|
|
234
|
-
next if t["id"].nil? || t["id"].empty?
|
235
|
-
@anchors[t["id"]] = anchor_struct(i + 1, t, @requirement_lbl, "requirement", t["unnumbered"])
|
236
|
-
sequential_permission_names1(t, i + 1)
|
237
|
-
sequential_requirement_names1(t, i + 1)
|
238
|
-
sequential_recommendation_names1(t, i + 1)
|
239
|
-
i += 1 unless t["unnumbered"]
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
|
-
def sequential_requirement_names1(block, lbl)
|
244
|
-
i = 0
|
245
|
-
block.xpath(ns("./requirement")).each do |t|
|
246
|
-
next if t["id"].nil? || t["id"].empty?
|
247
|
-
newlbl = "#{lbl}#{hierfigsep}#{i + 1}"
|
248
|
-
@anchors[t["id"]] = anchor_struct(newlbl, t, @requirement_lbl, "requirement", t["unnumbered"])
|
249
|
-
sequential_permission_names1(t, newlbl)
|
250
|
-
sequential_requirement_names1(t, newlbl)
|
251
|
-
sequential_recommendation_names1(t, newlbl)
|
252
|
-
i += 1 unless t["unnumbered"]
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
def sequential_recommendation_names(clause)
|
257
|
-
i = 0
|
258
|
-
clause.xpath(ns(".//recommendation#{FIRST_LVL_REQ}")).each do |t|
|
209
|
+
def sequential_permission_names(clause, klass, label)
|
210
|
+
c = Counter.new
|
211
|
+
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
259
212
|
next if t["id"].nil? || t["id"].empty?
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
213
|
+
id = c.increment(t).print
|
214
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
215
|
+
sequential_permission_names1(t, id, "permission", @permission_lbl)
|
216
|
+
sequential_permission_names1(t, id, "requirement", @requirement_lbl)
|
217
|
+
sequential_permission_names1(t, id, "recommendation", @recommendation_lbl)
|
265
218
|
end
|
266
219
|
end
|
267
220
|
|
268
|
-
def
|
269
|
-
|
270
|
-
block.xpath(ns("
|
221
|
+
def sequential_permission_names1(block, lbl, klass, label)
|
222
|
+
c = Counter.new
|
223
|
+
block.xpath(ns("./#{klass}")).each do |t|
|
271
224
|
next if t["id"].nil? || t["id"].empty?
|
272
|
-
|
273
|
-
@anchors[t["id"]] = anchor_struct(
|
274
|
-
sequential_permission_names1(t,
|
275
|
-
|
276
|
-
|
277
|
-
i += 1 unless t["unnumbered"]
|
225
|
+
id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
|
226
|
+
@anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
|
227
|
+
sequential_permission_names1(t, id, "permission", @permission_lbl)
|
228
|
+
sequential_permission_names1(t, id, "requirement", @requirement_lbl)
|
229
|
+
sequential_permission_names1(t, id, "recommendation", @recommendation_lbl)
|
278
230
|
end
|
279
231
|
end
|
280
232
|
|
@@ -282,9 +234,9 @@ module IsoDoc::Function
|
|
282
234
|
sequential_table_names(clause)
|
283
235
|
sequential_figure_names(clause)
|
284
236
|
sequential_formula_names(clause)
|
285
|
-
sequential_permission_names(clause)
|
286
|
-
|
287
|
-
|
237
|
+
sequential_permission_names(clause, "permission", @permission_lbl)
|
238
|
+
sequential_permission_names(clause, "requirement", @requirement_lbl)
|
239
|
+
sequential_permission_names(clause, "recommendation", @recommendation_lbl)
|
288
240
|
end
|
289
241
|
|
290
242
|
def hiersep
|
@@ -296,26 +248,29 @@ module IsoDoc::Function
|
|
296
248
|
end
|
297
249
|
|
298
250
|
def hierarchical_figure_names(clause, num)
|
299
|
-
|
251
|
+
c = Counter.new
|
252
|
+
j = 0
|
300
253
|
clause.xpath(ns(".//figure")).each do |t|
|
301
254
|
if t.parent.name == "figure" then j += 1
|
302
255
|
else
|
303
256
|
j = 0
|
304
|
-
|
257
|
+
c.increment(t)
|
305
258
|
end
|
306
|
-
label = "#{num}#{hiersep}#{
|
259
|
+
label = "#{num}#{hiersep}#{c.print}" +
|
260
|
+
(j.zero? ? "" : "#{hierfigsep}#{j}")
|
307
261
|
next if t["id"].nil? || t["id"].empty?
|
308
|
-
@anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure",
|
262
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure",
|
263
|
+
t["unnumbered"])
|
309
264
|
end
|
310
265
|
end
|
311
266
|
|
312
267
|
def hierarchical_table_names(clause, num)
|
313
|
-
|
268
|
+
c = Counter.new
|
314
269
|
clause.xpath(ns(".//table")).each do |t|
|
315
270
|
next if t["id"].nil? || t["id"].empty?
|
316
|
-
@anchors[t["id"]] =
|
317
|
-
|
318
|
-
|
271
|
+
@anchors[t["id"]] =
|
272
|
+
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
|
273
|
+
nil, @table_lbl, "table", t["unnumbered"])
|
319
274
|
end
|
320
275
|
end
|
321
276
|
|
@@ -323,57 +278,31 @@ module IsoDoc::Function
|
|
323
278
|
hierarchical_table_names(clause, num)
|
324
279
|
hierarchical_figure_names(clause, num)
|
325
280
|
hierarchical_formula_names(clause, num)
|
326
|
-
hierarchical_permission_names(clause, num)
|
327
|
-
|
328
|
-
|
281
|
+
hierarchical_permission_names(clause, num, "permission", @permission_lbl)
|
282
|
+
hierarchical_permission_names(clause, num, "requirement", @requirement_lbl)
|
283
|
+
hierarchical_permission_names(clause, num, "recommendation", @recommendation_lbl)
|
329
284
|
end
|
330
285
|
|
331
286
|
def hierarchical_formula_names(clause, num)
|
332
|
-
|
287
|
+
c = Counter.new
|
333
288
|
clause.xpath(ns(".//formula")).each do |t|
|
334
289
|
next if t["id"].nil? || t["id"].empty?
|
335
|
-
@anchors[t["id"]] =
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
end
|
340
|
-
|
341
|
-
def hierarchical_permission_names(clause, num)
|
342
|
-
i = 0
|
343
|
-
clause.xpath(ns(".//permission#{FIRST_LVL_REQ}")).each do |t|
|
344
|
-
next if t["id"].nil? || t["id"].empty?
|
345
|
-
lbl = "#{num}#{hiersep}#{i + 1}"
|
346
|
-
@anchors[t["id"]] = anchor_struct(lbl, t, @permission_lbl, "permission", t["unnumbered"])
|
347
|
-
sequential_permission_names1(t, lbl)
|
348
|
-
sequential_requirement_names1(t, lbl)
|
349
|
-
sequential_recommendation_names1(t, lbl)
|
350
|
-
i += 1 unless t["unnumbered"]
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
def hierarchical_requirement_names(clause, num)
|
355
|
-
i = 0
|
356
|
-
clause.xpath(ns(".//requirement#{FIRST_LVL_REQ}")).each do |t|
|
357
|
-
next if t["id"].nil? || t["id"].empty?
|
358
|
-
lbl = "#{num}#{hiersep}#{i + 1}"
|
359
|
-
@anchors[t["id"]] = anchor_struct(lbl, t, @requirement_lbl, "requirement", t["unnumbered"])
|
360
|
-
sequential_permission_names1(t, lbl)
|
361
|
-
sequential_requirement_names1(t, lbl)
|
362
|
-
sequential_recommendation_names1(t, lbl)
|
363
|
-
i += 1 unless t["unnumbered"]
|
290
|
+
@anchors[t["id"]] =
|
291
|
+
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
|
292
|
+
t["inequality"] ? @inequality_lbl : @formula_lbl,
|
293
|
+
"formula", t["unnumbered"])
|
364
294
|
end
|
365
295
|
end
|
366
296
|
|
367
|
-
def
|
368
|
-
|
369
|
-
clause.xpath(ns("
|
297
|
+
def hierarchical_permission_names(clause, num, klass, label)
|
298
|
+
c = Counter.new
|
299
|
+
clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
|
370
300
|
next if t["id"].nil? || t["id"].empty?
|
371
|
-
lbl = "#{num}#{hiersep}#{
|
372
|
-
@anchors[t["id"]] = anchor_struct(lbl, t,
|
373
|
-
sequential_permission_names1(t, lbl)
|
374
|
-
|
375
|
-
|
376
|
-
i += 1 unless t["unnumbered"]
|
301
|
+
lbl = "#{num}#{hiersep}#{c.increment(t).print}"
|
302
|
+
@anchors[t["id"]] = anchor_struct(lbl, t, label, klass, t["unnumbered"])
|
303
|
+
sequential_permission_names1(t, lbl, "permission", @permission_lbl)
|
304
|
+
sequential_permission_names1(t, lbl, "requirement", @requirement_lbl)
|
305
|
+
sequential_permission_names1(t, lbl, "recommendation", @recommendation_lbl)
|
377
306
|
end
|
378
307
|
end
|
379
308
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -237,9 +237,9 @@ module IsoDoc::WordFunction
|
|
237
237
|
})
|
238
238
|
end
|
239
239
|
|
240
|
-
|
241
240
|
def make_table_attr(node)
|
242
241
|
super.merge({
|
242
|
+
summary: node["summary"],
|
243
243
|
style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
|
244
244
|
"mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;"\
|
245
245
|
"mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;"\
|
data/spec/isodoc/table_spec.rb
CHANGED
@@ -6,7 +6,7 @@ RSpec.describe IsoDoc do
|
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword>
|
9
|
-
<table id="tableD-1" alt="tool tip">
|
9
|
+
<table id="tableD-1" alt="tool tip" summary="long desc">
|
10
10
|
<name>Repeatability and reproducibility of <em>husked</em> rice yield</name>
|
11
11
|
<thead>
|
12
12
|
<tr>
|
@@ -69,6 +69,9 @@ RSpec.describe IsoDoc do
|
|
69
69
|
<h1 class="ForewordTitle">Foreword</h1>
|
70
70
|
<p class="TableTitle" style="text-align:center;">Table 1 — Repeatability and reproducibility of <i>husked</i> rice yield</p>
|
71
71
|
<table id="tableD-1" class="MsoISOTable" style="border-width:1px;border-spacing:0;" title="tool tip">
|
72
|
+
<caption>
|
73
|
+
<span style="display:none">long desc</span>
|
74
|
+
</caption>
|
72
75
|
<thead>
|
73
76
|
<tr>
|
74
77
|
<td rowspan="2" style="text-align:left;border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;padding:0;" scope="col">Description</td>
|
@@ -139,7 +142,7 @@ RSpec.describe IsoDoc do
|
|
139
142
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
140
143
|
<preface>
|
141
144
|
<foreword>
|
142
|
-
<table id="tableD-1" alt="tool tip">
|
145
|
+
<table id="tableD-1" alt="tool tip" summary="long desc">
|
143
146
|
<name>Repeatability and reproducibility of husked rice yield</name>
|
144
147
|
<thead>
|
145
148
|
<tr>
|
@@ -205,7 +208,7 @@ RSpec.describe IsoDoc do
|
|
205
208
|
<h1 class="ForewordTitle">Foreword</h1>
|
206
209
|
<p class="TableTitle" style="text-align:center;">Table 1 — Repeatability and reproducibility of husked rice yield</p>
|
207
210
|
<div align="center">
|
208
|
-
<table id="tableD-1" class="MsoISOTable" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;" title="tool tip">
|
211
|
+
<table id="tableD-1" class="MsoISOTable" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;" title="tool tip" summary="long desc">
|
209
212
|
<thead>
|
210
213
|
<tr>
|
211
214
|
<td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Description</td>
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -1988,4 +1988,98 @@ OUTPUT
|
|
1988
1988
|
OUTPUT
|
1989
1989
|
end
|
1990
1990
|
|
1991
|
+
it "realises subsequences" do
|
1992
|
+
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
1993
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1994
|
+
<preface>
|
1995
|
+
<foreword id="fwd">
|
1996
|
+
<p>
|
1997
|
+
<xref target="N1"/>
|
1998
|
+
<xref target="N2"/>
|
1999
|
+
<xref target="N3"/>
|
2000
|
+
<xref target="N4"/>
|
2001
|
+
<xref target="N5"/>
|
2002
|
+
<xref target="N6"/>
|
2003
|
+
<xref target="N7"/>
|
2004
|
+
<xref target="N8"/>
|
2005
|
+
</p>
|
2006
|
+
</foreword>
|
2007
|
+
<introduction id="intro">
|
2008
|
+
<figure id="N1"> <name>Split-it-right sample divider</name>
|
2009
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2010
|
+
</figure>
|
2011
|
+
<figure id="N2" subsequence="A"> <name>Split-it-right sample divider</name>
|
2012
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2013
|
+
</figure>
|
2014
|
+
<figure id="N3" subsequence="A"> <name>Split-it-right sample divider</name>
|
2015
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2016
|
+
</figure>
|
2017
|
+
<figure id="N4" subsequence="B"> <name>Split-it-right sample divider</name>
|
2018
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2019
|
+
</figure>
|
2020
|
+
<figure id="N5" subsequence="B"> <name>Split-it-right sample divider</name>
|
2021
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2022
|
+
</figure>
|
2023
|
+
<figure id="N6" subsequence="B"> <name>Split-it-right sample divider</name>
|
2024
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2025
|
+
</figure>
|
2026
|
+
<figure id="N7"> <name>Split-it-right sample divider</name>
|
2027
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2028
|
+
</figure>
|
2029
|
+
<figure id="N8"> <name>Split-it-right sample divider</name>
|
2030
|
+
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
|
2031
|
+
</figure>
|
2032
|
+
</introduction>
|
2033
|
+
</iso-standard>
|
2034
|
+
INPUT
|
2035
|
+
#{HTML_HDR}
|
2036
|
+
<br/>
|
2037
|
+
<div id="fwd">
|
2038
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
2039
|
+
<p>
|
2040
|
+
<a href="#N1">Figure 1</a>
|
2041
|
+
<a href="#N2">Figure 2a</a>
|
2042
|
+
<a href="#N3">Figure 2b</a>
|
2043
|
+
<a href="#N4">Figure 3a</a>
|
2044
|
+
<a href="#N5">Figure 3b</a>
|
2045
|
+
<a href="#N6">Figure 3c</a>
|
2046
|
+
<a href="#N7">Figure 4</a>
|
2047
|
+
<a href="#N8">Figure 5</a>
|
2048
|
+
</p>
|
2049
|
+
</div>
|
2050
|
+
<br/>
|
2051
|
+
<div class="Section3" id="intro">
|
2052
|
+
<h1 class="IntroTitle">Introduction</h1>
|
2053
|
+
<div id="N1" class="figure">
|
2054
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2055
|
+
<p class="FigureTitle" style="text-align:center;">Figure 1 — Split-it-right sample divider</p></div>
|
2056
|
+
<div id="N2" class="figure">
|
2057
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2058
|
+
<p class="FigureTitle" style="text-align:center;">Figure 2a — Split-it-right sample divider</p></div>
|
2059
|
+
<div id="N3" class="figure">
|
2060
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2061
|
+
<p class="FigureTitle" style="text-align:center;">Figure 2b — Split-it-right sample divider</p></div>
|
2062
|
+
<div id="N4" class="figure">
|
2063
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2064
|
+
<p class="FigureTitle" style="text-align:center;">Figure 3a — Split-it-right sample divider</p></div>
|
2065
|
+
<div id="N5" class="figure">
|
2066
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2067
|
+
<p class="FigureTitle" style="text-align:center;">Figure 3b — Split-it-right sample divider</p></div>
|
2068
|
+
<div id="N6" class="figure">
|
2069
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2070
|
+
<p class="FigureTitle" style="text-align:center;">Figure 3c — Split-it-right sample divider</p></div>
|
2071
|
+
<div id="N7" class="figure">
|
2072
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2073
|
+
<p class="FigureTitle" style="text-align:center;">Figure 4 — Split-it-right sample divider</p></div>
|
2074
|
+
<div id="N8" class="figure">
|
2075
|
+
<img src="rice_images/rice_image1.png" height="auto" width="auto"/>
|
2076
|
+
<p class="FigureTitle" style="text-align:center;">Figure 5 — Split-it-right sample divider</p></div>
|
2077
|
+
</div>
|
2078
|
+
<p class="zzSTDTitle1"/>
|
2079
|
+
</div>
|
2080
|
+
</body>
|
2081
|
+
</html>
|
2082
|
+
OUTPUT
|
2083
|
+
end
|
2084
|
+
|
1991
2085
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -336,6 +336,7 @@ files:
|
|
336
336
|
- lib/isodoc/function/terms.rb
|
337
337
|
- lib/isodoc/function/to_word_html.rb
|
338
338
|
- lib/isodoc/function/utils.rb
|
339
|
+
- lib/isodoc/function/xref_counter.rb
|
339
340
|
- lib/isodoc/function/xref_gen.rb
|
340
341
|
- lib/isodoc/function/xref_sect_gen.rb
|
341
342
|
- lib/isodoc/headlesshtml_convert.rb
|