isodoc 3.7.5 → 3.7.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/Gemfile +1 -2
- data/lib/isodoc/function/footnotes.rb +3 -3
- data/lib/isodoc/html_function/postprocess.rb +2 -2
- data/lib/isodoc/html_function/postprocess_cover.rb +1 -1
- data/lib/isodoc/presentation_function/autonum.rb +1 -1
- data/lib/isodoc/presentation_function/ids.rb +2 -2
- data/lib/isodoc/presentation_function/refs.rb +1 -1
- data/lib/isodoc/presentation_function/terms.rb +20 -5
- data/lib/isodoc/spec_helpers/canon_html_input_guard.rb +4 -0
- data/lib/isodoc/version.rb +1 -1
- 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: f5e6a59ece60d88c1ec940f5a34612fd4290dcdfb9737528713152c2eb7dbe20
|
|
4
|
+
data.tar.gz: a59beb605f4e93e76be88d82567d96b3c34534479805db7c07b3b3b228a29766
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 858f4a2255c6a3a0fb7150dd6e4c13e81cfc49369e454e89c2bf7b2327d5b61bf1ac8b1075938c4a8b5d00310c4a525d4100287690e9816c3486a7ace5e307e9
|
|
7
|
+
data.tar.gz: 7f900ddbf4c9f128141550d1172e5805f974a91b649a11613b7cc4a52ddf5839a91df107d34d3eea459dadc6720c8f763f8c974c7d4b488dda8a18f1bea81a9e
|
data/Gemfile
CHANGED
|
@@ -5,9 +5,8 @@ source "https://rubygems.org"
|
|
|
5
5
|
git_source(:github) { |repo| "https://github.com/#{repo}" }
|
|
6
6
|
|
|
7
7
|
gem "benchmark"
|
|
8
|
-
gem "canon"
|
|
8
|
+
gem "canon", "~> 0.3"
|
|
9
9
|
gem "debug"
|
|
10
|
-
gem "equivalent-xml", "~> 0.6"
|
|
11
10
|
gem "guard", "~> 2.14"
|
|
12
11
|
gem "guard-rspec", "~> 4.7"
|
|
13
12
|
gem "rake"
|
|
@@ -12,7 +12,7 @@ module IsoDoc
|
|
|
12
12
|
def get_table_ancestor_id(node)
|
|
13
13
|
table = node.ancestors("table")
|
|
14
14
|
table.empty? and table = node.ancestors("figure")
|
|
15
|
-
table.empty? and return [nil,
|
|
15
|
+
table.empty? and return [nil, Metanorma::Utils.random_uuid]
|
|
16
16
|
[table.last, table.last["id"]]
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ module IsoDoc
|
|
|
20
20
|
# do not output footnote text if we have already seen it for this table
|
|
21
21
|
|
|
22
22
|
def table_footnote_parse(node, out)
|
|
23
|
-
fn = node["reference"] ||
|
|
23
|
+
fn = node["reference"] || Metanorma::Utils.random_uuid
|
|
24
24
|
table, tid = get_table_ancestor_id(node)
|
|
25
25
|
make_table_footnote_link(out, tid + fn, node.at(ns("./fmt-fn-label")))
|
|
26
26
|
# do not output footnote text if we have already seen it for this table
|
|
@@ -49,7 +49,7 @@ module IsoDoc
|
|
|
49
49
|
|
|
50
50
|
def footnote_parse(node, out)
|
|
51
51
|
table_footnote?(node) and return table_footnote_parse(node, out)
|
|
52
|
-
fn = node["target"] # ||
|
|
52
|
+
fn = node["target"] # || Metanorma::Utils.random_uuid
|
|
53
53
|
attrs = { class: "FootnoteRef", href: "#fn:#{fn}" }
|
|
54
54
|
f = node.at(ns("./fmt-fn-label"))
|
|
55
55
|
out.a(**attrs) do |a|
|
|
@@ -118,7 +118,7 @@ module IsoDoc
|
|
|
118
118
|
|
|
119
119
|
def move_image1(img)
|
|
120
120
|
suffix = image_suffix(img)
|
|
121
|
-
uuid =
|
|
121
|
+
uuid = Metanorma::Utils.random_uuid
|
|
122
122
|
fname = "#{uuid}.#{suffix}"
|
|
123
123
|
new_full_filename = File.join(tmpimagedir, fname)
|
|
124
124
|
local_filename = image_localfile(img)
|
|
@@ -131,7 +131,7 @@ module IsoDoc
|
|
|
131
131
|
docxml.xpath("//p[@class = 'TermNum'][../#{h}]").each do |p|
|
|
132
132
|
p.name = "h#{h[1].to_i + 1}"
|
|
133
133
|
id = p["id"]
|
|
134
|
-
p["id"] = "_#{
|
|
134
|
+
p["id"] = "_#{Metanorma::Utils.random_uuid}"
|
|
135
135
|
p.wrap("<div id='#{id}'></div>")
|
|
136
136
|
end
|
|
137
137
|
end
|
|
@@ -154,7 +154,7 @@ module IsoDoc
|
|
|
154
154
|
def html_toc_entries_prep(docxml, path)
|
|
155
155
|
docxml.xpath(path.join(" | "))
|
|
156
156
|
.each_with_index.with_object({}) do |(h, i), m|
|
|
157
|
-
h["id"] ||= "_#{
|
|
157
|
+
h["id"] ||= "_#{Metanorma::Utils.random_uuid}"
|
|
158
158
|
m[h["id"]] = i
|
|
159
159
|
end
|
|
160
160
|
end
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
module IsoDoc
|
|
2
2
|
class PresentationXMLConvert < ::IsoDoc::Convert
|
|
3
3
|
def add_id_text
|
|
4
|
-
id = "_#{
|
|
4
|
+
id = "_#{Metanorma::Utils.random_uuid}"
|
|
5
5
|
@new_ids[id] = nil
|
|
6
6
|
%(id="#{id}")
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def add_id(elem)
|
|
10
10
|
elem["id"] and return
|
|
11
|
-
id = "_#{
|
|
11
|
+
id = "_#{Metanorma::Utils.random_uuid}"
|
|
12
12
|
elem["id"] = id
|
|
13
13
|
@new_ids[id] = nil
|
|
14
14
|
end
|
|
@@ -195,7 +195,7 @@ module IsoDoc
|
|
|
195
195
|
ret = ident_fn(bib)
|
|
196
196
|
date_note = bibnote_extract(bib, "Unpublished-Status")
|
|
197
197
|
date_note.empty? and return ret
|
|
198
|
-
id = "_#{
|
|
198
|
+
id = "_#{Metanorma::Utils.random_uuid}"
|
|
199
199
|
@new_ids[id] = nil
|
|
200
200
|
<<~XML
|
|
201
201
|
#{ret}<fn id='#{id}' reference='#{id}'><p>#{date_note.first.content}</p></fn>
|
|
@@ -3,6 +3,23 @@ module IsoDoc
|
|
|
3
3
|
DESIGNATION_ELEMS =
|
|
4
4
|
%w(preferred admitted deprecates related definition source).freeze
|
|
5
5
|
|
|
6
|
+
# Union XPaths: one evaluation per term replaces the original six
|
|
7
|
+
# nested xpath/at pairs (O(terms × designation-elems) XPathContext
|
|
8
|
+
# setups). The removal set (fmt-name/fmt-xref-label under designation
|
|
9
|
+
# elements) and the removal targets (empty fmt-* containers) are
|
|
10
|
+
# disjoint node sets, so evaluating removal after collection preserves
|
|
11
|
+
# the original interleaved order's outcome.
|
|
12
|
+
TERMCLEANUP_REMOVE_XPATH =
|
|
13
|
+
DESIGNATION_ELEMS.flat_map do |w|
|
|
14
|
+
%w(fmt-name fmt-xref-label).map { |n| "./#{w}//#{n}" }
|
|
15
|
+
end.join(" | ").freeze
|
|
16
|
+
|
|
17
|
+
TERMCLEANUP_TARGET_XPATH =
|
|
18
|
+
DESIGNATION_ELEMS.map do |w|
|
|
19
|
+
n = w == "source" ? "fmt-termsource" : "fmt-#{w}"
|
|
20
|
+
".//#{n}"
|
|
21
|
+
end.join(" | ").freeze
|
|
22
|
+
|
|
6
23
|
def target_desgn_elem(name)
|
|
7
24
|
target = "fmt-#{name}"
|
|
8
25
|
name == "source" and target = "fmt-termsource"
|
|
@@ -20,11 +37,9 @@ module IsoDoc
|
|
|
20
37
|
|
|
21
38
|
def termcleanup(docxml)
|
|
22
39
|
docxml.xpath(ns("//term")).each do |t|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
f = t.at(ns(".//#{target}"))
|
|
27
|
-
f&.children&.empty? and f.remove
|
|
40
|
+
t.xpath(ns(TERMCLEANUP_REMOVE_XPATH)).each(&:remove)
|
|
41
|
+
t.xpath(ns(TERMCLEANUP_TARGET_XPATH)).each do |f|
|
|
42
|
+
f.children.empty? and f.remove
|
|
28
43
|
end
|
|
29
44
|
end
|
|
30
45
|
end
|
|
@@ -111,6 +111,10 @@ module IsoDoc
|
|
|
111
111
|
|
|
112
112
|
def wrap_xml_fragment(value)
|
|
113
113
|
return value unless value.is_a?(String)
|
|
114
|
+
# XML declarations are legal only at document start; a fragment
|
|
115
|
+
# carrying one (e.g. `<root/><?xml?>`) blows up the strict wrap
|
|
116
|
+
# parse. A declaration carries no comparison semantics.
|
|
117
|
+
value = value.gsub(/<\?xml[^>]*\?>\s*/, "")
|
|
114
118
|
return value if already_wrapped?(value)
|
|
115
119
|
|
|
116
120
|
wrapped = "<#{XML_FRAG_ROOT}>#{value}</#{XML_FRAG_ROOT}>"
|
data/lib/isodoc/version.rb
CHANGED
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.7.
|
|
4
|
+
version: 3.7.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: 2026-
|
|
11
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|