isodoc 3.1.3 → 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 +5 -3
- data/lib/isodoc/base_style/all.css +7 -0
- data/lib/isodoc/base_style/reset.css +7 -0
- data/lib/isodoc/base_style/reset.scss +4 -0
- data/lib/isodoc/function/blocks.rb +3 -3
- data/lib/isodoc/function/cleanup.rb +0 -10
- data/lib/isodoc/function/footnotes.rb +9 -3
- data/lib/isodoc/function/inline.rb +26 -11
- data/lib/isodoc/function/lists.rb +20 -10
- data/lib/isodoc/function/table.rb +8 -3
- data/lib/isodoc/function/to_word_html.rb +4 -1
- data/lib/isodoc/headlesshtml_convert.rb +0 -2
- data/lib/isodoc/html_convert.rb +0 -2
- data/lib/isodoc/html_function/html.rb +7 -0
- data/lib/isodoc/html_function/postprocess_footnotes.rb +0 -15
- data/lib/isodoc/init.rb +1 -0
- data/lib/isodoc/pdf_convert.rb +0 -2
- data/lib/isodoc/presentation_function/block.rb +0 -47
- data/lib/isodoc/presentation_function/footnotes.rb +72 -3
- data/lib/isodoc/presentation_function/image.rb +6 -2
- 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 +54 -28
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +1 -26
- data/lib/isodoc/word_function/comments.rb +51 -30
- data/lib/isodoc/word_function/footnotes.rb +26 -30
- data/lib/isodoc/word_function/lists.rb +6 -8
- data/lib/isodoc/word_function/postprocess.rb +0 -17
- data/lib/isodoc/word_function/table.rb +1 -0
- data/lib/isodoc/xref/ol_type_provider.rb +16 -0
- data/lib/isodoc/xref/xref_counter.rb +2 -11
- metadata +6 -33
- data/lib/isodoc/html_function/comments.rb +0 -142
@@ -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,34 +22,71 @@ 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)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
48
|
+
if @doc_ids[elem["id"]]
|
49
|
+
@log.add("Anchors", elem,
|
50
|
+
"Anchor #{elem['id']} has already been " \
|
51
|
+
"used at line #{@doc_ids[elem['id']]}", severity: 0)
|
52
|
+
end
|
53
|
+
@doc_ids[elem["id"]] = elem.line
|
54
|
+
end
|
55
|
+
|
56
|
+
def repeat_id_validate(doc)
|
57
|
+
@log or return
|
58
|
+
@doc_ids = {}
|
59
|
+
doc.xpath("//*[@id]").each do |x|
|
60
|
+
repeat_id_validate1(x)
|
43
61
|
end
|
62
|
+
end
|
44
63
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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])
|
50
79
|
end
|
51
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
|
52
90
|
|
53
91
|
def bibitem_lookup(docxml)
|
54
92
|
@bibitem_lookup ||= docxml.xpath(ns("//references/bibitem"))
|
@@ -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
|
@@ -88,6 +125,7 @@ module IsoDoc
|
|
88
125
|
toc docxml
|
89
126
|
display_order docxml # feeds document_footnotes
|
90
127
|
document_footnotes docxml
|
128
|
+
comments docxml
|
91
129
|
end
|
92
130
|
|
93
131
|
def block(docxml)
|
@@ -117,7 +155,6 @@ module IsoDoc
|
|
117
155
|
xref docxml
|
118
156
|
eref docxml # feeds eref2link
|
119
157
|
origin docxml # feeds eref2link
|
120
|
-
#quotesource docxml # feeds eref2link
|
121
158
|
concept docxml
|
122
159
|
eref2link docxml
|
123
160
|
mathml docxml
|
@@ -136,21 +173,10 @@ module IsoDoc
|
|
136
173
|
termdefinition docxml
|
137
174
|
designation docxml
|
138
175
|
termsource docxml
|
139
|
-
#concept docxml
|
140
176
|
related docxml
|
141
177
|
termcleanup docxml
|
142
178
|
end
|
143
179
|
|
144
|
-
# KILL
|
145
|
-
def semantic_xml_insert(xml)
|
146
|
-
@semantic_xml_insert or return
|
147
|
-
embed = embedable_semantic_xml(xml)
|
148
|
-
ins = metanorma_extension_insert_pt(xml)
|
149
|
-
ins = ins.at(ns("./metanorma")) || ins.add_child("<metanorma/>").first
|
150
|
-
ins = ins.add_child("<source/>").first
|
151
|
-
ins << embed
|
152
|
-
end
|
153
|
-
|
154
180
|
def metanorma_extension_insert_pt(xml)
|
155
181
|
xml.at(ns("//metanorma-extension")) ||
|
156
182
|
xml.at(ns("//bibdata"))&.after("<metanorma-extension/>")
|
data/lib/isodoc/version.rb
CHANGED
@@ -52,7 +52,7 @@ module IsoDoc
|
|
52
52
|
body.div class: "WordSection3" do |div3|
|
53
53
|
content(div3, docxml, ns(self.class::MAIN_ELEMENTS))
|
54
54
|
footnotes docxml, div3
|
55
|
-
comments div3
|
55
|
+
comments docxml, div3
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -79,31 +79,6 @@ module IsoDoc
|
|
79
79
|
node.xpath(ns("./note")).each { |n| parse(n, out) }
|
80
80
|
end
|
81
81
|
|
82
|
-
# KILL
|
83
|
-
def figure_get_or_make_dlx(node)
|
84
|
-
dl = node.at(".//table[@class = 'dl']")
|
85
|
-
if dl.nil?
|
86
|
-
node.add_child("<p><b>#{@i18n.key}</b></p><table class='dl'></table>")
|
87
|
-
dl = node.at(".//table[@class = 'dl']")
|
88
|
-
end
|
89
|
-
dl
|
90
|
-
end
|
91
|
-
|
92
|
-
# get rid of footnote link, it is in diagram
|
93
|
-
# KILL
|
94
|
-
def figure_aside_processx(fig, aside, key)
|
95
|
-
fig.at("./a[@class='TableFootnoteRef']")&.remove
|
96
|
-
fnref = fig.at(".//span[@class='TableFootnoteRef']/..")
|
97
|
-
tr = key.add_child("<tr></tr>").first
|
98
|
-
dt = tr.add_child("<td valign='top' align='left'></td>").first
|
99
|
-
dd = tr.add_child("<td valign='top'></td>").first
|
100
|
-
fnref.parent = dt
|
101
|
-
aside.xpath(".//p").each do |a|
|
102
|
-
a.delete("class")
|
103
|
-
a.parent = dd
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
82
|
def note_p_class
|
108
83
|
"Note"
|
109
84
|
end
|
@@ -1,28 +1,27 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module WordFunction
|
3
3
|
module Comments
|
4
|
-
def comments(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@
|
4
|
+
def comments(docxml, out)
|
5
|
+
c = docxml.xpath(ns("//fmt-review-body"))
|
6
|
+
c.empty? and return
|
7
|
+
out.div style: "mso-element:comment-list" do |div|
|
8
|
+
@in_comment = true
|
9
|
+
c.each { |fn| parse(fn, div) }
|
10
|
+
@in_comment = false
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
|
-
def review_note_parse(node, out)
|
13
|
-
fn = @comments.length + 1
|
14
|
-
make_comment_link(out, fn, node)
|
15
|
-
@in_comment = true
|
16
|
-
@comments << make_comment_text(node, fn)
|
17
|
-
@in_comment = false
|
18
|
-
end
|
19
|
-
|
20
14
|
def comment_link_attrs(fnote, node)
|
21
15
|
{ style: "MsoCommentReference", target: fnote,
|
22
|
-
class: "commentLink", from: node["
|
23
|
-
to: node["
|
16
|
+
class: "commentLink", from: node["source"],
|
17
|
+
to: node["end"] }
|
18
|
+
end
|
19
|
+
|
20
|
+
def fmt_review_start_parse(node, out)
|
21
|
+
make_comment_link(out, node["target"], node)
|
24
22
|
end
|
25
23
|
|
24
|
+
# TODO: CONSOLIDATE
|
26
25
|
# add in from and to links to move the comment into place
|
27
26
|
def make_comment_link(out, fnote, node)
|
28
27
|
out.span(**comment_link_attrs(fnote, node)) do |s1|
|
@@ -43,22 +42,46 @@ module IsoDoc
|
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
46
|
-
def
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
end
|
53
|
-
end.join("\n")
|
45
|
+
def fmt_review_body_parse(node, out)
|
46
|
+
out.div style: "mso-element:comment", id: node["id"] do |div|
|
47
|
+
div.span style: %{mso-comment-author:"#{node['reviewer']}"}
|
48
|
+
make_comment_target(div)
|
49
|
+
node.children.each { |n| parse(n, div) }
|
50
|
+
end
|
54
51
|
end
|
55
52
|
|
56
53
|
def comment_cleanup(docxml)
|
54
|
+
number_comments(docxml)
|
57
55
|
move_comment_link_to_from(docxml)
|
58
56
|
reorder_comments_by_comment_link(docxml)
|
59
57
|
embed_comment_in_comment_list(docxml)
|
60
58
|
end
|
61
59
|
|
60
|
+
def number_comments(docxml)
|
61
|
+
map = comment_id_to_number(docxml)
|
62
|
+
docxml.xpath("//span[@style='MsoCommentReference' or " \
|
63
|
+
"'mso-special-character:comment']").each do |x|
|
64
|
+
x["target"] &&= map[x["target"]]
|
65
|
+
end
|
66
|
+
docxml.xpath("//div[@style='mso-element:comment']").each do |x|
|
67
|
+
x["id"] = map[x["id"]]
|
68
|
+
end
|
69
|
+
docxml.xpath("//a[@style]").each do |x|
|
70
|
+
m = /mso-comment-reference:SMC_([^;]+);/.match(x["style"]) or next
|
71
|
+
x["style"] = x["style"].sub(/mso-comment-reference:SMC_#{m[1]}/,
|
72
|
+
"mso-comment-reference:SMC_#{map[m[1]]}")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def comment_id_to_number(docxml)
|
77
|
+
ids = docxml.xpath("//span[@style='MsoCommentReference']").map do |x|
|
78
|
+
x["target"]
|
79
|
+
end
|
80
|
+
ids.uniq.each_with_index.with_object({}) do |(id, i), m|
|
81
|
+
m[id] = i + 1
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
62
85
|
COMMENT_IN_COMMENT_LIST1 =
|
63
86
|
'//div[@style="mso-element:comment-list"]//' \
|
64
87
|
'span[@style="MsoCommentReference"]'.freeze
|
@@ -123,14 +146,12 @@ module IsoDoc
|
|
123
146
|
end
|
124
147
|
|
125
148
|
def get_comments_from_text(docxml, link_order)
|
126
|
-
comments = []
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
comments << { text: c.remove.to_s, id: c["id"] }
|
149
|
+
comments = docxml.xpath("//div[@style='mso-element:comment']")
|
150
|
+
.each_with_object([]) do |c, m|
|
151
|
+
c["id"] && !link_order[c["id"]].nil? or next
|
152
|
+
m << { text: c.remove.to_s, id: c["id"] }
|
131
153
|
end
|
132
|
-
comments.sort
|
133
|
-
# comments
|
154
|
+
comments.sort { |a, b| link_order[a[:id]] <=> link_order[b[:id]] }
|
134
155
|
end
|
135
156
|
|
136
157
|
COMMENT_TARGET_XREFS1 =
|
@@ -22,16 +22,18 @@ module IsoDoc
|
|
22
22
|
node.at(ns(".//fmt-fn-label"))&.remove
|
23
23
|
aside = node.parent.name == "fmt-footnote-container"
|
24
24
|
tag = aside ? "aside" : "div"
|
25
|
-
|
25
|
+
id = node["is_table"] ? node["reference"] : node["id"]
|
26
|
+
out.send tag, id: "ftn#{id}" do |div|
|
26
27
|
node.children.each { |n| parse(n, div) }
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
31
|
# dupe to HTML
|
31
|
-
|
32
|
-
|
32
|
+
def get_table_ancestor_id(node)
|
33
|
+
table = node.ancestors("table")
|
33
34
|
table.empty? and table = node.ancestors("figure")
|
34
|
-
table.empty? and return [nil,
|
35
|
+
table.empty? and return [nil,
|
36
|
+
UUIDTools::UUID.random_create.to_s]
|
35
37
|
[table.last, table.last["id"]]
|
36
38
|
end
|
37
39
|
|
@@ -42,30 +44,17 @@ module IsoDoc
|
|
42
44
|
make_table_footnote_link(out, tid + fn, node.at(ns("./fmt-fn-label")))
|
43
45
|
# do not output footnote text if we have already seen it for this table
|
44
46
|
return if @seen_footnote.include?(tid + fn)
|
47
|
+
|
45
48
|
update_table_fn_body_ref(node, table, tid + fn)
|
46
49
|
@seen_footnote << (tid + fn)
|
47
50
|
end
|
48
51
|
|
49
|
-
# TODO merge with HTML
|
50
|
-
def update_table_fn_body_ref(fnote, table, reference)
|
51
|
-
fnbody = table.at(ns(".//fmt-fn-body[@id = '#{fnote['target']}']")) or return
|
52
|
-
fnbody["reference"] = reference
|
53
|
-
sup = fnbody.at(ns(".//fmt-fn-label/sup")) and sup.replace(sup.children)
|
54
|
-
fnbody.xpath(ns(".//fmt-fn-label")).each do |s|
|
55
|
-
s["class"] = "TableFootnoteRef"
|
56
|
-
s.name = "span"
|
57
|
-
d = s.at(ns("./span[@class = 'fmt-caption-delim']")) and
|
58
|
-
s.next = d
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
52
|
def seen_footnote_parse(node, out, footnote)
|
63
53
|
f = node.at(ns("./fmt-fn-label"))
|
64
54
|
sup = f.at(ns(".//sup")) and sup.replace(sup.children)
|
65
55
|
s = f.at(ns(".//semx[@source = '#{node['id']}']"))
|
66
|
-
|
67
56
|
semx = <<~SPAN.strip
|
68
|
-
<span style="mso-element:field-begin"/> NOTEREF _Ref#{@fn_bookmarks[footnote]} \\f \\h<span style="mso-element:field-separator"/>#{footnote}<span style="mso-element:field-end"/>
|
57
|
+
<span style="mso-element:field-begin"/> NOTEREF _Ref#{@fn_bookmarks[footnote]} \\f \\h<span style="mso-element:field-separator"/>#{footnote}<span style="mso-element:field-end"/>
|
69
58
|
SPAN
|
70
59
|
s.replace(semx)
|
71
60
|
out.span class: "MsoFootnoteReference" do |fn|
|
@@ -74,29 +63,36 @@ module IsoDoc
|
|
74
63
|
end
|
75
64
|
|
76
65
|
def footnote_parse(node, out)
|
77
|
-
return table_footnote_parse(node, out)
|
78
|
-
|
79
|
-
|
80
|
-
fn = node["reference"] || UUIDTools::UUID.random_create.to_s
|
81
|
-
return seen_footnote_parse(node, out, fn) if @seen_footnote.include?(fn)
|
82
|
-
|
66
|
+
table_footnote?(node) and return table_footnote_parse(node, out)
|
67
|
+
fn = node["reference"] # || UUIDTools::UUID.random_create.to_s
|
68
|
+
@seen_footnote.include?(fn) and return seen_footnote_parse(node, out, fn)
|
83
69
|
@fn_bookmarks[fn] = bookmarkid
|
70
|
+
f = footnote_label_process(node)
|
71
|
+
out.span style: "mso-bookmark:_Ref#{@fn_bookmarks[fn]}",
|
72
|
+
class: "MsoFootnoteReference" do |s|
|
73
|
+
children_parse(f, s)
|
74
|
+
end
|
75
|
+
footnote_hyperlink(node, out)
|
76
|
+
@seen_footnote << fn
|
77
|
+
end
|
78
|
+
|
79
|
+
def footnote_label_process(node)
|
84
80
|
f = node.at(ns("./fmt-fn-label"))
|
85
81
|
sup = f.at(ns(".//sup")) and sup.replace(sup.children)
|
86
82
|
if semx = f.at(ns(".//semx[@element = 'autonum']"))
|
87
83
|
semx.name = "span"
|
88
84
|
semx["class"] = "FMT-PLACEHOLDER"
|
89
85
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
86
|
+
f
|
87
|
+
end
|
88
|
+
|
89
|
+
def footnote_hyperlink(node, out)
|
93
90
|
if semx = out.parent.at(".//span[@class = 'FMT-PLACEHOLDER']")
|
94
91
|
semx.name = "a"
|
95
92
|
semx["class"] = "FootnoteRef"
|
96
93
|
semx["epub:type"] = "footnote"
|
97
|
-
semx["href"] = "#ftn#{
|
94
|
+
semx["href"] = "#ftn#{node['target']}"
|
98
95
|
end
|
99
|
-
@seen_footnote << fn
|
100
96
|
end
|
101
97
|
end
|
102
98
|
end
|
@@ -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']")
|
@@ -23,6 +23,7 @@ module IsoDoc
|
|
23
23
|
|
24
24
|
def make_tr_attr(cell, row, totalrows, header, bordered)
|
25
25
|
style = cell.name == "th" ? "font-weight:bold;" : ""
|
26
|
+
cell["style"] and style += "#{cell['style']};"
|
26
27
|
rowmax = cell["rowspan"] ? row + cell["rowspan"].to_i - 1 : row
|
27
28
|
style += make_tr_attr_style(cell, row, rowmax, totalrows,
|
28
29
|
{ header: header, bordered: bordered })
|
@@ -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
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.9.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.9.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mn2pdf
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.5.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: nokogiri
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "<="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.16.8
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "<="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.16.8
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: relaton-render
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,20 +164,6 @@ dependencies:
|
|
178
164
|
- - ">="
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: lutaml-model
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - "~>"
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: 0.6.0
|
188
|
-
type: :runtime
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - "~>"
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: 0.6.0
|
195
167
|
- !ruby/object:Gem::Dependency
|
196
168
|
name: bigdecimal
|
197
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -449,7 +421,6 @@ files:
|
|
449
421
|
- lib/isodoc/headlesshtml_convert.rb
|
450
422
|
- lib/isodoc/html_convert.rb
|
451
423
|
- lib/isodoc/html_function.rb
|
452
|
-
- lib/isodoc/html_function/comments.rb
|
453
424
|
- lib/isodoc/html_function/form.rb
|
454
425
|
- lib/isodoc/html_function/html.rb
|
455
426
|
- lib/isodoc/html_function/mathvariant_to_plain.rb
|
@@ -472,6 +443,7 @@ files:
|
|
472
443
|
- lib/isodoc/presentation_function/image.rb
|
473
444
|
- lib/isodoc/presentation_function/index.rb
|
474
445
|
- lib/isodoc/presentation_function/inline.rb
|
446
|
+
- lib/isodoc/presentation_function/list.rb
|
475
447
|
- lib/isodoc/presentation_function/math.rb
|
476
448
|
- lib/isodoc/presentation_function/metadata.rb
|
477
449
|
- lib/isodoc/presentation_function/refs.rb
|
@@ -498,6 +470,7 @@ files:
|
|
498
470
|
- lib/isodoc/word_function/table.rb
|
499
471
|
- lib/isodoc/xref.rb
|
500
472
|
- lib/isodoc/xref/clause_order.rb
|
473
|
+
- lib/isodoc/xref/ol_type_provider.rb
|
501
474
|
- lib/isodoc/xref/xref_anchor.rb
|
502
475
|
- lib/isodoc/xref/xref_counter.rb
|
503
476
|
- lib/isodoc/xref/xref_counter_types.rb
|