isodoc 3.2.0 → 3.2.1
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/function/cleanup.rb +3 -3
- data/lib/isodoc/function/table.rb +20 -7
- data/lib/isodoc/function/utils.rb +0 -1
- data/lib/isodoc/html_function/html.rb +4 -1
- data/lib/isodoc/presentation_function/autonum.rb +1 -1
- data/lib/isodoc/presentation_function/ids.rb +3 -9
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/table.rb +5 -4
- metadata +2 -3
- data/lib/nokogiri/xml/node.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1528432b5d869e42077b250498452e276bd3c774dbe55adbb375157c4c61f87
|
4
|
+
data.tar.gz: 16608e9fd9e1d2dd682667db8455bf63737d79e346f689c49c11628519f661e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c230460e11f2d68b5a844629947e8ee4fbdc4b23dd58d0ecbac85b2adaebeedf4fbde0b5eb434e51717449e3835cd202fefe5c7edfe217724cd5b41683e190b
|
7
|
+
data.tar.gz: 98fc8b60f2d0ebeddf9a2040fedba22b592e4af190cb055bb58c88fca0107daecfe9833c7552f76365a532591ea0e007ee6a228bbd41af21e25b9d5b5546871a
|
@@ -105,9 +105,9 @@ module IsoDoc
|
|
105
105
|
table.at(".//tr").xpath("./td | ./th").each do |td|
|
106
106
|
cols += (td["colspan"] ? td["colspan"].to_i : 1)
|
107
107
|
end
|
108
|
-
|
109
|
-
|
110
|
-
tfoot.add_child("<tr><td colspan='#{cols}'
|
108
|
+
table["class"].nil? or # = plain table
|
109
|
+
s = "style='border-top:0pt;border-bottom:#{IsoDoc::Function::Table::SW} 1.5pt;'"
|
110
|
+
tfoot.add_child("<tr><td colspan='#{cols}' #{s}/></tr>")
|
111
111
|
tfoot.xpath(".//td").last
|
112
112
|
end
|
113
113
|
|
@@ -40,16 +40,28 @@ module IsoDoc
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def bordered_table_style(node, klass)
|
44
|
+
bordered = "border-width:1px;border-spacing:0;"
|
45
|
+
(node["plain"] != "true" && (%w(modspec).include?(klass) || !klass)) or
|
46
|
+
bordered = ""
|
47
|
+
bordered
|
48
|
+
end
|
49
|
+
|
43
50
|
def table_attrs(node)
|
44
|
-
width = node["width"] ? "width:#{node['width']};" : nil
|
45
51
|
c = node["class"]
|
46
|
-
|
47
|
-
(%w(modspec).include?(c) || !c) or bordered = ""
|
48
|
-
style = node["style"] ? "" : "#{bordered}#{width}"
|
52
|
+
style = table_attrs_style(node, c)
|
49
53
|
attr_code(id: node["id"],
|
50
|
-
class: c || "MsoISOTable",
|
51
|
-
style:
|
52
|
-
|
54
|
+
class: node["plain"] == "true" ? nil : (c || "MsoISOTable"),
|
55
|
+
style: style, title: node["alt"])
|
56
|
+
end
|
57
|
+
|
58
|
+
def table_attrs_style(node, klass)
|
59
|
+
width = node["width"] ? "width:#{node['width']};" : nil
|
60
|
+
bordered = bordered_table_style(node, klass)
|
61
|
+
style = node["style"] ? "" : "#{bordered}#{width}"
|
62
|
+
style += keep_style(node) || ""
|
63
|
+
style.empty? and style = nil
|
64
|
+
style
|
53
65
|
end
|
54
66
|
|
55
67
|
def tcaption(node, table)
|
@@ -125,6 +137,7 @@ module IsoDoc
|
|
125
137
|
end
|
126
138
|
|
127
139
|
def table_bordered?(node)
|
140
|
+
node.parent.parent["plain"] == "true" and return false
|
128
141
|
c = node.parent.parent["class"]
|
129
142
|
%w(modspec).include?(c) || !c
|
130
143
|
end
|
@@ -96,7 +96,10 @@ module IsoDoc
|
|
96
96
|
|
97
97
|
def table_attrs(node)
|
98
98
|
ret = super
|
99
|
-
node.at(ns("./colgroup"))
|
99
|
+
if node.at(ns("./colgroup"))
|
100
|
+
ret[:style] ||= ""
|
101
|
+
ret[:style] += "table-layout:fixed;"
|
102
|
+
end
|
100
103
|
ret
|
101
104
|
end
|
102
105
|
|
@@ -77,7 +77,6 @@ module IsoDoc
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def provide_ids(docxml)
|
80
|
-
@new_ids = {} # guids assigned within Presentation XML
|
81
80
|
anchor_sanitise(docxml)
|
82
81
|
populate_id(docxml)
|
83
82
|
add_missing_id(docxml)
|
@@ -120,10 +119,12 @@ module IsoDoc
|
|
120
119
|
end
|
121
120
|
|
122
121
|
def add_new_contenthash_id(docxml, ids)
|
122
|
+
suffix = "" # for disambiguation in Metanorma Collections
|
123
|
+
docxml["document_suffix"] and suffix = "_#{docxml['document_suffix']}"
|
123
124
|
%w(original-id id).each do |k|
|
124
125
|
docxml.xpath("//*[@#{k}]").each do |x|
|
125
126
|
ids.has_key?(x[k]) or next
|
126
|
-
new_id = contenthash(x)
|
127
|
+
new_id = Metanorma::Utils::contenthash(x) + suffix
|
127
128
|
ids[x[k]] = new_id
|
128
129
|
x[k] = new_id
|
129
130
|
end
|
@@ -134,17 +135,10 @@ module IsoDoc
|
|
134
135
|
Metanorma::Utils::anchor_attributes(presxml: true).each do |e|
|
135
136
|
docxml.xpath("//xmlns:#{e[0]}[@#{e[1]}]").each do |x|
|
136
137
|
ids.has_key?(x[e[1]]) or next
|
137
|
-
#require "debug"; binding.b unless ids[x[e[1]]]
|
138
138
|
ids[x[e[1]]] or next
|
139
139
|
x[e[1]] = ids[x[e[1]]]
|
140
140
|
end
|
141
141
|
end
|
142
142
|
end
|
143
|
-
|
144
|
-
# TODO duplicate of standoc
|
145
|
-
def contenthash(elem)
|
146
|
-
Digest::MD5.hexdigest("#{elem.path}////#{elem.text}")
|
147
|
-
.sub(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/, "_\\1-\\2-\\3-\\4-\\5")
|
148
|
-
end
|
149
143
|
end
|
150
144
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -15,9 +15,10 @@ module IsoDoc
|
|
15
15
|
table.at(".//tr").xpath("./td | ./th").each do |td|
|
16
16
|
cols += (td["colspan"] ? td["colspan"].to_i : 1)
|
17
17
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
table["plain"] == "true" or
|
19
|
+
s = "style='border-top:0pt;mso-border-top-alt:0pt;" \
|
20
|
+
"border-bottom:#{SW1} 1.5pt;mso-border-bottom-alt:#{SW1} 1.5pt;'"
|
21
|
+
tfoot.add_child("<tr><td colspan='#{cols}' #{s}/></tr>")
|
21
22
|
tfoot.xpath(".//td").last
|
22
23
|
end
|
23
24
|
|
@@ -72,7 +73,7 @@ module IsoDoc
|
|
72
73
|
|
73
74
|
def table_attrs(node)
|
74
75
|
c = node["class"]
|
75
|
-
style = node["style"] ?
|
76
|
+
style = node["style"] || node["plain"] == "true" ? "" : "border-spacing:0;border-width:1px;"
|
76
77
|
(%w(modspec).include?(c) || !c) or style = nil
|
77
78
|
ret =
|
78
79
|
{ summary: node["summary"], width: node["width"],
|
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.1
|
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-07-
|
11
|
+
date: 2025-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|
@@ -488,7 +488,6 @@ files:
|
|
488
488
|
- lib/metanorma/output/base.rb
|
489
489
|
- lib/metanorma/output/utils.rb
|
490
490
|
- lib/metanorma/output/xslfo.rb
|
491
|
-
- lib/nokogiri/xml/node.rb
|
492
491
|
- lib/relaton/render-isodoc/config.yml
|
493
492
|
- lib/relaton/render-isodoc/general.rb
|
494
493
|
homepage: https://github.com/metanorma/isodoc
|