isodoc 3.2.5 → 3.2.7
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/all.css +0 -10
- data/lib/isodoc/base_style/reset.css +0 -10
- data/lib/isodoc/base_style/reset.scss +0 -10
- data/lib/isodoc/css.rb +0 -1
- data/lib/isodoc/function/to_word_html.rb +1 -1
- data/lib/isodoc/gem_tasks.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +3 -4
- data/lib/isodoc/html_function/postprocess_cover.rb +7 -10
- data/lib/isodoc/html_function/postprocess_footnotes.rb +17 -19
- data/lib/isodoc/metadata.rb +0 -5
- data/lib/isodoc/presentation_function/footnotes.rb +25 -7
- data/lib/isodoc/presentation_function/refs.rb +2 -2
- data/lib/isodoc/presentation_function/section.rb +6 -1
- data/lib/isodoc/presentation_function/terms.rb +3 -2
- data/lib/isodoc/presentation_function/title.rb +19 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/xref/xref_gen_seq.rb +8 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a931ab5244c4320d81c3d050af1135ea7abc6e8f353cab6f000bc1fb70fd5526
|
4
|
+
data.tar.gz: db5d97c194f42a1b99b0839b2ae13b246871f7d353d44ea146a1ca3fc36dd18f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eee3ba25e7638d1d972cf86950eea148f11fdd713b8ad126eaffc375715624d060fe7c562a7ab1c5764ad92943f36c401e3a1a49ca614a3a13f5a8439950ea6a
|
7
|
+
data.tar.gz: 13004963d08b08371fe5c5ca24da18ac1321aebb849a97dc3ee23e26653f2d7dadf91bd8eb5aca50a2fe0014930927e21a0f4d80c8689edb3268a324d854358f
|
@@ -138,16 +138,6 @@ div.document-stage-band, div.document-type-band {
|
|
138
138
|
background-color: #333333;
|
139
139
|
}
|
140
140
|
|
141
|
-
a.FootnoteRef + a.FootnoteRef::before {
|
142
|
-
content: ", ";
|
143
|
-
vertical-align: super;
|
144
|
-
}
|
145
|
-
|
146
|
-
a.TableFootnoteRef + a.TableFootnoteRef::before {
|
147
|
-
content: ", ";
|
148
|
-
vertical-align: super;
|
149
|
-
}
|
150
|
-
|
151
141
|
a.TableFootnoteRef, span.TableFootnoteRef,
|
152
142
|
a.FootnoteRef, span.FootnoteRef {
|
153
143
|
vertical-align: super;
|
@@ -138,16 +138,6 @@ div.document-stage-band, div.document-type-band {
|
|
138
138
|
background-color: #333333;
|
139
139
|
}
|
140
140
|
|
141
|
-
a.FootnoteRef + a.FootnoteRef::before {
|
142
|
-
content: ", ";
|
143
|
-
vertical-align: super;
|
144
|
-
}
|
145
|
-
|
146
|
-
a.TableFootnoteRef + a.TableFootnoteRef::before {
|
147
|
-
content: ", ";
|
148
|
-
vertical-align: super;
|
149
|
-
}
|
150
|
-
|
151
141
|
a.TableFootnoteRef, span.TableFootnoteRef,
|
152
142
|
a.FootnoteRef, span.FootnoteRef {
|
153
143
|
vertical-align: super;
|
@@ -145,16 +145,6 @@ div.document-stage-band, div.document-type-band {
|
|
145
145
|
background-color: #333333;
|
146
146
|
}
|
147
147
|
|
148
|
-
a.FootnoteRef + a.FootnoteRef::before {
|
149
|
-
content: ", ";
|
150
|
-
vertical-align: super;
|
151
|
-
}
|
152
|
-
|
153
|
-
a.TableFootnoteRef + a.TableFootnoteRef::before {
|
154
|
-
content: ", ";
|
155
|
-
vertical-align: super;
|
156
|
-
}
|
157
|
-
|
158
148
|
a.TableFootnoteRef, span.TableFootnoteRef,
|
159
149
|
a.FootnoteRef, span.FootnoteRef {
|
160
150
|
vertical-align: super;
|
data/lib/isodoc/css.rb
CHANGED
@@ -166,7 +166,7 @@ module IsoDoc
|
|
166
166
|
when "image" then image_parse(node, out, nil)
|
167
167
|
when "sourcecode" then sourcecode_parse(node, out)
|
168
168
|
when "pre" then pre_parse(node, out)
|
169
|
-
when "annotation" then annotation_parse(node, out)
|
169
|
+
when "callout-annotation" then annotation_parse(node, out)
|
170
170
|
when "term" then termdef_parse(node, out)
|
171
171
|
when "preferred" then semx_term_parse(node, out)
|
172
172
|
when "fmt-preferred" then term_parse(node, out)
|
data/lib/isodoc/gem_tasks.rb
CHANGED
@@ -118,7 +118,7 @@ module IsoDoc
|
|
118
118
|
sheet_content = File.read(filename, encoding: "UTF-8")
|
119
119
|
.gsub(%r<([a-z])\.([0-9])(?=[^{}]*{)>m, "\\1.__WORD__\\2")
|
120
120
|
SassC::Engine.new(%<@use "variables" as *;\n#{sheet_content}>,
|
121
|
-
syntax: :scss, importer: SasscImporter)
|
121
|
+
syntax: :scss, quiet_deps: true, importer: SasscImporter)
|
122
122
|
.render.gsub(/__WORD__/, "")
|
123
123
|
end
|
124
124
|
end
|
@@ -25,10 +25,9 @@ module IsoDoc
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def html_cleanup(html)
|
28
|
-
html = term_header(
|
29
|
-
html =
|
30
|
-
|
31
|
-
html_toc(heading_anchors(sourcecode_cleanup(html)))
|
28
|
+
html = term_header(html_preface(htmlstyle(html)))
|
29
|
+
html = html_list_clean(remove_placeholder_paras(html_footnote(html)))
|
30
|
+
html_toc(heading_anchors(sourcecode_cleanup(mathml(html))))
|
32
31
|
end
|
33
32
|
|
34
33
|
def heading_anchors(html)
|
@@ -13,8 +13,7 @@ module IsoDoc
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def htmlstylesheet(file)
|
16
|
-
|
17
|
-
|
16
|
+
file.nil? and return
|
18
17
|
file.open if file.is_a?(Tempfile)
|
19
18
|
stylesheet = file.read
|
20
19
|
xml = Nokogiri::XML("<style/>")
|
@@ -26,8 +25,7 @@ module IsoDoc
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def htmlstyle(docxml)
|
29
|
-
return docxml
|
30
|
-
|
28
|
+
@htmlstylesheet or return docxml
|
31
29
|
head = docxml.at("//*[local-name() = 'head']")
|
32
30
|
head << htmlstylesheet(@htmlstylesheet)
|
33
31
|
s = htmlstylesheet(@htmlstylesheet_override) and head << s
|
@@ -53,10 +51,10 @@ module IsoDoc
|
|
53
51
|
def authority_cleanup1(docxml, klass)
|
54
52
|
dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
|
55
53
|
auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or " \
|
56
|
-
"@class = 'boilerplate-#{klass}']")
|
57
|
-
auth
|
58
|
-
auth
|
59
|
-
dest
|
54
|
+
"@class = 'boilerplate-#{klass}']") or return
|
55
|
+
auth.xpath(".//h1[not(text())] | .//h2[not(text())]").each(&:remove)
|
56
|
+
auth.xpath(".//h1 | .//h2").each { |h| h["class"] = "IntroTitle" }
|
57
|
+
dest && auth and dest.replace(auth.remove)
|
60
58
|
end
|
61
59
|
|
62
60
|
def authority_cleanup(docxml)
|
@@ -163,8 +161,7 @@ module IsoDoc
|
|
163
161
|
end
|
164
162
|
|
165
163
|
def inject_script(doc)
|
166
|
-
return doc
|
167
|
-
|
164
|
+
@scripts or return doc
|
168
165
|
scripts = File.read(@scripts, encoding: "UTF-8")
|
169
166
|
scripts_override = ""
|
170
167
|
@scripts_override and
|
@@ -1,25 +1,18 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module HtmlFunction
|
3
3
|
module Html
|
4
|
-
def
|
5
|
-
|
6
|
-
xref.at("./sup").content = seen[fnote.text][:num].to_s
|
7
|
-
fnote.remove unless xref["href"] == seen[fnote.text][:href]
|
8
|
-
xref["href"] = seen[fnote.text][:href]
|
9
|
-
else
|
10
|
-
seen[fnote.text] = { num: idx, href: xref["href"] }
|
11
|
-
xref.at("./sup").content = idx.to_s
|
12
|
-
idx += 1
|
13
|
-
end
|
14
|
-
[idx, seen]
|
4
|
+
def html_footnote(html)
|
5
|
+
footnote_delimit(footnote_backlinks(html))
|
15
6
|
end
|
16
7
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
8
|
+
def footnote_delimit(docxml)
|
9
|
+
k = %w(FootnoteRef TableFootnoteRef)
|
10
|
+
docxml.xpath("//a").each do |a|
|
11
|
+
k.include?(a["class"]) or next
|
12
|
+
a1 = a.next_element or next
|
13
|
+
k.include?(a1["class"]) or next
|
14
|
+
sup = a.at("./sup") and a = sup
|
15
|
+
a << ", "
|
23
16
|
end
|
24
17
|
docxml
|
25
18
|
end
|
@@ -37,14 +30,19 @@ module IsoDoc
|
|
37
30
|
def footnote_backlinks(docxml)
|
38
31
|
seen = {}
|
39
32
|
docxml.xpath('//a[@class = "FootnoteRef"]').each_with_index do |x, i|
|
40
|
-
(
|
41
|
-
|
33
|
+
fn = footnote_backlink?(x, docxml, seen) or next
|
34
|
+
seen[x["href"]] = true
|
42
35
|
footnote_backlinks1(x, fn)
|
43
36
|
x["id"] ||= "fnref:#{i + 1}"
|
44
37
|
fn.add_child "<a href='##{x['id']}'>↩</a>"
|
45
38
|
end
|
46
39
|
docxml
|
47
40
|
end
|
41
|
+
|
42
|
+
def footnote_backlink?(elem, docxml, seen)
|
43
|
+
seen[elem["href"]] and return
|
44
|
+
docxml.at(%<//*[@id = '#{elem['href'].sub(/^#/, '')}']>)
|
45
|
+
end
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
data/lib/isodoc/metadata.rb
CHANGED
@@ -84,11 +84,6 @@ module IsoDoc
|
|
84
84
|
status_print(docstatus).split(/ /).map { |s| s[0].upcase }.join
|
85
85
|
end
|
86
86
|
|
87
|
-
# KILL
|
88
|
-
def unpublishedx(status)
|
89
|
-
!status.casecmp("published").zero?
|
90
|
-
end
|
91
|
-
|
92
87
|
def status_print(status)
|
93
88
|
status.split(/[- ]/).map do |w|
|
94
89
|
letters = w.chars
|
@@ -3,7 +3,8 @@ module IsoDoc
|
|
3
3
|
def footnote_collect(fnotes)
|
4
4
|
seen = {}
|
5
5
|
fnotes.each_with_object([]) do |x, m|
|
6
|
-
|
6
|
+
x["reference"] or next # ignore semx-only footnotes
|
7
|
+
b = fnbody(x, seen) and m << b
|
7
8
|
x["target"] = seen[x["reference"]]
|
8
9
|
ref = x["hiddenref"] == "true" ? "" : fn_ref_label(x)
|
9
10
|
x << <<~FNOTE.strip
|
@@ -21,6 +22,7 @@ module IsoDoc
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def fnbody(fnote, seen)
|
25
|
+
add_fnbody?(fnote, seen) or return nil
|
24
26
|
body = Nokogiri::XML::Node.new("fmt-fn-body", fnote.document)
|
25
27
|
add_id(body)
|
26
28
|
body["target"] = fnote["id"]
|
@@ -31,6 +33,10 @@ module IsoDoc
|
|
31
33
|
body
|
32
34
|
end
|
33
35
|
|
36
|
+
def add_fnbody?(fnote, seen)
|
37
|
+
!seen[fnote["reference"]]
|
38
|
+
end
|
39
|
+
|
34
40
|
def insert_fn_body_ref(fnote, body)
|
35
41
|
ins = body.at(ns(".//p")) ||
|
36
42
|
body.at(ns("./semx")).children.first.before("<p> </p>").previous
|
@@ -80,13 +86,21 @@ module IsoDoc
|
|
80
86
|
end
|
81
87
|
|
82
88
|
def non_document_footnotes(docxml)
|
83
|
-
|
89
|
+
table_footnotes(docxml) + figure_footnotes(docxml)
|
90
|
+
end
|
91
|
+
|
92
|
+
def table_footnotes(docxml)
|
93
|
+
docxml.xpath(ns("//table//fn")) -
|
84
94
|
docxml.xpath(ns("//table/name//fn")) -
|
85
|
-
docxml.xpath(ns("//table/fmt-name//fn"))
|
86
|
-
|
95
|
+
docxml.xpath(ns("//table/fmt-name//fn")) -
|
96
|
+
docxml.xpath(ns("//fmt-provision/table//fn")) +
|
97
|
+
docxml.xpath(ns("//fmt-provision/table//table//fn"))
|
98
|
+
end
|
99
|
+
|
100
|
+
def figure_footnotes(docxml)
|
101
|
+
docxml.xpath(ns("//figure//fn")) -
|
87
102
|
docxml.xpath(ns("//figure/name//fn")) -
|
88
103
|
docxml.xpath(ns("//figure/fmt-name//fn"))
|
89
|
-
table_fns + fig_fns
|
90
104
|
end
|
91
105
|
|
92
106
|
def filter_document_footnotes(sects, excl)
|
@@ -108,7 +122,10 @@ module IsoDoc
|
|
108
122
|
|
109
123
|
def renumber_document_footnote(fnote, idx, seen)
|
110
124
|
fnote["original-reference"] = fnote["reference"]
|
111
|
-
if
|
125
|
+
if sem_xml_descendant?(fnote)
|
126
|
+
fnote.delete("reference")
|
127
|
+
return idx
|
128
|
+
elsif seen[fnote["reference"]]
|
112
129
|
fnote["reference"] = seen[fnote["reference"]]
|
113
130
|
else
|
114
131
|
seen[fnote["reference"]] = idx
|
@@ -190,7 +207,8 @@ module IsoDoc
|
|
190
207
|
def comment_to_bookmark_attrs(elem, bookmark, start: true)
|
191
208
|
bookmark["target"] = elem["id"]
|
192
209
|
if start then bookmark["end"] = elem["to"]
|
193
|
-
else bookmark["start"] = elem["from"]
|
210
|
+
else bookmark["start"] = elem["from"]
|
211
|
+
end
|
194
212
|
%w(author date).each { |k| bookmark[k] = elem[k] }
|
195
213
|
end
|
196
214
|
|
@@ -3,12 +3,12 @@ require_relative "docid"
|
|
3
3
|
module IsoDoc
|
4
4
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
5
5
|
def references(docxml)
|
6
|
-
bibliography_bibitem_number(docxml)
|
7
6
|
@ref_renderings = references_render(docxml)
|
8
7
|
docxml.xpath(ns("//references/bibitem")).each do |x|
|
9
8
|
bibitem(x, @ref_renderings)
|
10
9
|
reference_name(x)
|
11
10
|
end
|
11
|
+
bibliography_bibitem_number(docxml)
|
12
12
|
hidden_items(docxml)
|
13
13
|
move_norm_ref_to_sections(docxml)
|
14
14
|
end
|
@@ -174,7 +174,7 @@ module IsoDoc
|
|
174
174
|
else norm_ref_entry_code(ordinal, idents, ids, standard, datefn,
|
175
175
|
bib)
|
176
176
|
end
|
177
|
-
bib
|
177
|
+
bib.add_first_child("<biblio-tag>#{ret}</biblio-tag>")
|
178
178
|
end
|
179
179
|
|
180
180
|
def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, _bib)
|
@@ -71,10 +71,15 @@ module IsoDoc
|
|
71
71
|
if unnumbered_clause?(elem)
|
72
72
|
prefix_name(elem, {}, nil, "title")
|
73
73
|
else
|
74
|
-
prefix_name(elem, { caption:
|
74
|
+
prefix_name(elem, { caption: annex_delim_override(elem) }, lbl, "title")
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
+
def annex_delim_override(elem)
|
79
|
+
m = elem.document.root.at(ns("//presentation-metadata/annex-delim"))
|
80
|
+
m ? to_xml(m.children) : annex_delim(elem)
|
81
|
+
end
|
82
|
+
|
78
83
|
def annex_delim(_elem)
|
79
84
|
"<br/><br/>"
|
80
85
|
end
|
@@ -96,10 +96,11 @@ module IsoDoc
|
|
96
96
|
p.add_first_child "<#{to_xml(d1)}> "
|
97
97
|
end
|
98
98
|
|
99
|
+
# TODO should I wrap fmt-definition//termsource in fmt-termsource,
|
100
|
+
# in order to preserve termsource attributes?
|
101
|
+
# differentiating term and nonterm source under designations is not worth it
|
99
102
|
def termsource(docxml)
|
100
103
|
copy_baselevel_termsource(docxml)
|
101
|
-
# TODO should I wrap fmt-definition//termsource in fmt-termsource, in order to preserve termsource attributes?
|
102
|
-
# differentiating term and nonterm source under designations is not worth it
|
103
104
|
docxml.xpath(ns("//fmt-termsource/source | //fmt-definition//source | //fmt-preferred//source | //fmt-admitted//source | //fmt-deprecates//source"))
|
104
105
|
.each do |f|
|
105
106
|
termsource_modification(f)
|
@@ -3,10 +3,23 @@ require_relative "refs"
|
|
3
3
|
module IsoDoc
|
4
4
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
5
5
|
def middle_title(docxml)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
sections = docxml.at(ns("//sections")) or return
|
7
|
+
template = middle_title_get_template(docxml) or return
|
8
|
+
title = populate_template(template, nil) or return
|
9
|
+
title.strip.empty? and return
|
10
|
+
Nokogiri::XML(title).root.text.strip.empty? and return
|
11
|
+
sections.add_first_child title
|
12
|
+
end
|
13
|
+
|
14
|
+
def middle_title_get_template(docxml)
|
15
|
+
m = docxml.at(ns("//presentation-metadata/middle-title"))
|
16
|
+
template = m ? to_xml(m.children) : middle_title_template
|
17
|
+
template&.strip&.empty? and template = nil
|
18
|
+
template
|
19
|
+
end
|
20
|
+
|
21
|
+
def middle_title_template
|
22
|
+
"<p class='zzSTDTitle1'>{{ doctitle }}</p>"
|
10
23
|
end
|
11
24
|
|
12
25
|
def missing_title(docxml)
|
@@ -79,7 +92,8 @@ module IsoDoc
|
|
79
92
|
if prev.name == "floating-title"
|
80
93
|
ret << prev
|
81
94
|
p = prev
|
82
|
-
else break
|
95
|
+
else break
|
96
|
+
end
|
83
97
|
end
|
84
98
|
ret
|
85
99
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -131,18 +131,19 @@ module IsoDoc
|
|
131
131
|
def sequential_permission_body(id, parent_id, elem, label, klass, model,
|
132
132
|
container: false)
|
133
133
|
lbl = parent_id ? "#{parent_id}#{subreqt_separator}#{id}" : id
|
134
|
-
|
134
|
+
e = elem["id"]
|
135
|
+
@anchors[e] = model.postprocess_anchor_struct(
|
135
136
|
elem, anchor_struct(lbl, elem,
|
136
137
|
label, klass, { unnumb: elem["unnumbered"], container: })
|
137
138
|
)
|
138
|
-
@anchors[
|
139
|
+
@anchors[e][:semx] = semx(elem, lbl)
|
139
140
|
if parent_id
|
140
141
|
x = "#{subreqt_separator(markup: true)}#{semx(elem, id)}"
|
141
|
-
@anchors[
|
142
|
-
@anchors[
|
143
|
-
"<span class='fmt-element-name'>#{label}</span> #{@anchors[
|
144
|
-
@anchors[
|
145
|
-
"<span class='fmt-element-name'>#{label}</span> #{@anchors[
|
142
|
+
@anchors[e][:semx] = @anchors[elem.parent["id"]][:semx] + x
|
143
|
+
@anchors[e][:label] =
|
144
|
+
"<span class='fmt-element-name'>#{label}</span> #{@anchors[e][:semx]}"
|
145
|
+
@anchors[e][:xref] =
|
146
|
+
"<span class='fmt-element-name'>#{label}</span> #{@anchors[e][:semx]}"
|
146
147
|
end
|
147
148
|
model.permission_parts(elem, id, label, klass).each do |n|
|
148
149
|
@anchors[n[:id]] = anchor_struct(n[:number], n[:elem], n[:label],
|
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: 3.2.
|
4
|
+
version: 3.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|