metanorma-standoc 3.5.3 → 3.5.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/lib/metanorma/cleanup/attachment.rb +1 -1
- data/lib/metanorma/converter/base.rb +10 -0
- data/lib/metanorma/converter/blocks.rb +1 -1
- data/lib/metanorma/converter/front_organisation.rb +35 -1
- data/lib/metanorma/converter/log.rb +4 -0
- data/lib/metanorma/converter/macros_form.rb +3 -3
- data/lib/metanorma/converter/macros_inline.rb +2 -2
- data/lib/metanorma/converter/ref.rb +1 -1
- data/lib/metanorma/converter/ref_utility.rb +1 -1
- data/lib/metanorma/converter/utils.rb +3 -3
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +5 -4
- metadata +9 -23
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c01913608379133f785a90f97b5243aa916581376cfb82f1e246506b7e1aad0
|
|
4
|
+
data.tar.gz: dfad852e2e0d35842e4da63195ea5c9d5bfcb1f0ab4a9757a49c29a1c0e71a3c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ddcac2bdad2e3f4496f3f80f9c7260fce0253087c9461bf733f0e6d901754b4933324e7931a3be329c500664fdbcd59d533db225572c077eacf4b62877d25e1d
|
|
7
|
+
data.tar.gz: c554a0010874b71a0c7fb48abd958dd919b4c789c12c362b001e4ee09668bb5eeee67681f3dad09386ccdbff4b2ff85b528569c76eb46794713f6d718fa1a355
|
|
@@ -26,7 +26,7 @@ module Metanorma
|
|
|
26
26
|
init_attachments
|
|
27
27
|
f = File.basename(path)
|
|
28
28
|
File.exist?(File.join(@attachmentsdir, f)) and
|
|
29
|
-
f += "_#{
|
|
29
|
+
f += "_#{Metanorma::Utils.random_uuid}"
|
|
30
30
|
out_fld = File.join(@attachmentsdir, f)
|
|
31
31
|
FileUtils.cp(path, out_fld)
|
|
32
32
|
datauri_attachment(out_fld, bib.document)
|
|
@@ -46,6 +46,7 @@ module Metanorma
|
|
|
46
46
|
def document1(node)
|
|
47
47
|
init(node)
|
|
48
48
|
ret = to_xml(makexml(node))
|
|
49
|
+
release_lutaml_caches
|
|
49
50
|
outputs(node, ret) unless node.attr("nodoc") || !node.attr("docfile")
|
|
50
51
|
ret
|
|
51
52
|
end
|
|
@@ -66,6 +67,15 @@ module Metanorma
|
|
|
66
67
|
OPEN_TITLE_NAME = %r{(<(title|name))}.freeze
|
|
67
68
|
SOURCECODE_NAME = %r{(<sourcecode[^<>]*+>)\s++(<name[^<>]*+>(?>.*?</name>))\s++}m.freeze
|
|
68
69
|
|
|
70
|
+
# The lutaml plugin's macro caches hold fully parsed multi-GB XMI
|
|
71
|
+
# trees that serve only macro rendering during conversion; release
|
|
72
|
+
# them before the output phases stack their own document DOMs.
|
|
73
|
+
def release_lutaml_caches
|
|
74
|
+
return unless defined?(Metanorma::Plugin::Lutaml::CacheRegistry)
|
|
75
|
+
|
|
76
|
+
Metanorma::Plugin::Lutaml::CacheRegistry.clear_all
|
|
77
|
+
end
|
|
78
|
+
|
|
69
79
|
def insert_xml_cr(doc)
|
|
70
80
|
doc.gsub!(CLOSE_TAG, "\\1\n")
|
|
71
81
|
doc.gsub!(OPEN_TITLE_NAME, "\n\\1")
|
|
@@ -8,7 +8,7 @@ module Metanorma
|
|
|
8
8
|
module Blocks
|
|
9
9
|
def id_attr(node = nil)
|
|
10
10
|
anchor = node&.id
|
|
11
|
-
{ id: "_#{
|
|
11
|
+
{ id: "_#{Metanorma::Utils.random_uuid}",
|
|
12
12
|
anchor: anchor && !anchor.empty? ? anchor : nil,
|
|
13
13
|
tag: node&.attr("tag"), columns: node&.attr("columns"),
|
|
14
14
|
"multilingual-rendering": node&.attr("multilingual-rendering") }
|
|
@@ -135,10 +135,44 @@ module Metanorma
|
|
|
135
135
|
else
|
|
136
136
|
organization(xml, org[:name], node, !node.attr("publisher"), org)
|
|
137
137
|
org_address(org, xml)
|
|
138
|
-
org_logo(xml, org[:logo])
|
|
138
|
+
org_logo(xml, org[:logo] || authoritative_org_logo(node, org))
|
|
139
139
|
end
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
+
# Authoritative sourcing of copublisher logos
|
|
143
|
+
# (https://github.com/metanorma/metanorma/issues/346 ,
|
|
144
|
+
# https://github.com/metanorma/metanorma/issues/582 ): when the document
|
|
145
|
+
# attributes provide no logo for an organization, take it from the
|
|
146
|
+
# Relaton SDO logo store, embedded as a data URI. This is enabled by the
|
|
147
|
+
# `:sdo-logos:` document attribute, applies to copublishers only (the
|
|
148
|
+
# document's own default publisher is branded by the flavor, not the
|
|
149
|
+
# SDO store), and is best effort: an organization the store does not
|
|
150
|
+
# know, a store entry without logos, or an unreachable store leaves the
|
|
151
|
+
# logo out, and never fails the compile.
|
|
152
|
+
def authoritative_org_logo(node, org)
|
|
153
|
+
node.attr("sdo-logos") or return
|
|
154
|
+
abbr = org_name_and_abbrev(org, org[:name])[1].to_s.strip
|
|
155
|
+
abbr.empty? and return
|
|
156
|
+
own_publisher?(org, abbr) and return
|
|
157
|
+
logo = sdo_org_logo(abbr)
|
|
158
|
+
logo.nil? and return
|
|
159
|
+
logo.data_uri
|
|
160
|
+
rescue StandardError => e
|
|
161
|
+
@log.add("STANDOC_66", nil, params: [abbr, e.message])
|
|
162
|
+
nil
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def own_publisher?(org, abbr)
|
|
166
|
+
d = default_publisher
|
|
167
|
+
!d.nil? && (org[:name] == d || abbr == d)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def sdo_org_logo(abbr)
|
|
171
|
+
store_org = Relaton.organization(abbr) or return
|
|
172
|
+
store_org.logo_query(format: "png").first ||
|
|
173
|
+
store_org.logo_query.first
|
|
174
|
+
end
|
|
175
|
+
|
|
142
176
|
def org_attrs_parse_core(node, opts)
|
|
143
177
|
source = opts[:source]&.detect { |s| node.attr(s) }
|
|
144
178
|
org_attrs_simple_parse(node, opts, source) ||
|
|
@@ -201,6 +201,10 @@ module Metanorma
|
|
|
201
201
|
STANDOC_65: { category: "AsciiDoc Input",
|
|
202
202
|
error: "Unbalanced sourcecode markup: unclosed %s",
|
|
203
203
|
severity: 0 },
|
|
204
|
+
STANDOC_66: { category: "Images",
|
|
205
|
+
error: "Could not fetch the authoritative logo for " \
|
|
206
|
+
"organization %s: %s",
|
|
207
|
+
severity: 2 },
|
|
204
208
|
RELATON_1: { category: "Relaton",
|
|
205
209
|
error: "(Error from Relaton) %s",
|
|
206
210
|
severity: 0 },
|
|
@@ -12,7 +12,7 @@ module Metanorma
|
|
|
12
12
|
m = %w(id name value disabled readonly checked maxlength minlength)
|
|
13
13
|
.map { |a| attr[a] ? " #{map_attr_name(a)}='#{attr[a]}'" : nil }
|
|
14
14
|
.compact
|
|
15
|
-
m << " id='_#{
|
|
15
|
+
m << " id='_#{Metanorma::Utils.random_uuid}'"
|
|
16
16
|
%{<input type='#{target}' #{m.join}/>}
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -41,7 +41,7 @@ module Metanorma
|
|
|
41
41
|
m = %w(id name rows cols value)
|
|
42
42
|
.map { |a| attr[a] ? " #{map_attr_name(a)}='#{attr[a]}'" : nil }
|
|
43
43
|
.compact
|
|
44
|
-
m << " id='_#{
|
|
44
|
+
m << " id='_#{Metanorma::Utils.random_uuid}'"
|
|
45
45
|
%{<textarea #{m.join}/>}
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -59,7 +59,7 @@ module Metanorma
|
|
|
59
59
|
m = %w(id name size disabled multiple value)
|
|
60
60
|
.map { |a| attr[a] ? " #{map_attr_name(a)}='#{attr[a]}'" : nil }
|
|
61
61
|
.compact
|
|
62
|
-
m << " id='_#{
|
|
62
|
+
m << " id='_#{Metanorma::Utils.random_uuid}'"
|
|
63
63
|
out = Asciidoctor::Inline.new(parent, :quoted, attr["text"]).convert
|
|
64
64
|
%{<select #{m.join}>#{out}</select>}
|
|
65
65
|
end
|
|
@@ -65,7 +65,7 @@ module Metanorma
|
|
|
65
65
|
|
|
66
66
|
def process(parent, target, attrs)
|
|
67
67
|
out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
|
|
68
|
-
id = "_#{
|
|
68
|
+
id = "_#{Metanorma::Utils.random_uuid}"
|
|
69
69
|
%{<span id='#{id}' anchor='#{target}'>#{out}</span>}
|
|
70
70
|
end
|
|
71
71
|
end
|
|
@@ -77,7 +77,7 @@ module Metanorma
|
|
|
77
77
|
|
|
78
78
|
def process(parent, target, attrs)
|
|
79
79
|
out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
|
|
80
|
-
id = "_#{
|
|
80
|
+
id = "_#{Metanorma::Utils.random_uuid}"
|
|
81
81
|
%{<span id='#{id}' source='#{target}'>#{out}</span>}
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -145,7 +145,7 @@ module Metanorma
|
|
|
145
145
|
def refitem_render_attrs(match, code)
|
|
146
146
|
attr_code(anchor: match[:anchor], suppress_identifier: code[:dropid],
|
|
147
147
|
amend: code[:amend], hidden: code[:hidden],
|
|
148
|
-
id: "_#{
|
|
148
|
+
id: "_#{Metanorma::Utils.random_uuid}")
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
def refitem_render_formattedref(bibitem, title)
|
|
@@ -198,7 +198,7 @@ module Metanorma
|
|
|
198
198
|
|
|
199
199
|
def ref_attributes(match)
|
|
200
200
|
code = analyse_ref_code(match[:code])
|
|
201
|
-
{ anchor: match[:anchor], id: "_#{
|
|
201
|
+
{ anchor: match[:anchor], id: "_#{Metanorma::Utils.random_uuid}",
|
|
202
202
|
type: "standard",
|
|
203
203
|
suppress_identifier: code[:dropid] || nil }
|
|
204
204
|
end
|
|
@@ -41,11 +41,11 @@ module Metanorma
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def add_id(node)
|
|
44
|
-
node["id"] = "_#{
|
|
44
|
+
node["id"] = "_#{Metanorma::Utils.random_uuid}"
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def add_id_text
|
|
48
|
-
%(id = "_#{
|
|
48
|
+
%(id = "_#{Metanorma::Utils.random_uuid}")
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def csv_split(text, delim = ";", encode: true)
|
|
@@ -162,7 +162,7 @@ module Metanorma
|
|
|
162
162
|
# from that of current doc
|
|
163
163
|
def separate_numbering_footnotes(docxml)
|
|
164
164
|
docxml.xpath("//xmlns:fn").each do |f|
|
|
165
|
-
f["reference"] = "_#{
|
|
165
|
+
f["reference"] = "_#{Metanorma::Utils.random_uuid}_#{f['reference']}"
|
|
166
166
|
end
|
|
167
167
|
docxml
|
|
168
168
|
end
|
data/metanorma-standoc.gemspec
CHANGED
|
@@ -40,8 +40,10 @@ Gem::Specification.new do |spec|
|
|
|
40
40
|
spec.add_dependency "metanorma-plugin-glossarist", "~> 0.5"
|
|
41
41
|
spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.55" # LutamlDataPreprocessor shipped in 0.7.55
|
|
42
42
|
spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
|
|
43
|
-
spec.add_dependency "metanorma-utils", "~> 2.0.
|
|
44
|
-
|
|
43
|
+
spec.add_dependency "metanorma-utils", "~> 2.0.10"
|
|
44
|
+
# moxml 0.6.0 removed the Opal surface (lutaml/moxml#516); owner
|
|
45
|
+
# call to update all to the latest moxml line.
|
|
46
|
+
spec.add_dependency "moxml", "~> 0.6.0"
|
|
45
47
|
spec.add_dependency "leptris", "~> 1.9"
|
|
46
48
|
spec.add_dependency "concurrent-ruby"
|
|
47
49
|
spec.add_dependency "png_conform", "~> 0.1.0"
|
|
@@ -55,9 +57,8 @@ Gem::Specification.new do |spec|
|
|
|
55
57
|
spec.add_dependency "relaton-iev", "~> 2.0"
|
|
56
58
|
spec.add_dependency "svg_conform", "~> 0.2"
|
|
57
59
|
|
|
58
|
-
spec.add_development_dependency "canon" # , "= 0.2.3"
|
|
59
60
|
spec.add_development_dependency "debug"
|
|
60
|
-
spec.add_development_dependency "
|
|
61
|
+
spec.add_development_dependency "canon", "~> 0.3"
|
|
61
62
|
spec.add_development_dependency "guard", "~> 2.14"
|
|
62
63
|
spec.add_development_dependency "guard-rspec", "~> 4.7"
|
|
63
64
|
spec.add_development_dependency "openssl"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-standoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.5.
|
|
4
|
+
version: 3.5.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: 2026-
|
|
11
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -170,28 +170,28 @@ dependencies:
|
|
|
170
170
|
requirements:
|
|
171
171
|
- - "~>"
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version: 2.0.
|
|
173
|
+
version: 2.0.10
|
|
174
174
|
type: :runtime
|
|
175
175
|
prerelease: false
|
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
178
|
- - "~>"
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
|
-
version: 2.0.
|
|
180
|
+
version: 2.0.10
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
182
|
name: moxml
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
185
|
- - "~>"
|
|
186
186
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: 0.
|
|
187
|
+
version: 0.6.0
|
|
188
188
|
type: :runtime
|
|
189
189
|
prerelease: false
|
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
191
191
|
requirements:
|
|
192
192
|
- - "~>"
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
|
-
version: 0.
|
|
194
|
+
version: 0.6.0
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
196
|
name: leptris
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -296,20 +296,6 @@ dependencies:
|
|
|
296
296
|
- - "~>"
|
|
297
297
|
- !ruby/object:Gem::Version
|
|
298
298
|
version: '0.2'
|
|
299
|
-
- !ruby/object:Gem::Dependency
|
|
300
|
-
name: canon
|
|
301
|
-
requirement: !ruby/object:Gem::Requirement
|
|
302
|
-
requirements:
|
|
303
|
-
- - ">="
|
|
304
|
-
- !ruby/object:Gem::Version
|
|
305
|
-
version: '0'
|
|
306
|
-
type: :development
|
|
307
|
-
prerelease: false
|
|
308
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
309
|
-
requirements:
|
|
310
|
-
- - ">="
|
|
311
|
-
- !ruby/object:Gem::Version
|
|
312
|
-
version: '0'
|
|
313
299
|
- !ruby/object:Gem::Dependency
|
|
314
300
|
name: debug
|
|
315
301
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -325,19 +311,19 @@ dependencies:
|
|
|
325
311
|
- !ruby/object:Gem::Version
|
|
326
312
|
version: '0'
|
|
327
313
|
- !ruby/object:Gem::Dependency
|
|
328
|
-
name:
|
|
314
|
+
name: canon
|
|
329
315
|
requirement: !ruby/object:Gem::Requirement
|
|
330
316
|
requirements:
|
|
331
317
|
- - "~>"
|
|
332
318
|
- !ruby/object:Gem::Version
|
|
333
|
-
version: '0.
|
|
319
|
+
version: '0.3'
|
|
334
320
|
type: :development
|
|
335
321
|
prerelease: false
|
|
336
322
|
version_requirements: !ruby/object:Gem::Requirement
|
|
337
323
|
requirements:
|
|
338
324
|
- - "~>"
|
|
339
325
|
- !ruby/object:Gem::Version
|
|
340
|
-
version: '0.
|
|
326
|
+
version: '0.3'
|
|
341
327
|
- !ruby/object:Gem::Dependency
|
|
342
328
|
name: guard
|
|
343
329
|
requirement: !ruby/object:Gem::Requirement
|