metanorma 1.6.3 → 1.6.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/collection_fileparse.rb +14 -7
- data/lib/metanorma/collection_manifest.rb +1 -1
- data/lib/metanorma/collection_render_utils.rb +13 -13
- data/lib/metanorma/collection_renderer.rb +15 -7
- data/lib/metanorma/files_lookup.rb +12 -61
- data/lib/metanorma/files_lookup_sectionsplit.rb +69 -0
- data/lib/metanorma/processor.rb +7 -1
- data/lib/metanorma/sectionsplit.rb +6 -5
- data/lib/metanorma/sectionsplit_links.rb +5 -5
- data/lib/metanorma/util.rb +5 -1
- data/lib/metanorma/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4bbd3fdfd37664da0a7f9e91cbecfcb0f7cdd49c004cf75eaa122c366ea6fba
|
4
|
+
data.tar.gz: 6b61241e1010ed465995c23447b4828503495d8f4fb2366e64babe0ae6d0726e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc05aa1c9d8aec0e6d45b537e10a130f88e715116f0dd92820e73588ff5a6542a7f2f92099e504654d2ed21e4e95c4bd84c0b260e24f923720b38ae298455f33
|
7
|
+
data.tar.gz: 870e182c05914d484180fd19360bfe1010cb9b57ed926926d76ba6cde3d9f2adbf2cb98e5d7e44702f2024cd51b52347524b9fb0ac28c0463d01b3d1dfc9d7b6
|
@@ -58,10 +58,10 @@ module Metanorma
|
|
58
58
|
update_indirect_refs_to_docs(docxml, internal_refs)
|
59
59
|
ids = @files.get(identifier, :ids)
|
60
60
|
@files.add_document_suffix(identifier, docxml)
|
61
|
-
svgmap_resolve(datauri_encode(docxml), ids)
|
62
61
|
update_direct_refs_to_docs(docxml, identifier)
|
63
62
|
hide_refs(docxml)
|
64
63
|
@files.get(identifier, :sectionsplit_output) and eref2link(docxml)
|
64
|
+
svgmap_resolve(datauri_encode(docxml), ids)
|
65
65
|
docxml.to_xml
|
66
66
|
end
|
67
67
|
|
@@ -98,12 +98,12 @@ module Metanorma
|
|
98
98
|
svgmap_resolve1(e, isodoc, docxml, ids)
|
99
99
|
end
|
100
100
|
Metanorma::Utils::svgmap_rewrite(docxml, "")
|
101
|
+
docxml.xpath(ns("//svgmap")).each { |s| isodoc.svgmap_extract(s) }
|
101
102
|
end
|
102
103
|
|
103
104
|
def svgmap_resolve1(eref, isodoc, _docxml, ids)
|
104
|
-
href = isodoc.eref_target(eref)
|
105
|
+
href = isodoc.eref_target(eref) or return
|
105
106
|
return if href == "##{eref['bibitemid']}" ||
|
106
|
-
# (href =~ /^#/ && !docxml.at("//*[@id = '#{href.sub(/^#/, '')}']"))
|
107
107
|
(href =~ /^#/ && !ids[href.sub(/^#/, "")])
|
108
108
|
|
109
109
|
eref["target"] = href.strip
|
@@ -119,15 +119,24 @@ module Metanorma
|
|
119
119
|
def update_direct_refs_to_docs(docxml, identifier)
|
120
120
|
@ncnames = {}
|
121
121
|
erefs = Util::gather_citeases(docxml)
|
122
|
+
erefs1 = Util::gather_bibitemids(docxml)
|
122
123
|
docxml.xpath(ns("//bibitem")).each do |b|
|
123
|
-
docid = b.at(ns("./docidentifier[@type = 'repository']"))
|
124
|
-
|
124
|
+
docid = b.at(ns("./docidentifier[@type = 'repository']")) or next
|
125
|
+
unless %r{^current-metanorma-collection/}.match(docid.text)
|
126
|
+
erefs1[b["id"]]&.each { |x| strip_eref(x) }
|
127
|
+
next
|
128
|
+
end
|
125
129
|
update_bibitem(b, identifier)
|
126
130
|
docid = docid_to_citeas(b) or next
|
127
131
|
erefs[docid] and update_anchors(b, docid, erefs[docid])
|
128
132
|
end
|
129
133
|
end
|
130
134
|
|
135
|
+
def strip_eref(eref)
|
136
|
+
eref.xpath(ns("./locality | ./localityStack")).each(&:remove)
|
137
|
+
eref.replace(eref.children)
|
138
|
+
end
|
139
|
+
|
131
140
|
def docid_to_citeas(bib)
|
132
141
|
docid = bib.at(ns("./docidentifier[@primary = 'true']")) ||
|
133
142
|
bib.at(ns("./docidentifier")) or return
|
@@ -157,7 +166,6 @@ module Metanorma
|
|
157
166
|
|
158
167
|
def update_indirect_refs_to_docs1(_docxml, key, file, bibitems, erefs)
|
159
168
|
erefs[key]&.each do |e|
|
160
|
-
# docxml.xpath(ns("//eref[@bibitemid = '#{key}']")).each do |e|
|
161
169
|
e["citeas"] = file
|
162
170
|
a = e.at(ns(".//locality[@type = 'anchor']/referenceFrom")) and
|
163
171
|
a.children = "#{a.text}_#{Metanorma::Utils::to_ncname(file)}"
|
@@ -172,7 +180,6 @@ module Metanorma
|
|
172
180
|
# update crossrefences to other documents, to include
|
173
181
|
# disambiguating document suffix on id
|
174
182
|
def update_anchors(bib, docid, erefs)
|
175
|
-
#docxml.xpath("//xmlns:eref[@citeas = '#{docid}']").each do |e|
|
176
183
|
erefs.each do |e|
|
177
184
|
if @files.get(docid) then update_anchor_loc(bib, e, docid)
|
178
185
|
else
|
@@ -118,7 +118,7 @@ module Metanorma
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def docref_to_xml_attrs(elem, docref)
|
121
|
-
elem[:fileref] = @disambig.
|
121
|
+
elem[:fileref] = @disambig.strip_root(docref["fileref"])
|
122
122
|
%i(attachment sectionsplit).each do |i|
|
123
123
|
elem[i] = docref[i.to_s] if docref[i.to_s]
|
124
124
|
end
|
@@ -81,25 +81,25 @@ module Metanorma
|
|
81
81
|
isodoc
|
82
82
|
end
|
83
83
|
|
84
|
+
# create the @meta class of isodoc, for populating Liquid,
|
85
|
+
# with "navigation" set to the index bar.
|
86
|
+
# extracted from the manifest
|
84
87
|
def isodoc_populate
|
85
|
-
# create the @meta class of isodoc, for populating Liquid,
|
86
|
-
# with "navigation" set to the index bar.
|
87
|
-
# extracted from the manifest
|
88
|
-
@isodoc.meta.set(:navigation, indexfile(@xml.at(ns("//manifest"))))
|
89
|
-
@isodoc.meta.set(:docrefs, liquid_docrefs)
|
90
|
-
@isodoc.meta.set(:"prefatory-content",
|
91
|
-
isodoc_builder(@isodoc,
|
92
|
-
@xml.at(ns("//prefatory-content"))))
|
93
|
-
@isodoc.meta.set(:"final-content",
|
94
|
-
isodoc_builder(isodoc,
|
95
|
-
@xml.at(ns("//final-content"))))
|
96
88
|
@isodoc.info(@xml, nil)
|
89
|
+
m = @xml.at(ns("//manifest"))
|
90
|
+
{ navigation: indexfile(m), nav_object: index_object(m),
|
91
|
+
docrefs: liquid_docrefs,
|
92
|
+
"prefatory-content": isodoc_builder(@xml.at(ns("//prefatory-content"))),
|
93
|
+
"final-content": isodoc_builder(@xml.at(ns("//final-content"))),
|
94
|
+
doctitle: m.at(ns("../bibdata/title"))&.text,
|
95
|
+
docnumber: m.at(ns("../bibdata/docidentifier"))&.text
|
96
|
+
}.each { |k, v| v and @isodoc.meta.set(k, v) }
|
97
97
|
end
|
98
98
|
|
99
|
-
def isodoc_builder(
|
99
|
+
def isodoc_builder(node)
|
100
100
|
Nokogiri::HTML::Builder.new(encoding: "UTF-8") do |b|
|
101
101
|
b.div do |div|
|
102
|
-
node&.children&.each { |n| isodoc.parse(n, div) }
|
102
|
+
node&.children&.each { |n| @isodoc.parse(n, div) }
|
103
103
|
end
|
104
104
|
end.doc.root.to_html
|
105
105
|
end
|
@@ -132,9 +132,7 @@ module Metanorma
|
|
132
132
|
# @param elm [Nokogiri::XML::Element]
|
133
133
|
# @return [String]
|
134
134
|
def indexfile_title(elm)
|
135
|
-
|
136
|
-
lbl = elm.at(ns("./title"))&.text
|
137
|
-
"#{lvl}#{lvl && lbl ? ': ' : ''}#{lbl}"
|
135
|
+
elm.at(ns("./title"))&.text
|
138
136
|
end
|
139
137
|
|
140
138
|
# uses the identifier to label documents; other attributes (title) can be
|
@@ -172,10 +170,6 @@ module Metanorma
|
|
172
170
|
end
|
173
171
|
|
174
172
|
# single level navigation list, with hierarchical nesting
|
175
|
-
# if multiple lists are needed as separate HTML fragments, multiple
|
176
|
-
# instances of this function will be needed,
|
177
|
-
# and associated to different variables in the call to @isodoc.metadata_init
|
178
|
-
# (including possibly an array of HTML fragments)
|
179
173
|
#
|
180
174
|
# @param elm [Nokogiri::XML::Element]
|
181
175
|
# @return [String] XML
|
@@ -191,6 +185,20 @@ module Metanorma
|
|
191
185
|
end.doc.root.to_html
|
192
186
|
end
|
193
187
|
|
188
|
+
# object to construct navigation out of in Liquid
|
189
|
+
def index_object(elm)
|
190
|
+
c = elm.xpath(ns("./manifest")).each_with_object([]) do |d, b|
|
191
|
+
b << index_object(d)
|
192
|
+
end
|
193
|
+
c.empty? and c = nil
|
194
|
+
r = Nokogiri::HTML::Builder.new do |b|
|
195
|
+
indexfile_docref(elm, b)
|
196
|
+
end
|
197
|
+
r &&= r.doc.root&.to_html&.gsub("\n", " ")
|
198
|
+
{ title: indexfile_title(elm),
|
199
|
+
docrefs: r, children: c }.compact
|
200
|
+
end
|
201
|
+
|
194
202
|
def liquid_docrefs
|
195
203
|
@xml.xpath(ns("//docref[@index = 'true']")).each_with_object([]) do |d, m|
|
196
204
|
ident = d.at(ns("./identifier")).children.to_xml
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require "htmlentities"
|
3
3
|
require "metanorma-utils"
|
4
|
+
require_relative "files_lookup_sectionsplit"
|
4
5
|
|
5
6
|
module Metanorma
|
6
7
|
# XML collection renderer
|
@@ -25,6 +26,7 @@ module Metanorma
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def read_files
|
29
|
+
@disambig = Util::DisambigFiles.new
|
28
30
|
@xml.xpath(ns("//docref")).each { |d| read_file(d) }
|
29
31
|
end
|
30
32
|
|
@@ -58,79 +60,28 @@ module Metanorma
|
|
58
60
|
entry[:bibitem].at("./*[local-name() = 'ext']")&.remove
|
59
61
|
end
|
60
62
|
|
61
|
-
def add_section_split
|
62
|
-
ret = @files.keys.each_with_object({}) do |k, m|
|
63
|
-
if @files[k][:sectionsplit] == "true" && !@files[k]["attachment"]
|
64
|
-
s, manifest = sectionsplit(@files[k][:ref], k)
|
65
|
-
s.each_with_index { |f1, i| add_section_split_instance(f1, m, k, i) }
|
66
|
-
m["#{k}:index.html"] = add_section_split_cover(manifest, k)
|
67
|
-
@files_to_delete << m["#{k}:index.html"][:ref]
|
68
|
-
end
|
69
|
-
m[k] = @files[k]
|
70
|
-
end
|
71
|
-
@files = ret
|
72
|
-
end
|
73
|
-
|
74
|
-
def add_section_split_cover(manifest, ident)
|
75
|
-
cover = @sectionsplit.section_split_cover(manifest,
|
76
|
-
@parent.dir_name_cleanse(ident))
|
77
|
-
@files[ident][:out_path] = cover
|
78
|
-
{ attachment: true, index: false, out_path: cover,
|
79
|
-
ref: File.join(File.dirname(manifest.file), cover) }
|
80
|
-
end
|
81
|
-
|
82
|
-
def add_section_split_instance(file, manifest, key, idx)
|
83
|
-
presfile, newkey, xml =
|
84
|
-
add_section_split_instance_prep(file, key)
|
85
|
-
manifest[newkey] =
|
86
|
-
{ parentid: key, presentationxml: true, type: "fileref",
|
87
|
-
rel_path: file[:url], out_path: File.basename(file[:url]),
|
88
|
-
anchors: read_anchors(xml), ids: read_ids(xml),
|
89
|
-
sectionsplit_output: true,
|
90
|
-
bibdata: @files[key][:bibdata], ref: presfile }
|
91
|
-
@files_to_delete << file[:url]
|
92
|
-
manifest[newkey][:bare] = true unless idx.zero?
|
93
|
-
end
|
94
|
-
|
95
|
-
def add_section_split_instance_prep(file, key)
|
96
|
-
presfile = File.join(File.dirname(@files[key][:ref]),
|
97
|
-
File.basename(file[:url]))
|
98
|
-
newkey = key("#{key.strip} #{file[:title]}")
|
99
|
-
xml = Nokogiri::XML(File.read(presfile), &:huge)
|
100
|
-
[presfile, newkey, xml]
|
101
|
-
end
|
102
|
-
|
103
|
-
def sectionsplit(file, ident)
|
104
|
-
@sectionsplit =
|
105
|
-
Sectionsplit.new(input: file, base: File.basename(file), dir: File.dirname(file),
|
106
|
-
output: file, compile_options: @parent.compile_options,
|
107
|
-
fileslookup: self, ident: ident, isodoc: @isodoc)
|
108
|
-
coll = @sectionsplit.sectionsplit.sort_by { |f| f[:order] }
|
109
|
-
# s = @compile.sectionsplit(file, File.basename(file), File.dirname(file),
|
110
|
-
# @parent.compile_options, self, ident)
|
111
|
-
# .sort_by { |f| f[:order] }
|
112
|
-
# xml = Nokogiri::XML(File.read(file, encoding: "UTF-8")) { |x| x.huge }
|
113
|
-
xml = Nokogiri::XML(File.read(file, encoding: "UTF-8"), &:huge)
|
114
|
-
[coll, @sectionsplit
|
115
|
-
.collection_manifest(File.basename(file), coll, xml, nil,
|
116
|
-
File.dirname(file))]
|
117
|
-
end
|
118
|
-
|
119
63
|
# rel_path is the source file address, determined relative to the YAML.
|
120
64
|
# out_path is the destination file address, with any references outside
|
121
65
|
# the working directory (../../...) truncated
|
122
66
|
# identifier is the id with only spaces, no nbsp
|
123
67
|
def file_entry(ref, identifier)
|
124
68
|
out = ref["attachment"] ? ref["fileref"] : File.basename(ref["fileref"])
|
69
|
+
out1 = @disambig.source2dest_filename(out)
|
125
70
|
ret = if ref["fileref"]
|
126
71
|
{ type: "fileref", ref: @documents[identifier].file,
|
127
|
-
rel_path: ref["fileref"],
|
128
|
-
|
72
|
+
rel_path: ref["fileref"],
|
73
|
+
out_path: out1 } # @disambig.source2dest_filename(out) }
|
74
|
+
else { type: "id", ref: ref["id"] }
|
75
|
+
end
|
76
|
+
file_entry_copy(ref, ret)
|
77
|
+
ret.compact
|
78
|
+
end
|
79
|
+
|
80
|
+
def file_entry_copy(ref, ret)
|
129
81
|
%w(attachment sectionsplit index presentation-xml
|
130
82
|
bare-after-first).each do |s|
|
131
83
|
ret[s.gsub("-", "").to_sym] = ref[s] if ref[s]
|
132
84
|
end
|
133
|
-
ret.compact
|
134
85
|
end
|
135
86
|
|
136
87
|
def add_suffix_to_attributes(doc, suffix, tag_name, attribute_name)
|
@@ -0,0 +1,69 @@
|
|
1
|
+
module Metanorma
|
2
|
+
# XML collection renderer
|
3
|
+
class FileLookup
|
4
|
+
def add_section_split
|
5
|
+
ret = @files.keys.each_with_object({}) do |k, m|
|
6
|
+
if @files[k][:sectionsplit] == "true" && !@files[k]["attachment"]
|
7
|
+
s, manifest = sectionsplit(@files[k][:ref], @files[k][:out_path], k)
|
8
|
+
s.each_with_index { |f1, i| add_section_split_instance(f1, m, k, i) }
|
9
|
+
m["#{k}:index.html"] = add_section_split_cover(manifest, k)
|
10
|
+
@files_to_delete << m["#{k}:index.html"][:ref]
|
11
|
+
end
|
12
|
+
m[k] = @files[k]
|
13
|
+
end
|
14
|
+
@files = ret
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_section_split_cover(manifest, ident)
|
18
|
+
cover = @sectionsplit
|
19
|
+
.section_split_cover(manifest, @parent.dir_name_cleanse(ident),
|
20
|
+
one_doc_collection?)
|
21
|
+
@files[ident][:out_path] = cover
|
22
|
+
{ attachment: true, index: false, out_path: cover,
|
23
|
+
ref: File.join(File.dirname(manifest.file), cover) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def one_doc_collection?
|
27
|
+
docs = 0
|
28
|
+
@files.each_value do |v|
|
29
|
+
v[:attachment] and next
|
30
|
+
v[:presentationxml] and next
|
31
|
+
docs += 1
|
32
|
+
end
|
33
|
+
docs > 1
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_section_split_instance(file, manifest, key, idx)
|
37
|
+
presfile, newkey, xml =
|
38
|
+
add_section_split_instance_prep(file, key)
|
39
|
+
manifest[newkey] =
|
40
|
+
{ parentid: key, presentationxml: true, type: "fileref",
|
41
|
+
rel_path: file[:url], out_path: File.basename(file[:url]),
|
42
|
+
anchors: read_anchors(xml), ids: read_ids(xml),
|
43
|
+
sectionsplit_output: true,
|
44
|
+
bibdata: @files[key][:bibdata], ref: presfile }
|
45
|
+
@files_to_delete << file[:url]
|
46
|
+
manifest[newkey][:bare] = true unless idx.zero?
|
47
|
+
end
|
48
|
+
|
49
|
+
def add_section_split_instance_prep(file, key)
|
50
|
+
presfile = File.join(File.dirname(@files[key][:ref]),
|
51
|
+
File.basename(file[:url]))
|
52
|
+
newkey = key("#{key.strip} #{file[:title]}")
|
53
|
+
xml = Nokogiri::XML(File.read(presfile), &:huge)
|
54
|
+
[presfile, newkey, xml]
|
55
|
+
end
|
56
|
+
|
57
|
+
def sectionsplit(file, outfile, ident)
|
58
|
+
@sectionsplit = Sectionsplit
|
59
|
+
.new(input: file, base: outfile, dir: File.dirname(file),
|
60
|
+
output: outfile, compile_options: @parent.compile_options,
|
61
|
+
fileslookup: self, ident: ident, isodoc: @isodoc)
|
62
|
+
coll = @sectionsplit.sectionsplit.sort_by { |f| f[:order] }
|
63
|
+
xml = Nokogiri::XML(File.read(file, encoding: "UTF-8"), &:huge)
|
64
|
+
[coll, @sectionsplit
|
65
|
+
.collection_manifest(File.basename(file), coll, xml, nil,
|
66
|
+
File.dirname(file))]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/metanorma/processor.rb
CHANGED
@@ -18,7 +18,8 @@ module Metanorma
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def input_to_isodoc(file, filename, options = {})
|
21
|
-
Metanorma::Input::Asciidoc.new.process(file, filename,
|
21
|
+
Metanorma::Input::Asciidoc.new.process(file, filename,
|
22
|
+
@asciidoctor_backend, options)
|
22
23
|
end
|
23
24
|
|
24
25
|
# def input_to_isodoc(file, filename)
|
@@ -33,12 +34,17 @@ module Metanorma
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
|
37
|
+
def options_preprocess(options)
|
38
|
+
options[:output_formats] = output_formats
|
39
|
+
end
|
40
|
+
|
36
41
|
def output(isodoc_node, _inname, outname, _format, _options = {})
|
37
42
|
File.open(outname, "w:UTF-8") { |f| f.write(isodoc_node) }
|
38
43
|
end
|
39
44
|
|
40
45
|
def extract_options(file)
|
41
46
|
Metanorma::Input::Asciidoc.new.extract_options(file)
|
47
|
+
.merge(output_formats: output_formats)
|
42
48
|
end
|
43
49
|
|
44
50
|
def extract_metanorma_options(file)
|
@@ -109,7 +109,8 @@ module Metanorma
|
|
109
109
|
type = xml.root.name.sub("-standard", "").to_sym
|
110
110
|
@fileslookup&.parent&.update_xrefs(xml, @ident, {})
|
111
111
|
xml1 = Tempfile.open([filename, ".xml"], encoding: "utf-8") do |f|
|
112
|
-
f.write(@isodoc.to_xml(svg_preprocess(xml)))
|
112
|
+
#f.write(@isodoc.to_xml(svg_preprocess(xml)))
|
113
|
+
f.write(@isodoc.to_xml((xml)))
|
113
114
|
f
|
114
115
|
end
|
115
116
|
@filecache ||= []
|
@@ -184,17 +185,17 @@ module Metanorma
|
|
184
185
|
Util::recursive_string_keys(ret).to_yaml
|
185
186
|
end
|
186
187
|
|
187
|
-
def section_split_cover(col, ident)
|
188
|
+
def section_split_cover(col, ident, one_doc_coll)
|
188
189
|
dir = File.dirname(col.file)
|
189
190
|
collection_setup(nil, dir)
|
190
191
|
CollectionRenderer.new(col, dir,
|
191
192
|
output_folder: "#{ident}_collection",
|
192
193
|
format: %i(html),
|
193
194
|
coverpage: File.join(dir, "cover.html")).coverpage
|
194
|
-
|
195
|
-
|
195
|
+
filename = one_doc_coll ? "#{ident}_index.html" : "index.html"
|
196
|
+
FileUtils.mv "#{ident}_collection/index.html", File.join(dir, filename)
|
196
197
|
FileUtils.rm_rf "#{ident}_collection"
|
197
|
-
|
198
|
+
filename
|
198
199
|
end
|
199
200
|
end
|
200
201
|
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module Metanorma
|
2
2
|
class Sectionsplit
|
3
|
-
def xref_preprocess(xml,
|
3
|
+
def xref_preprocess(xml, _fileslookup, _identifier)
|
4
4
|
key = (0...8).map { rand(65..90).chr }.join # random string
|
5
5
|
xml.root["type"] = key # to force recognition of internal refs
|
6
6
|
key
|
7
7
|
end
|
8
8
|
|
9
9
|
def xref_process(section, xml, key)
|
10
|
+
svg_preprocess(section, Metanorma::Utils::to_ncname(@ident))
|
10
11
|
refs = eref_to_internal_eref(section, xml, key)
|
11
12
|
refs += xref_to_internal_eref(section, key)
|
12
13
|
ins = new_hidden_ref(section)
|
@@ -14,15 +15,14 @@ module Metanorma
|
|
14
15
|
insert_indirect_biblio(ins, refs - copied_refs, key)
|
15
16
|
end
|
16
17
|
|
17
|
-
def svg_preprocess(xml)
|
18
|
+
def svg_preprocess(xml, document_suffix)
|
18
19
|
xml.xpath("//m:svg", "m" => "http://www.w3.org/2000/svg").each do |s|
|
19
20
|
m = svgmap_wrap(s)
|
20
21
|
s.xpath(".//m:a", "m" => "http://www.w3.org/2000/svg").each do |a|
|
21
|
-
|
22
|
-
|
22
|
+
/^#/.match? a["href"] or next
|
23
23
|
a["href"] = a["href"].sub(/^#/, "")
|
24
24
|
m << "<target href='#{a['href']}'>" \
|
25
|
-
"<xref target='#{a['href']}'/></target>"
|
25
|
+
"<xref target='#{a['href']}_#{document_suffix}'/></target>"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
xml
|
data/lib/metanorma/util.rb
CHANGED
@@ -65,8 +65,12 @@ module Metanorma
|
|
65
65
|
@seen_filenames = []
|
66
66
|
end
|
67
67
|
|
68
|
+
def strip_root(name)
|
69
|
+
name.sub(%r{^(\./)?(\.\./)+}, "")
|
70
|
+
end
|
71
|
+
|
68
72
|
def source2dest_filename(name, disambig = true)
|
69
|
-
n = name
|
73
|
+
n = strip_root(name)
|
70
74
|
dir = File.dirname(n)
|
71
75
|
base = File.basename(n)
|
72
76
|
if disambig && @seen_filenames.include?(base)
|
data/lib/metanorma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.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: 2023-
|
11
|
+
date: 2023-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -269,6 +269,7 @@ files:
|
|
269
269
|
- lib/metanorma/document.rb
|
270
270
|
- lib/metanorma/extract.rb
|
271
271
|
- lib/metanorma/files_lookup.rb
|
272
|
+
- lib/metanorma/files_lookup_sectionsplit.rb
|
272
273
|
- lib/metanorma/fontist_utils.rb
|
273
274
|
- lib/metanorma/input.rb
|
274
275
|
- lib/metanorma/input/asciidoc.rb
|