isodoc 2.10.0 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/function/section.rb +5 -8
- data/lib/isodoc/html_function/postprocess_cover.rb +4 -2
- data/lib/isodoc/presentation_function/refs.rb +8 -3
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +6 -0
- data/lib/isodoc/word_function/postprocess_cover.rb +4 -2
- data/lib/isodoc/word_function/postprocess_toc.rb +9 -5
- data/lib/isodoc/xref/clause_order.rb +41 -0
- data/lib/isodoc/xref/xref_counter.rb +1 -1
- data/lib/isodoc/xref/xref_sect_gen.rb +13 -37
- 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: 6867b3f44bce43fcfbd4c65115b8b71b6eb38cb7b1e39c20215addc7af8ad086
|
4
|
+
data.tar.gz: f335e4aecc20758c7c9810083d7da486ec73e0db4c377b9528841b46166085de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bda93db557ef73dc1c5999bbd88d9ba06ac9977f48b93f4adca7aaac7e762d5b4fed0d62d8934151ce3ecf1becea0060d3fab65c92e2150a8a00a0c49895ee6
|
7
|
+
data.tar.gz: 1b0d780a2e450e8a22e8f6d4dcbcaa991e73bdcf1343ca3675c2e81b5f52688be7882f58762c18820fd2e99c4c37ea6043af8efc7f454ec44b553e00c3d356e3
|
@@ -152,6 +152,7 @@ module IsoDoc
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def table_of_contents(clause, out)
|
155
|
+
@bare and return
|
155
156
|
page_break(out)
|
156
157
|
out.div **attr_code(preface_attrs(clause)) do |div|
|
157
158
|
clause_name(clause, clause.at(ns("./title")), div,
|
@@ -194,32 +195,28 @@ module IsoDoc
|
|
194
195
|
end
|
195
196
|
|
196
197
|
def copyright_parse(node, out)
|
197
|
-
|
198
|
-
|
198
|
+
@bare and return
|
199
199
|
out.div class: "boilerplate-copyright" do |div|
|
200
200
|
node.children.each { |n| parse(n, div) }
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
204
204
|
def license_parse(node, out)
|
205
|
-
|
206
|
-
|
205
|
+
@bare and return
|
207
206
|
out.div class: "boilerplate-license" do |div|
|
208
207
|
node.children.each { |n| parse(n, div) }
|
209
208
|
end
|
210
209
|
end
|
211
210
|
|
212
211
|
def legal_parse(node, out)
|
213
|
-
|
214
|
-
|
212
|
+
@bare and return
|
215
213
|
out.div class: "boilerplate-legal" do |div|
|
216
214
|
node.children.each { |n| parse(n, div) }
|
217
215
|
end
|
218
216
|
end
|
219
217
|
|
220
218
|
def feedback_parse(node, out)
|
221
|
-
|
222
|
-
|
219
|
+
@bare and return
|
223
220
|
out.div class: "boilerplate-feedback" do |div|
|
224
221
|
node.children.each { |n| parse(n, div) }
|
225
222
|
end
|
@@ -40,8 +40,10 @@ module IsoDoc
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def html_preface(docxml)
|
43
|
-
|
44
|
-
|
43
|
+
@htmlcoverpage && !@htmlcoverpage.empty? && !@bare and
|
44
|
+
html_cover(docxml)
|
45
|
+
@htmlintropage && !@htmlintropage.empty? && !@bare and
|
46
|
+
html_intro(docxml)
|
45
47
|
docxml.at("//body") << mathjax(@openmathdelim, @closemathdelim)
|
46
48
|
html_main(docxml)
|
47
49
|
authority_cleanup(docxml)
|
@@ -102,9 +102,14 @@ module IsoDoc
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def bibliography_bibitem_number_insert_pt(bibitem)
|
105
|
-
unless
|
106
|
-
bibitem.
|
107
|
-
|
105
|
+
unless d = bibitem.at(ns(".//docidentifier"))
|
106
|
+
d = bibitem.children.first
|
107
|
+
d.previous = " "
|
108
|
+
return d.previous
|
109
|
+
end
|
110
|
+
unless ins = d.previous_element
|
111
|
+
d.previous = " "
|
112
|
+
ins = d.previous
|
108
113
|
end
|
109
114
|
ins
|
110
115
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -64,10 +64,16 @@ module IsoDoc
|
|
64
64
|
word_tab_clean(docxml)
|
65
65
|
authority_cleanup(docxml)
|
66
66
|
word_footnote_format(docxml)
|
67
|
+
word_remove_empty_toc(docxml)
|
67
68
|
word_remove_empty_sections(docxml)
|
68
69
|
docxml
|
69
70
|
end
|
70
71
|
|
72
|
+
def word_remove_empty_toc(docxml)
|
73
|
+
docxml.at("//div[@class = 'TOC']//p[@class = 'MsoToc1']") and return
|
74
|
+
remove_toc_div(docxml)
|
75
|
+
end
|
76
|
+
|
71
77
|
def word_sourcecode_annotations(html)
|
72
78
|
ann = ".//div[@class = 'annotation']"
|
73
79
|
html.xpath("//p[@class = '#{sourcecode_style}'][#{ann}]")
|
@@ -2,8 +2,10 @@ module IsoDoc
|
|
2
2
|
module WordFunction
|
3
3
|
module Postprocess
|
4
4
|
def word_preface(docxml)
|
5
|
-
|
6
|
-
|
5
|
+
@wordcoverpage && !@wordcoverpage.empty? and
|
6
|
+
word_cover(docxml)
|
7
|
+
@wordintropage && !@wordintropage.empty? and
|
8
|
+
word_intro(docxml, @wordToClevels)
|
7
9
|
end
|
8
10
|
|
9
11
|
def word_remove_empty_sections(docxml)
|
@@ -4,11 +4,7 @@ module IsoDoc
|
|
4
4
|
def insert_toc(intro, docxml, level)
|
5
5
|
toc = assemble_toc(docxml, level)
|
6
6
|
if intro&.include?("WORDTOC")
|
7
|
-
|
8
|
-
s&.previous_element&.elements&.first&.name == "br" and
|
9
|
-
s&.previous_element&.remove # page break
|
10
|
-
s.remove
|
11
|
-
end
|
7
|
+
remove_toc_div(docxml)
|
12
8
|
intro.sub("WORDTOC", toc)
|
13
9
|
else
|
14
10
|
source = docxml.at("//div[@class = 'TOC']") and
|
@@ -17,6 +13,14 @@ module IsoDoc
|
|
17
13
|
end
|
18
14
|
end
|
19
15
|
|
16
|
+
def remove_toc_div(docxml)
|
17
|
+
s = docxml.at("//div[@class = 'TOC']") or return
|
18
|
+
prev = s.previous_element
|
19
|
+
prev&.elements&.first&.name == "br" and
|
20
|
+
prev&.remove # page break
|
21
|
+
s.remove
|
22
|
+
end
|
23
|
+
|
20
24
|
def assemble_toc(docxml, level)
|
21
25
|
toc = ""
|
22
26
|
toc += make_WordToC(docxml, level)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module XrefGen
|
3
|
+
module Sections
|
4
|
+
def clause_order(docxml)
|
5
|
+
{ preface: clause_order_preface(docxml),
|
6
|
+
main: clause_order_main(docxml),
|
7
|
+
annex: clause_order_annex(docxml),
|
8
|
+
back: clause_order_back(docxml) }
|
9
|
+
end
|
10
|
+
|
11
|
+
def clause_order_preface(_docxml)
|
12
|
+
[{ path: "//preface/*", multi: true }]
|
13
|
+
end
|
14
|
+
|
15
|
+
def clause_order_main(docxml)
|
16
|
+
[
|
17
|
+
{ path: "//sections/clause[@type = 'scope']" },
|
18
|
+
{ path: @klass.norm_ref_xpath },
|
19
|
+
{ path: "//sections/terms | " \
|
20
|
+
"//sections/clause[descendant::terms]" },
|
21
|
+
{ path: "//sections/definitions | " \
|
22
|
+
"//sections/clause[descendant::definitions]" \
|
23
|
+
"[not(descendant::terms)]" },
|
24
|
+
{ path: @klass.middle_clause(docxml), multi: true },
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
def clause_order_annex(_docxml)
|
29
|
+
[{ path: "//annex", multi: true }]
|
30
|
+
end
|
31
|
+
|
32
|
+
def clause_order_back(_docxml)
|
33
|
+
[
|
34
|
+
{ path: @klass.bibliography_xpath },
|
35
|
+
{ path: "//indexsect", multi: true },
|
36
|
+
{ path: "//colophon/*", multi: true },
|
37
|
+
]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -139,7 +139,7 @@ module IsoDoc
|
|
139
139
|
end
|
140
140
|
|
141
141
|
def increment(node)
|
142
|
-
@unnumbered =
|
142
|
+
@unnumbered = node["unnumbered"] == "true" || node["hidden"] == "true" and return self
|
143
143
|
reset_overrides
|
144
144
|
if node["subsequence"] != @subseq &&
|
145
145
|
!(blank?(node["subsequence"]) && blank?(@subseq))
|
@@ -1,42 +1,8 @@
|
|
1
|
+
require_relative "clause_order"
|
2
|
+
|
1
3
|
module IsoDoc
|
2
4
|
module XrefGen
|
3
5
|
module Sections
|
4
|
-
def clause_order(docxml)
|
5
|
-
{ preface: clause_order_preface(docxml),
|
6
|
-
main: clause_order_main(docxml),
|
7
|
-
annex: clause_order_annex(docxml),
|
8
|
-
back: clause_order_back(docxml) }
|
9
|
-
end
|
10
|
-
|
11
|
-
def clause_order_preface(_docxml)
|
12
|
-
[{ path: "//preface/*", multi: true }]
|
13
|
-
end
|
14
|
-
|
15
|
-
def clause_order_main(docxml)
|
16
|
-
[
|
17
|
-
{ path: "//sections/clause[@type = 'scope']" },
|
18
|
-
{ path: @klass.norm_ref_xpath },
|
19
|
-
{ path: "//sections/terms | " \
|
20
|
-
"//sections/clause[descendant::terms]" },
|
21
|
-
{ path: "//sections/definitions | " \
|
22
|
-
"//sections/clause[descendant::definitions]" \
|
23
|
-
"[not(descendant::terms)]" },
|
24
|
-
{ path: @klass.middle_clause(docxml), multi: true },
|
25
|
-
]
|
26
|
-
end
|
27
|
-
|
28
|
-
def clause_order_annex(_docxml)
|
29
|
-
[{ path: "//annex", multi: true }]
|
30
|
-
end
|
31
|
-
|
32
|
-
def clause_order_back(_docxml)
|
33
|
-
[
|
34
|
-
{ path: @klass.bibliography_xpath },
|
35
|
-
{ path: "//indexsect", multi: true },
|
36
|
-
{ path: "//colophon/*", multi: true },
|
37
|
-
]
|
38
|
-
end
|
39
|
-
|
40
6
|
def back_anchor_names(xml)
|
41
7
|
if @parse_settings.empty? || @parse_settings[:clauses]
|
42
8
|
annex_anchor_names(xml)
|
@@ -173,7 +139,7 @@ module IsoDoc
|
|
173
139
|
end
|
174
140
|
|
175
141
|
def section_names(clause, num, lvl)
|
176
|
-
clause
|
142
|
+
unnumbered_section_name?(clause) and return num
|
177
143
|
num.increment(clause)
|
178
144
|
section_name_anchors(clause, num.print, lvl)
|
179
145
|
clause.xpath(ns(SUBCLAUSES))
|
@@ -184,6 +150,7 @@ module IsoDoc
|
|
184
150
|
end
|
185
151
|
|
186
152
|
def section_names1(clause, num, level)
|
153
|
+
unnumbered_section_name?(clause) and return num
|
187
154
|
section_name_anchors(clause, num, level)
|
188
155
|
i = Counter.new(0, prefix: "#{num}.")
|
189
156
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
@@ -191,6 +158,15 @@ module IsoDoc
|
|
191
158
|
end
|
192
159
|
end
|
193
160
|
|
161
|
+
def unnumbered_section_name?(clause)
|
162
|
+
clause.nil? and return true
|
163
|
+
if clause["unnumbered"] == "true"
|
164
|
+
unnumbered_names(clause)
|
165
|
+
return true
|
166
|
+
end
|
167
|
+
false
|
168
|
+
end
|
169
|
+
|
194
170
|
def section_name_anchors(clause, num, level)
|
195
171
|
@anchors[clause["id"]] =
|
196
172
|
{ label: num, xref: l10n("#{@labels['clause']} #{num}"),
|
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: 2.10.
|
4
|
+
version: 2.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html2doc
|
@@ -392,6 +392,7 @@ files:
|
|
392
392
|
- lib/isodoc/word_function/postprocess_toc.rb
|
393
393
|
- lib/isodoc/word_function/table.rb
|
394
394
|
- lib/isodoc/xref.rb
|
395
|
+
- lib/isodoc/xref/clause_order.rb
|
395
396
|
- lib/isodoc/xref/xref_anchor.rb
|
396
397
|
- lib/isodoc/xref/xref_counter.rb
|
397
398
|
- lib/isodoc/xref/xref_gen.rb
|