isodoc 2.10.1 → 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_titles.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +23 -4
- data/lib/isodoc/html_function/postprocess_cover.rb +3 -1
- 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/xref/xref_gen_seq.rb +2 -2
- metadata +3 -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)
|
@@ -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
|
@@ -98,7 +98,9 @@ module IsoDoc
|
|
98
98
|
def html_toc_entry(level, header)
|
99
99
|
content = header.at("./following-sibling::p" \
|
100
100
|
"[@class = 'variant-title-toc']") || header
|
101
|
-
|
101
|
+
id = header.at(".//a[@class = 'anchor']/@href")&.text&.sub(/^#/, "") ||
|
102
|
+
header["id"]
|
103
|
+
%(<li class="#{level}"><a href="##{id}">\
|
102
104
|
#{header_strip(content)}</a></li>)
|
103
105
|
end
|
104
106
|
|
@@ -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 =
|
@@ -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")
|
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
|
@@ -425,7 +425,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
425
425
|
- !ruby/object:Gem::Version
|
426
426
|
version: '0'
|
427
427
|
requirements: []
|
428
|
-
rubygems_version: 3.3.
|
428
|
+
rubygems_version: 3.3.27
|
429
429
|
signing_key:
|
430
430
|
specification_version: 4
|
431
431
|
summary: Convert documents in IsoDoc into Word and HTML in AsciiDoc.
|