isodoc 2.10.0 → 2.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/base_style/all.css +44 -0
- data/lib/isodoc/base_style/reset.css +44 -0
- data/lib/isodoc/base_style/reset.scss +22 -0
- data/lib/isodoc/function/cleanup.rb +5 -4
- data/lib/isodoc/function/lists.rb +17 -11
- data/lib/isodoc/function/section.rb +5 -8
- data/lib/isodoc/function/section_titles.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +23 -4
- data/lib/isodoc/html_function/postprocess_cover.rb +7 -3
- data/lib/isodoc/presentation_function/refs.rb +8 -3
- data/lib/isodoc/presentation_function/sourcecode.rb +2 -2
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/lists.rb +6 -4
- 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_gen_seq.rb +2 -2
- data/lib/isodoc/xref/xref_sect_gen.rb +13 -37
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e19ba3a2fd2440b24be729cbba835907ac504ca7c762f673632de52881922f1
|
4
|
+
data.tar.gz: 6b3fff1e5f4feebc785588093eee4fb81a1da3dc37ff1417b2e30445e353dbcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8751365f532c1123f30df8480fca7021cb90122c419e963b4ba46fb6ece8bca0c4bd1593d4c3d3f987f5db5dde295012e01a59af5392929dc3db972db5bb50c9
|
7
|
+
data.tar.gz: '006383549c57caf4cb72ef35b51aaad6ada733981858f2188eb7515f08d8d1e964b7a27e47d723199737c6dc70cd7c379775804ee28b55757fda18a1c77dcb63'
|
@@ -169,6 +169,50 @@ table.rouge-line-table pre {
|
|
169
169
|
overflow-x: visible;
|
170
170
|
font-size: 100%; }
|
171
171
|
|
172
|
+
a.header {
|
173
|
+
color: inherit;
|
174
|
+
text-decoration: none; }
|
175
|
+
|
176
|
+
a.header:hover {
|
177
|
+
color: #a53221; }
|
178
|
+
|
179
|
+
a.header:visited {
|
180
|
+
color: inherit;
|
181
|
+
text-decoration: none; }
|
182
|
+
|
183
|
+
a.anchor {
|
184
|
+
position: absolute;
|
185
|
+
z-index: 1001;
|
186
|
+
width: 1.5ex;
|
187
|
+
margin-left: -1.5ex;
|
188
|
+
display: block;
|
189
|
+
text-decoration: none !important;
|
190
|
+
visibility: hidden;
|
191
|
+
text-align: center;
|
192
|
+
font-weight: 400; }
|
193
|
+
|
194
|
+
a.anchor::before {
|
195
|
+
content: "\00A7";
|
196
|
+
font-size: .85em;
|
197
|
+
display: block;
|
198
|
+
padding-top: .1em; }
|
199
|
+
|
200
|
+
h1 > a.anchor:hover,
|
201
|
+
h2 > a.anchor:hover,
|
202
|
+
h3 > a.anchor:hover,
|
203
|
+
h4 > a.anchor:hover,
|
204
|
+
h5 > a.anchor:hover,
|
205
|
+
h6 > a.anchor:hover,
|
206
|
+
.inline-header > a.anchor:hover,
|
207
|
+
h1:hover > a.anchor,
|
208
|
+
h2:hover > a.anchor,
|
209
|
+
h3:hover > a.anchor,
|
210
|
+
h4:hover > a.anchor,
|
211
|
+
h5:hover > a.anchor,
|
212
|
+
h6:hover > a.anchor,
|
213
|
+
.inline-header:hover > a.anchor {
|
214
|
+
visibility: visible; }
|
215
|
+
|
172
216
|
#standard-band {
|
173
217
|
background-color: #0AC442; }
|
174
218
|
|
@@ -168,3 +168,47 @@ table.rouge-line-table pre {
|
|
168
168
|
padding: 0;
|
169
169
|
overflow-x: visible;
|
170
170
|
font-size: 100%; }
|
171
|
+
|
172
|
+
a.header {
|
173
|
+
color: inherit;
|
174
|
+
text-decoration: none; }
|
175
|
+
|
176
|
+
a.header:hover {
|
177
|
+
color: #a53221; }
|
178
|
+
|
179
|
+
a.header:visited {
|
180
|
+
color: inherit;
|
181
|
+
text-decoration: none; }
|
182
|
+
|
183
|
+
a.anchor {
|
184
|
+
position: absolute;
|
185
|
+
z-index: 1001;
|
186
|
+
width: 1.5ex;
|
187
|
+
margin-left: -1.5ex;
|
188
|
+
display: block;
|
189
|
+
text-decoration: none !important;
|
190
|
+
visibility: hidden;
|
191
|
+
text-align: center;
|
192
|
+
font-weight: 400; }
|
193
|
+
|
194
|
+
a.anchor::before {
|
195
|
+
content: "\00A7";
|
196
|
+
font-size: .85em;
|
197
|
+
display: block;
|
198
|
+
padding-top: .1em; }
|
199
|
+
|
200
|
+
h1 > a.anchor:hover,
|
201
|
+
h2 > a.anchor:hover,
|
202
|
+
h3 > a.anchor:hover,
|
203
|
+
h4 > a.anchor:hover,
|
204
|
+
h5 > a.anchor:hover,
|
205
|
+
h6 > a.anchor:hover,
|
206
|
+
.inline-header > a.anchor:hover,
|
207
|
+
h1:hover > a.anchor,
|
208
|
+
h2:hover > a.anchor,
|
209
|
+
h3:hover > a.anchor,
|
210
|
+
h4:hover > a.anchor,
|
211
|
+
h5:hover > a.anchor,
|
212
|
+
h6:hover > a.anchor,
|
213
|
+
.inline-header:hover > a.anchor {
|
214
|
+
visibility: visible; }
|
@@ -199,3 +199,25 @@ table.rouge-line-table pre {
|
|
199
199
|
overflow-x: visible;
|
200
200
|
font-size: 100%;
|
201
201
|
}
|
202
|
+
|
203
|
+
a.header{color:inherit;text-decoration:none}
|
204
|
+
a.header:hover{color:#a53221}
|
205
|
+
a.header:visited{color:inherit;text-decoration:none}
|
206
|
+
a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
|
207
|
+
a.anchor::before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
|
208
|
+
h1>a.anchor:hover,
|
209
|
+
h2>a.anchor:hover,
|
210
|
+
h3>a.anchor:hover,
|
211
|
+
h4>a.anchor:hover,
|
212
|
+
h5>a.anchor:hover,
|
213
|
+
h6>a.anchor:hover,
|
214
|
+
.inline-header>a.anchor:hover,
|
215
|
+
h1:hover>a.anchor,
|
216
|
+
h2:hover>a.anchor,
|
217
|
+
h3:hover>a.anchor,
|
218
|
+
h4:hover>a.anchor,
|
219
|
+
h5:hover>a.anchor,
|
220
|
+
h6:hover>a.anchor,
|
221
|
+
.inline-header:hover>a.anchor{
|
222
|
+
visibility:visible;
|
223
|
+
}
|
@@ -157,13 +157,14 @@ module IsoDoc
|
|
157
157
|
tfoot.xpath(".//td").last
|
158
158
|
end
|
159
159
|
|
160
|
+
TABLENOTE_CSS = "div[@class = 'Note' or @class = 'BlockSource' " \
|
161
|
+
"or @class = 'TableFootnote' or @class = 'figdl']".freeze
|
162
|
+
|
160
163
|
def table_note_cleanup(docxml)
|
161
|
-
docxml.xpath("//table[dl or
|
162
|
-
"or @class = 'TableFootnote']]").each do |t|
|
164
|
+
docxml.xpath("//table[dl or #{TABLENOTE_CSS}]").each do |t|
|
163
165
|
tfoot = table_get_or_make_tfoot(t)
|
164
166
|
insert_here = new_fullcolspan_row(t, tfoot)
|
165
|
-
t.xpath("dl |
|
166
|
-
"@class = 'TableFootnote']")
|
167
|
+
t.xpath("dl | p[@class = 'ListTitle'] | #{TABLENOTE_CSS}")
|
167
168
|
.each do |d|
|
168
169
|
d.parent = insert_here
|
169
170
|
end
|
@@ -13,9 +13,11 @@ module IsoDoc
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def ul_parse(node, out)
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
out.div **attr_code(class: "ul_wrap") do |div|
|
17
|
+
list_title_parse(node, div)
|
18
|
+
div.ul **attr_code(ul_attrs(node)) do |ul|
|
19
|
+
node.children.each { |n| n.name == "name" or parse(n, ul) }
|
20
|
+
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
@@ -52,9 +54,11 @@ module IsoDoc
|
|
52
54
|
end
|
53
55
|
|
54
56
|
def ol_parse(node, out)
|
55
|
-
|
56
|
-
|
57
|
-
|
57
|
+
out.div **attr_code(class: "ol_wrap") do |div|
|
58
|
+
list_title_parse(node, div)
|
59
|
+
div.ol **attr_code(ol_attrs(node)) do |ol|
|
60
|
+
node.children.each { |n| n.name == "name" or parse(n, ol) }
|
61
|
+
end
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
@@ -90,13 +94,15 @@ module IsoDoc
|
|
90
94
|
end
|
91
95
|
|
92
96
|
def dl_parse(node, out)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
+
out.div **attr_code(class: "figdl") do |div|
|
98
|
+
list_title_parse(node, div)
|
99
|
+
div.dl **dl_attrs(node) do |v|
|
100
|
+
node.elements.select { |n| dt_dd? n }.each_slice(2) do |dt, dd|
|
101
|
+
dl_parse1(v, dt, dd)
|
102
|
+
end
|
97
103
|
end
|
104
|
+
dl_parse_notes(node, div)
|
98
105
|
end
|
99
|
-
dl_parse_notes(node, out)
|
100
106
|
end
|
101
107
|
|
102
108
|
def dl_parse_notes(node, out)
|
@@ -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
|
@@ -10,7 +10,7 @@ module IsoDoc
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def inline_header_title(out, node, title)
|
13
|
-
out.span class: "zzMoveToFollowing" do |s|
|
13
|
+
out.span class: "zzMoveToFollowing inline-header" do |s|
|
14
14
|
s.b do |b|
|
15
15
|
title&.children&.each { |c2| parse(c2, b) }
|
16
16
|
clausedelimspace(node, out) if /\S/.match?(title&.text)
|
@@ -26,9 +26,26 @@ module IsoDoc
|
|
26
26
|
|
27
27
|
def html_cleanup(html)
|
28
28
|
html = term_header(html_footnote_filter(html_preface(htmlstyle(html))))
|
29
|
-
html = footnote_format(footnote_backlinks(
|
29
|
+
html = footnote_format(footnote_backlinks(html))
|
30
30
|
html = mathml(html_list_clean(remove_placeholder_paras(html)))
|
31
|
-
sourcecode_cleanup(html)
|
31
|
+
html_toc(heading_anchors(sourcecode_cleanup(html)))
|
32
|
+
end
|
33
|
+
|
34
|
+
def heading_anchors(html)
|
35
|
+
html.xpath("//h1 | //h2 | //h3 | //h4 | //h5 | //h6 | //h7 | //h8 "\
|
36
|
+
"//span[@class = 'inline-header']").each do |h|
|
37
|
+
h.at("./ancestor::div[@id='toc']") and next
|
38
|
+
div = h.xpath("./ancestor::div[@id]")
|
39
|
+
div.empty? and next
|
40
|
+
heading_anchor(h, div[-1]["id"])
|
41
|
+
end
|
42
|
+
html
|
43
|
+
end
|
44
|
+
|
45
|
+
def heading_anchor(hdr, id)
|
46
|
+
hdr.children = <<~HTML.strip
|
47
|
+
<a class='anchor' href='##{id}'/><a class='header' href='##{id}'>#{hdr.children.to_xml}</a>
|
48
|
+
HTML
|
32
49
|
end
|
33
50
|
|
34
51
|
def sourcecode_cleanup(html)
|
@@ -52,7 +69,7 @@ module IsoDoc
|
|
52
69
|
|
53
70
|
def html_list_clean(html)
|
54
71
|
html.xpath("//ol/div | //ul/div").each do |div|
|
55
|
-
li = div
|
72
|
+
li = div.xpath("./preceding-sibling::li")&.last ||
|
56
73
|
div.at("./following-sibling::li")
|
57
74
|
div.parent = li
|
58
75
|
end
|
@@ -92,7 +109,6 @@ module IsoDoc
|
|
92
109
|
type = img["mimetype"]&.sub(%r{^[^/*]+/}, "")
|
93
110
|
matched = /\.(?<suffix>[^. \r\n\t]+)$/.match img["src"]
|
94
111
|
type and !type.empty? and return type
|
95
|
-
|
96
112
|
!matched.nil? and matched[:suffix] and return matched[:suffix]
|
97
113
|
"png"
|
98
114
|
end
|
@@ -111,6 +127,9 @@ module IsoDoc
|
|
111
127
|
%w(h1 h2 h3 h4 h5 h6 h7 h8).each do |h|
|
112
128
|
docxml.xpath("//p[@class = 'TermNum'][../#{h}]").each do |p|
|
113
129
|
p.name = "h#{h[1].to_i + 1}"
|
130
|
+
id = p["id"]
|
131
|
+
p["id"] = "_#{UUIDTools::UUID.random_create}"
|
132
|
+
p.wrap("<div id='#{id}'></div>")
|
114
133
|
end
|
115
134
|
end
|
116
135
|
docxml
|
@@ -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)
|
@@ -96,7 +98,9 @@ module IsoDoc
|
|
96
98
|
def html_toc_entry(level, header)
|
97
99
|
content = header.at("./following-sibling::p" \
|
98
100
|
"[@class = 'variant-title-toc']") || header
|
99
|
-
|
101
|
+
id = header.at(".//a[@class = 'anchor']/@href")&.text&.sub(/^#/, "") ||
|
102
|
+
header["id"]
|
103
|
+
%(<li class="#{level}"><a href="##{id}">\
|
100
104
|
#{header_strip(content)}</a></li>)
|
101
105
|
end
|
102
106
|
|
@@ -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
|
@@ -141,8 +141,8 @@ module IsoDoc
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def source_lex(elem)
|
144
|
-
lexer =
|
145
|
-
|
144
|
+
lexer = Rouge::Lexer.find(elem["lang"] || "plaintext") ||
|
145
|
+
Rouge::Lexer.find("plaintext")
|
146
146
|
l = Rouge::Lexers::Escape.new(start: "{^^{", end: "}^^}", lang: lexer)
|
147
147
|
source = to_xml(elem.children).gsub(/</, "{^^{<").gsub(/>/, ">}^^}")
|
148
148
|
l.lang.reset!
|
data/lib/isodoc/version.rb
CHANGED
@@ -24,13 +24,15 @@ module IsoDoc
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def dl_parse_nontable(node, out)
|
27
|
-
|
28
|
-
|
27
|
+
out.div **attr_code(class: "figdl") do |div|
|
28
|
+
node["id"] and bookmark_parse(node, div)
|
29
|
+
list_title_parse(node, div)
|
29
30
|
node.elements.select { |n| dt_dd?(n) }
|
30
31
|
.each_slice(2) do |dt, dd|
|
31
|
-
dl_parse_nontable1(
|
32
|
+
dl_parse_nontable1(div, dt, dd)
|
33
|
+
end
|
34
|
+
dl_parse_notes(node, div)
|
32
35
|
end
|
33
|
-
dl_parse_notes(node, out)
|
34
36
|
end
|
35
37
|
|
36
38
|
WORD_EMBED_DL_ATTRS =
|
@@ -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))
|
@@ -27,7 +27,7 @@ module IsoDoc
|
|
27
27
|
def sequential_figure_names(clause, container: false)
|
28
28
|
c = Counter.new
|
29
29
|
j = 0
|
30
|
-
clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
|
30
|
+
clause.xpath(ns(self.class::FIGURE_NO_CLASS)).noblank.each do |t|
|
31
31
|
j = subfigure_increment(j, c, t)
|
32
32
|
sequential_figure_body(j, c, t, "figure", container: container)
|
33
33
|
end
|
@@ -155,7 +155,7 @@ module IsoDoc
|
|
155
155
|
def hierarchical_figure_names(clause, num)
|
156
156
|
c = Counter.new
|
157
157
|
j = 0
|
158
|
-
clause.xpath(ns(FIGURE_NO_CLASS)).noblank.each do |t|
|
158
|
+
clause.xpath(ns(self.class::FIGURE_NO_CLASS)).noblank.each do |t|
|
159
159
|
# next if labelled_ancestor(t) && t.ancestors("figure").empty?
|
160
160
|
j = subfigure_increment(j, c, t)
|
161
161
|
hierarchical_figure_body(num, j, c, t, "figure")
|
@@ -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.2
|
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-
|
11
|
+
date: 2024-05-06 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
|
@@ -424,7 +425,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
424
425
|
- !ruby/object:Gem::Version
|
425
426
|
version: '0'
|
426
427
|
requirements: []
|
427
|
-
rubygems_version: 3.3.
|
428
|
+
rubygems_version: 3.3.27
|
428
429
|
signing_key:
|
429
430
|
specification_version: 4
|
430
431
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|