isodoc 3.7.6 → 3.7.8
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cdda29c5e2ec54e77bb977a7f736b5cd215e3d54dfccf06213a0cb620bd111a7
|
|
4
|
+
data.tar.gz: 94ca91d475ff5554300c74d15fcb0a68a08166728103d52e688e931f030f67bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a1d38eab37a9aa533e94adc24e75414927376b65d9c0acca578c4009f688c4508abf5c4589f5352605087f45edb5c35af459f2b47868d5729caf4d029a1c754
|
|
7
|
+
data.tar.gz: 2c19a2c45d35869b011beaa785ea5938c338a6a06acceb66a1b6378bfad2edc9dcf47ca1cf259b601790f584d351cb5058c16fa3b506c991ba6c78efb3d7adcd
|
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"
|
|
@@ -136,6 +136,8 @@ module IsoDoc
|
|
|
136
136
|
# detect whether string which may contain XML markup is empty
|
|
137
137
|
def empty_xml?(str)
|
|
138
138
|
str.blank? and return true
|
|
139
|
+
# plain text (no markup, no entity refs): emptiness is just whitespace
|
|
140
|
+
!str.include?("<") && !str.include?("&") and return str.strip.empty?
|
|
139
141
|
x = Nokogiri::XML::DocumentFragment.parse(str)
|
|
140
142
|
x.to_str.strip.empty?
|
|
141
143
|
end
|
|
@@ -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.8
|
|
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
|