isodoc 3.1.4 → 3.1.5
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/isodoc.gemspec +4 -0
- data/lib/isodoc/function/cleanup.rb +0 -10
- data/lib/isodoc/function/inline.rb +17 -11
- data/lib/isodoc/function/lists.rb +20 -10
- data/lib/isodoc/html_function/postprocess_footnotes.rb +0 -15
- data/lib/isodoc/init.rb +1 -0
- data/lib/isodoc/presentation_function/block.rb +0 -47
- data/lib/isodoc/presentation_function/list.rb +78 -0
- data/lib/isodoc/presentation_function/math.rb +2 -10
- data/lib/isodoc/presentation_function/xrefs.rb +1 -1
- data/lib/isodoc/presentation_xml_convert.rb +42 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/comments.rb +0 -20
- data/lib/isodoc/word_function/lists.rb +6 -8
- data/lib/isodoc/word_function/postprocess.rb +0 -17
- data/lib/isodoc/xref/ol_type_provider.rb +16 -0
- data/lib/isodoc/xref/xref_counter.rb +2 -11
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aab1e285713806592294433b8009ca144fe193d9a0f43019448580c8fbe1dd9d
|
4
|
+
data.tar.gz: 58fc680a7a698f4f714a1c9577e7d0f48c382ccadc720b2c588fe870dc643273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fb892bcc672a38de31ab3d6fc9a3e3088d8c4ebba8c46010167a0646284747fca650de1c48c39b07b7177e7674494a05273d63204f4c0702b15a9dc09fe8c2b
|
7
|
+
data.tar.gz: ad8a5996bef31064b9b2fda5245f32caa2c16378468ba36bdf96933fe84c67ec6f0220907a1cde46e571d240dfc866d4363f9712b83c6544c923bea5087ae1a7
|
data/isodoc.gemspec
CHANGED
@@ -57,5 +57,9 @@ Gem::Specification.new do |spec|
|
|
57
57
|
spec.add_development_dependency "simplecov", "~> 0.15"
|
58
58
|
spec.add_development_dependency "timecop", "~> 0.9"
|
59
59
|
spec.add_development_dependency "xml-c14n"
|
60
|
+
# html2doc locks lutaml-model to ~ 0.7.0, but until testing of lutaml-model
|
61
|
+
# releases against dowmstream gems (notably Plurimath) is in place, locking at
|
62
|
+
# patch level
|
63
|
+
#spec.add_dependency "lutaml-model", "0.7.1"
|
60
64
|
# spec.metadata["rubygems_mfa_required"] = "true"
|
61
65
|
end
|
@@ -16,7 +16,6 @@ module IsoDoc
|
|
16
16
|
def cleanup(docxml)
|
17
17
|
@i18n ||= i18n_init(@lang, @script, @locale)
|
18
18
|
comment_cleanup(docxml)
|
19
|
-
#footnote_cleanup(docxml)
|
20
19
|
inline_header_cleanup(docxml)
|
21
20
|
figure_cleanup(docxml)
|
22
21
|
table_cleanup(docxml)
|
@@ -58,15 +57,6 @@ module IsoDoc
|
|
58
57
|
docxml
|
59
58
|
end
|
60
59
|
|
61
|
-
# KILL
|
62
|
-
def footnote_cleanup(docxml)
|
63
|
-
docxml.xpath('//a[@class = "FootnoteRef"]/sup')
|
64
|
-
.each_with_index do |x, i|
|
65
|
-
x.content = (i + 1).to_s
|
66
|
-
end
|
67
|
-
docxml
|
68
|
-
end
|
69
|
-
|
70
60
|
def merge_fnref_into_fn_text(elem)
|
71
61
|
fn = elem.at('.//span[@class="TableFootnoteRef"]/..') or return
|
72
62
|
n = fn.next_element
|
@@ -81,35 +81,41 @@ module IsoDoc
|
|
81
81
|
|
82
82
|
def stem_parse(node, out)
|
83
83
|
ret = node.at(ns("./semx[@element = 'stem']")) || node
|
84
|
-
ooml =
|
85
|
-
|
86
|
-
|
87
|
-
when "LaTeX" then latexmath_parse(ret)
|
88
|
-
else HTMLEntities.new.encode(ret.text)
|
89
|
-
end
|
90
|
-
out.span class: "stem" do |span|
|
84
|
+
ooml, text_only = stem_parse1(ret, node["type"])
|
85
|
+
klass = text_only ? {} : { class: "stem" }
|
86
|
+
out.span **klass do |span|
|
91
87
|
span.parent.add_child ooml
|
92
88
|
end
|
93
89
|
end
|
94
90
|
|
91
|
+
def stem_parse1(ret, type)
|
92
|
+
case type
|
93
|
+
when "AsciiMath" then asciimath_parse(ret)
|
94
|
+
when "MathML" then mathml_parse(ret)
|
95
|
+
when "LaTeX" then latexmath_parse(ret)
|
96
|
+
else [HTMLEntities.new.encode(ret.text),
|
97
|
+
/^[[0-9,.+-]]*$/.match?(ret.text)]
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
95
101
|
MATHML = { "m" => "http://www.w3.org/1998/Math/MathML" }.freeze
|
96
102
|
|
97
103
|
def mathml_parse(node)
|
98
104
|
# node.xpath("./m:math", MATHML).map(&:to_xml).join
|
99
105
|
node.xpath(ns("./asciimath | ./latexmath")).each(&:remove)
|
100
106
|
node.xpath(ns("./br")).each { |e| e.namespace = nil }
|
101
|
-
node.elements
|
107
|
+
[node.children, node.elements.empty?]
|
102
108
|
end
|
103
109
|
|
104
110
|
def asciimath_parse(node)
|
105
111
|
a = node.at(ns("./asciimath"))&.text || node.text
|
106
|
-
"#{@openmathdelim}#{HTMLEntities.new.encode(a)}" \
|
107
|
-
"#{@closemathdelim}"
|
112
|
+
["#{@openmathdelim}#{HTMLEntities.new.encode(a)}" \
|
113
|
+
"#{@closemathdelim}", /^[[0-9,.+-]]*$/.match?(a)]
|
108
114
|
end
|
109
115
|
|
110
116
|
def latexmath_parse(node)
|
111
117
|
a = node.at(ns("./latexmath"))&.text || node.text
|
112
|
-
HTMLEntities.new.encode(a)
|
118
|
+
[HTMLEntities.new.encode(a), /^[[0-9,.+-]]*$/.match?(a)]
|
113
119
|
end
|
114
120
|
|
115
121
|
def image_title_parse(out, caption)
|
@@ -37,8 +37,9 @@ module IsoDoc
|
|
37
37
|
# We don't really want users to specify type of ordered list;
|
38
38
|
# we will use a fixed hierarchy as practiced by ISO (though not
|
39
39
|
# fully spelled out): a) 1) i) A) I)
|
40
|
-
|
41
|
-
|
40
|
+
# Fallback, this is now being done in Presentation XML
|
41
|
+
# KILL
|
42
|
+
def ol_depthx(node)
|
42
43
|
depth = node.ancestors("ul, ol").size + 1
|
43
44
|
type = :alphabet
|
44
45
|
type = :arabic if [2, 7].include? depth
|
@@ -49,7 +50,8 @@ module IsoDoc
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def ol_attrs(node)
|
52
|
-
{ type: node["type"] ? ol_style(node["type"].to_sym) : ol_depth(node),
|
53
|
+
{ # type: node["type"] ? ol_style(node["type"].to_sym) : ol_depth(node),
|
54
|
+
type: ol_style(node["type"]&.to_sym),
|
53
55
|
id: node["id"], style: keep_style(node) }
|
54
56
|
end
|
55
57
|
|
@@ -62,16 +64,24 @@ module IsoDoc
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
67
|
+
def li_checkbox(node)
|
68
|
+
if node["uncheckedcheckbox"] == "true"
|
69
|
+
'<span class="zzMoveToFollowing">' \
|
70
|
+
'<input type="checkbox" checked="checked"/></span>'
|
71
|
+
elsif node["checkedcheckbox"] == "true"
|
72
|
+
'<span class="zzMoveToFollowing">' \
|
73
|
+
'<input type="checkbox"/></span>'
|
74
|
+
else ""
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
65
78
|
def li_parse(node, out)
|
66
79
|
out.li **attr_code(id: node["id"]) do |li|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
li << '<span class="zzMoveToFollowing">' \
|
72
|
-
'<input type="checkbox"/></span>'
|
80
|
+
li << li_checkbox(node)
|
81
|
+
node.children.each do |n|
|
82
|
+
n.name == "fmt-name" and next
|
83
|
+
parse(n, li)
|
73
84
|
end
|
74
|
-
node.children.each { |n| parse(n, li) }
|
75
85
|
end
|
76
86
|
end
|
77
87
|
|
@@ -28,11 +28,8 @@ module IsoDoc
|
|
28
28
|
xdup = xref.dup
|
29
29
|
xdup.remove["id"]
|
30
30
|
if footnote.elements.empty?
|
31
|
-
#footnote.children.empty? and footnote << " "
|
32
|
-
#footnote.children.first.previous = xdup
|
33
31
|
footnote.add_first_child xdup
|
34
32
|
else
|
35
|
-
#footnote.elements.first.children.first.previous = xdup
|
36
33
|
footnote.elements.first.add_first_child xdup
|
37
34
|
end
|
38
35
|
end
|
@@ -48,18 +45,6 @@ module IsoDoc
|
|
48
45
|
end
|
49
46
|
docxml
|
50
47
|
end
|
51
|
-
|
52
|
-
# KILL
|
53
|
-
def footnote_formatx(docxml)
|
54
|
-
docxml.xpath("//a[@class = 'FootnoteRef']/sup").each do |x|
|
55
|
-
footnote_reference_format(x)
|
56
|
-
end
|
57
|
-
docxml.xpath("//a[@class = 'TableFootnoteRef'] | "\
|
58
|
-
"//span[@class = 'TableFootnoteRef']").each do |x|
|
59
|
-
table_footnote_reference_format(x)
|
60
|
-
end
|
61
|
-
docxml
|
62
|
-
end
|
63
48
|
end
|
64
49
|
end
|
65
50
|
end
|
data/lib/isodoc/init.rb
CHANGED
@@ -20,6 +20,7 @@ module IsoDoc
|
|
20
20
|
|
21
21
|
def toc_init(docxml)
|
22
22
|
@doctype = docxml.at(ns("//bibdata/ext/doctype"))&.text
|
23
|
+
@subdoctype = docxml.at(ns("//bibdata/ext/subdoctype"))&.text
|
23
24
|
@xrefs.klass.doctype = @doctype
|
24
25
|
x = "//metanorma-extension/presentation-metadata" \
|
25
26
|
"[name[text() = 'TOC Heading Levels']]/value"
|
@@ -138,53 +138,6 @@ module IsoDoc
|
|
138
138
|
elem.next = ret
|
139
139
|
end
|
140
140
|
|
141
|
-
def dl(docxml)
|
142
|
-
docxml.xpath(ns("//dl")).each { |f| dl1(f) }
|
143
|
-
end
|
144
|
-
|
145
|
-
def dl1(elem)
|
146
|
-
elem.at(ns("./name")) and
|
147
|
-
prefix_name(elem, {}, "", "name") # copy name to fmt-name
|
148
|
-
end
|
149
|
-
|
150
|
-
def ul(docxml)
|
151
|
-
docxml.xpath(ns("//ul")).each { |f| ul1(f) }
|
152
|
-
end
|
153
|
-
|
154
|
-
def ul1(elem)
|
155
|
-
elem.at(ns("./name")) and
|
156
|
-
prefix_name(elem, {}, "", "name") # copy name to fmt-name
|
157
|
-
end
|
158
|
-
|
159
|
-
def ol(docxml)
|
160
|
-
docxml.xpath(ns("//ol")).each { |f| ol1(f) }
|
161
|
-
@xrefs.list_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
|
162
|
-
docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
|
163
|
-
end
|
164
|
-
|
165
|
-
# We don't really want users to specify type of ordered list;
|
166
|
-
# we will use by default a fixed hierarchy as practiced by ISO (though not
|
167
|
-
# fully spelled out): a) 1) i) A) I)
|
168
|
-
def ol_depth(node)
|
169
|
-
depth = node.ancestors("ul, ol").size + 1
|
170
|
-
type = :alphabet
|
171
|
-
type = :arabic if [2, 7].include? depth
|
172
|
-
type = :roman if [3, 8].include? depth
|
173
|
-
type = :alphabet_upper if [4, 9].include? depth
|
174
|
-
type = :roman_upper if [5, 10].include? depth
|
175
|
-
type
|
176
|
-
end
|
177
|
-
|
178
|
-
def ol1(elem)
|
179
|
-
elem["type"] ||= ol_depth(elem).to_s
|
180
|
-
elem.at(ns("./name")) and
|
181
|
-
prefix_name(elem, {}, "", "name") # copy name to fmt-name
|
182
|
-
end
|
183
|
-
|
184
|
-
def ol_label(elem)
|
185
|
-
elem["label"] = @xrefs.anchor(elem["id"], :label, false)
|
186
|
-
end
|
187
|
-
|
188
141
|
def source(docxml)
|
189
142
|
docxml.xpath(ns("//source/modification")).each do |f|
|
190
143
|
source_modification(f)
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
class PresentationXMLConvert < ::IsoDoc::Convert
|
3
|
+
def dl(docxml)
|
4
|
+
docxml.xpath(ns("//dl")).each { |f| dl1(f) }
|
5
|
+
end
|
6
|
+
|
7
|
+
def dl1(elem)
|
8
|
+
elem.at(ns("./name")) and
|
9
|
+
prefix_name(elem, {}, "", "name") # copy name to fmt-name
|
10
|
+
end
|
11
|
+
|
12
|
+
def ul(docxml)
|
13
|
+
docxml.xpath(ns("//ul")).each { |f| ul1(f) }
|
14
|
+
docxml.xpath(ns("//ul/li")).each { |f| ul_label(f) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def ul1(elem)
|
18
|
+
elem.at(ns("./name")) and
|
19
|
+
prefix_name(elem, {}, "", "name") # copy name to fmt-name
|
20
|
+
end
|
21
|
+
|
22
|
+
def ol(docxml)
|
23
|
+
docxml.xpath(ns("//ol")).each { |f| ol1(f) }
|
24
|
+
@xrefs.list_anchor_names(docxml.xpath(ns(@xrefs.sections_xpath)))
|
25
|
+
docxml.xpath(ns("//ol/li")).each { |f| ol_label(f) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def ol_depth(node)
|
29
|
+
depth = node.ancestors("ul, ol").size + 1
|
30
|
+
@counter.ol_type(node, depth) # defined in Xref::Counter
|
31
|
+
end
|
32
|
+
|
33
|
+
def ol1(elem)
|
34
|
+
elem["type"] ||= ol_depth(elem).to_s # feeds ol_label_format
|
35
|
+
elem.at(ns("./name")) and
|
36
|
+
prefix_name(elem, {}, "", "name") # copy name to fmt-name
|
37
|
+
end
|
38
|
+
|
39
|
+
def ol_label(elem)
|
40
|
+
val = @xrefs.anchor(elem["id"], :label, false)
|
41
|
+
semx = "<semx element='autonum' source='#{elem['id']}'>#{val}</semx>"
|
42
|
+
lbl = "<fmt-name>#{ol_label_format(semx, elem)}</fmt-name>"
|
43
|
+
elem.add_first_child(lbl)
|
44
|
+
end
|
45
|
+
|
46
|
+
def ol_label_template(_elem)
|
47
|
+
{
|
48
|
+
alphabet: %{%<span class="fmt-label-delim">)</span>},
|
49
|
+
alphabet_upper: %{%<span class="fmt-label-delim">.</span>},
|
50
|
+
roman: %{%<span class="fmt-label-delim">)</span>},
|
51
|
+
roman_upper: %{%<span class="fmt-label-delim">.</span>},
|
52
|
+
arabic: %{%<span class="fmt-label-delim">)</span>},
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def ol_label_format(semx, elem)
|
57
|
+
template = ol_label_template(elem)[elem.parent["type"].to_sym]
|
58
|
+
template.sub("%", semx)
|
59
|
+
end
|
60
|
+
|
61
|
+
def ul_label_list(_elem)
|
62
|
+
%w(—)
|
63
|
+
end
|
64
|
+
|
65
|
+
def ul_label(elem)
|
66
|
+
val = ul_label_value(elem)
|
67
|
+
semx = "<semx element='autonum' source='#{elem['id']}'>#{val}</semx>"
|
68
|
+
lbl = "<fmt-name>#{semx}</fmt-name>"
|
69
|
+
elem.add_first_child(lbl)
|
70
|
+
end
|
71
|
+
|
72
|
+
def ul_label_value(elem)
|
73
|
+
depth = elem.ancestors("ul, ol").size
|
74
|
+
val = ul_label_list(elem)
|
75
|
+
val[(depth - 1) % val.size]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -149,11 +149,7 @@ module IsoDoc
|
|
149
149
|
def maths_just_numeral(node)
|
150
150
|
mn = node.at(".//m:mn", MATHML).children.text
|
151
151
|
.sub(/\^([0-9+-]+)$/, "<sup>\\1</sup>")
|
152
|
-
|
153
|
-
#node.replace(mn)
|
154
|
-
#else
|
155
|
-
node.replace(mn)
|
156
|
-
#end
|
152
|
+
node.replace(mn)
|
157
153
|
end
|
158
154
|
|
159
155
|
def mathml1(node, locale)
|
@@ -209,11 +205,7 @@ module IsoDoc
|
|
209
205
|
def mathml_number_to_number(node)
|
210
206
|
(node.elements.size == 1 && node.elements.first.name == "mn") or return
|
211
207
|
repl = node.at("./m:mn", MATHML).children
|
212
|
-
|
213
|
-
#node.parent.replace(repl)
|
214
|
-
#else
|
215
|
-
node.replace(repl)
|
216
|
-
#end
|
208
|
+
node.replace(repl)
|
217
209
|
end
|
218
210
|
end
|
219
211
|
end
|
@@ -5,7 +5,7 @@ module IsoDoc
|
|
5
5
|
sem_xml_descendant?(x) and next
|
6
6
|
tag = x.name
|
7
7
|
y = Nokogiri::XML::Node.new("fmt-#{tag}", x.document)
|
8
|
-
x.attributes.
|
8
|
+
x.attributes.keys.reject { |a| a == "id" }.each { |a| y[a] = x[a] }
|
9
9
|
n = semx_fmt_dup(x) # semx/fmt-xref for ease of processing
|
10
10
|
n.children.each { |c| y << c }
|
11
11
|
n << y
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative "presentation_function/block"
|
2
|
+
require_relative "presentation_function/list"
|
2
3
|
require_relative "presentation_function/reqt"
|
3
4
|
require_relative "presentation_function/concepts"
|
4
5
|
require_relative "presentation_function/terms"
|
@@ -21,16 +22,26 @@ module IsoDoc
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def convert1(docxml, filename, dir)
|
25
|
+
presxml_convert_init(docxml, filename, dir)
|
26
|
+
conversions(docxml)
|
27
|
+
docxml.root["type"] = "presentation"
|
28
|
+
repeat_id_validate(docxml.root)
|
29
|
+
idref_validate(docxml.root)
|
30
|
+
docxml.to_xml.gsub("<", "<").gsub(">", ">")
|
31
|
+
end
|
32
|
+
|
33
|
+
def counter_init
|
34
|
+
@counter = IsoDoc::XrefGen::Counter.new(0, {})
|
35
|
+
end
|
36
|
+
|
37
|
+
def presxml_convert_init(docxml, filename, dir)
|
24
38
|
@outputdir = dir
|
25
39
|
@outputfile = Pathname.new(filename).basename.to_s
|
26
40
|
docid_prefixes(docxml) # feeds @xrefs.parse citation processing
|
27
41
|
@xrefs.parse docxml
|
28
42
|
@xrefs.klass.meta = @meta
|
29
43
|
@xrefs.klass.info docxml, nil
|
30
|
-
|
31
|
-
docxml.root["type"] = "presentation"
|
32
|
-
repeat_id_validate(docxml.root)
|
33
|
-
docxml.to_xml.gsub("<", "<").gsub(">", ">")
|
44
|
+
counter_init
|
34
45
|
end
|
35
46
|
|
36
47
|
def repeat_id_validate1(elem)
|
@@ -50,6 +61,33 @@ module IsoDoc
|
|
50
61
|
end
|
51
62
|
end
|
52
63
|
|
64
|
+
IDREF =
|
65
|
+
[%w(review from), %w(review to), %w(index to), %w(xref target),
|
66
|
+
%w(callout target), %w(eref bibitemid), %w(citation bibitemid),
|
67
|
+
%w(admonition target), %w(label for), %w(semx source),
|
68
|
+
%w(fmt-title source), %w(fmt-xref-label container), %w(fn target),
|
69
|
+
%w(fmt-fn-body target), %w(fmt-review-start source),
|
70
|
+
%w(fmt-review-start end), %w(fmt-review-start target),
|
71
|
+
%w(fmt-review-end source), %w(fmt-review-end start),
|
72
|
+
%w(fmt-review-end target)].freeze
|
73
|
+
|
74
|
+
def idref_validate(doc)
|
75
|
+
@log or return
|
76
|
+
IDREF.each do |e|
|
77
|
+
doc.xpath("//xmlns:#{e[0]}[@#{e[1]}]").each do |x|
|
78
|
+
idref_validate1(x, e[1])
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def idref_validate1(node, attr)
|
84
|
+
node[attr].strip.empty? and return
|
85
|
+
@doc_ids[node[attr]] and return
|
86
|
+
@log.add("Anchors", node,
|
87
|
+
"Anchor #{node[attr]} pointed to by #{node.name} " \
|
88
|
+
"is not defined in the document", severity: 1)
|
89
|
+
end
|
90
|
+
|
53
91
|
def bibitem_lookup(docxml)
|
54
92
|
@bibitem_lookup ||= docxml.xpath(ns("//references/bibitem"))
|
55
93
|
.each_with_object({}) do |b, m|
|
@@ -58,7 +96,6 @@ module IsoDoc
|
|
58
96
|
end
|
59
97
|
|
60
98
|
def conversions(docxml)
|
61
|
-
# semantic_xml_insert(docxml)
|
62
99
|
metadata docxml
|
63
100
|
bibdata docxml
|
64
101
|
@xrefs.parse docxml
|
data/lib/isodoc/version.rb
CHANGED
@@ -11,15 +11,6 @@ module IsoDoc
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
# KILL
|
15
|
-
def review_note_parsex(node, out)
|
16
|
-
fn = @comments.length + 1
|
17
|
-
make_comment_link(out, fn, node)
|
18
|
-
@in_comment = true
|
19
|
-
@comments << make_comment_text(node, fn)
|
20
|
-
@in_comment = false
|
21
|
-
end
|
22
|
-
|
23
14
|
def comment_link_attrs(fnote, node)
|
24
15
|
{ style: "MsoCommentReference", target: fnote,
|
25
16
|
class: "commentLink", from: node["source"],
|
@@ -51,17 +42,6 @@ module IsoDoc
|
|
51
42
|
end
|
52
43
|
end
|
53
44
|
|
54
|
-
# KILL
|
55
|
-
def make_comment_text(node, fnote)
|
56
|
-
noko do |xml|
|
57
|
-
xml.div style: "mso-element:comment", id: fnote do |div|
|
58
|
-
div.span style: %{mso-comment-author:"#{node['reviewer']}"}
|
59
|
-
make_comment_target(div)
|
60
|
-
node.children.each { |n| parse(n, div) }
|
61
|
-
end
|
62
|
-
end.join("\n")
|
63
|
-
end
|
64
|
-
|
65
45
|
def fmt_review_body_parse(node, out)
|
66
46
|
out.div style: "mso-element:comment", id: node["id"] do |div|
|
67
47
|
div.span style: %{mso-comment-author:"#{node['reviewer']}"}
|
@@ -96,14 +96,12 @@ module IsoDoc
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
def
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
106
|
-
node.children.each { |n| parse(n, li) }
|
99
|
+
def li_checkbox(node)
|
100
|
+
if node["uncheckedcheckbox"] == "true"
|
101
|
+
'<span class="zzMoveToFollowing">☐ </span>'
|
102
|
+
elsif node["checkedcheckbox"] == "true"
|
103
|
+
'<span class="zzMoveToFollowing">☑ </span>'
|
104
|
+
else ""
|
107
105
|
end
|
108
106
|
end
|
109
107
|
end
|
@@ -172,23 +172,6 @@ module IsoDoc
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
# KILL
|
176
|
-
def word_footnote_formatx(docxml)
|
177
|
-
# the content is in a[@epub:type = 'footnote']//sup, but in Word,
|
178
|
-
# we need to inject content around the autonumbered footnote reference
|
179
|
-
docxml.xpath("//a[@epub:type = 'footnote']").each do |x|
|
180
|
-
footnote_reference_format(x)
|
181
|
-
end
|
182
|
-
docxml.xpath("//span[@class = 'MsoFootnoteReference']").each do |x|
|
183
|
-
footnote_reference_format(x)
|
184
|
-
end
|
185
|
-
docxml.xpath("//a[@class = 'TableFootnoteRef'] | " \
|
186
|
-
"//span[@class = 'TableFootnoteRef']").each do |x|
|
187
|
-
table_footnote_reference_format(x)
|
188
|
-
end
|
189
|
-
docxml
|
190
|
-
end
|
191
|
-
|
192
175
|
# move p.h1 (floating title) after any page, section breaks
|
193
176
|
def word_floating_titles(docxml)
|
194
177
|
docxml.xpath("//p[@class = 'section-break' or @class = 'page-break']")
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module IsoDoc
|
2
|
+
module XrefGen
|
3
|
+
module OlTypeProvider
|
4
|
+
def ol_type(list, depth)
|
5
|
+
return list["type"].to_sym if list["type"]
|
6
|
+
return :arabic if [2, 7].include? depth
|
7
|
+
return :alphabet if [1, 6].include? depth
|
8
|
+
return :alphabet_upper if [4, 9].include? depth
|
9
|
+
return :roman if [3, 8].include? depth
|
10
|
+
return :roman_upper if [5, 10].include? depth
|
11
|
+
|
12
|
+
:arabic
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "roman-numerals"
|
2
2
|
require "twitter_cldr"
|
3
|
+
require_relative "ol_type_provider"
|
3
4
|
|
4
5
|
module IsoDoc
|
5
6
|
module XrefGen
|
@@ -16,6 +17,7 @@ module IsoDoc
|
|
16
17
|
end
|
17
18
|
|
18
19
|
class Counter
|
20
|
+
include OlTypeProvider
|
19
21
|
attr_accessor :prefix_override
|
20
22
|
|
21
23
|
def initialize(num = 0, opts = { numerals: :arabic })
|
@@ -172,17 +174,6 @@ module IsoDoc
|
|
172
174
|
"#{prefix}#{@base}#{out}#{@letter_override || @letter}"
|
173
175
|
end
|
174
176
|
|
175
|
-
def ol_type(list, depth)
|
176
|
-
return list["type"].to_sym if list["type"]
|
177
|
-
return :arabic if [2, 7].include? depth
|
178
|
-
return :alphabet if [1, 6].include? depth
|
179
|
-
return :alphabet_upper if [4, 9].include? depth
|
180
|
-
return :roman if [3, 8].include? depth
|
181
|
-
return :roman_upper if [5, 10].include? depth
|
182
|
-
|
183
|
-
:arabic
|
184
|
-
end
|
185
|
-
|
186
177
|
def listlabel(list, depth)
|
187
178
|
case ol_type(list, depth)
|
188
179
|
when :arabic then @num.to_s
|
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.1.
|
4
|
+
version: 3.1.5
|
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-
|
11
|
+
date: 2025-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -443,6 +443,7 @@ files:
|
|
443
443
|
- lib/isodoc/presentation_function/image.rb
|
444
444
|
- lib/isodoc/presentation_function/index.rb
|
445
445
|
- lib/isodoc/presentation_function/inline.rb
|
446
|
+
- lib/isodoc/presentation_function/list.rb
|
446
447
|
- lib/isodoc/presentation_function/math.rb
|
447
448
|
- lib/isodoc/presentation_function/metadata.rb
|
448
449
|
- lib/isodoc/presentation_function/refs.rb
|
@@ -469,6 +470,7 @@ files:
|
|
469
470
|
- lib/isodoc/word_function/table.rb
|
470
471
|
- lib/isodoc/xref.rb
|
471
472
|
- lib/isodoc/xref/clause_order.rb
|
473
|
+
- lib/isodoc/xref/ol_type_provider.rb
|
472
474
|
- lib/isodoc/xref/xref_anchor.rb
|
473
475
|
- lib/isodoc/xref/xref_counter.rb
|
474
476
|
- lib/isodoc/xref/xref_counter_types.rb
|