metanorma 2.0.7 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metanorma/collection/collection.rb +8 -3
- data/lib/metanorma/collection/config/bibdata.rb +2 -2
- data/lib/metanorma/collection/config/compile_options.rb +4 -5
- data/lib/metanorma/collection/config/config.rb +42 -73
- data/lib/metanorma/collection/config/converters.rb +27 -1
- data/lib/metanorma/collection/config/directive.rb +9 -3
- data/lib/metanorma/collection/config/manifest.rb +31 -24
- data/lib/metanorma/collection/filelookup/filelookup.rb +4 -4
- data/lib/metanorma/collection/manifest/manifest.rb +1 -1
- data/lib/metanorma/collection/renderer/navigation.rb +1 -1
- data/lib/metanorma/collection/renderer/renderer.rb +2 -1
- data/lib/metanorma/collection/renderer/utils.rb +2 -10
- data/lib/metanorma/collection/sectionsplit/sectionsplit.rb +6 -8
- data/lib/metanorma/collection/util/util.rb +17 -3
- data/lib/metanorma/version.rb +1 -1
- data/metanorma.gemspec +1 -2
- metadata +4 -19
- data/lib/metanorma/shale_monkeypatch.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8023ee9f3e35c8192af2ef0cd4231b635b5efc6e5529fe85acb42a641032b3b0
|
4
|
+
data.tar.gz: 2875b07c0f94091745d83cea071d96bcffe1a77b5f493eda45970bc7ff3c580b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae6f061d8fb94d44671e372d802190d205058073a389534241f7958aafe0a0c49e87e75e46cd205d4c9ea227e5c4610f9f4ca430849c084a2493eacdca8419f
|
7
|
+
data.tar.gz: a7fa6dcb6a2b379bbc3e6b8de6b4d3f300c0b5e01f40dc79fa784a535f6041d29913b4c904adc3a98e7c8d90ba88ff008e4700549b6c5d397242b33a85040092
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require "relaton"
|
4
2
|
require "relaton/cli"
|
5
3
|
require "metanorma-utils"
|
@@ -128,7 +126,14 @@ module Metanorma
|
|
128
126
|
# @return [String] XML
|
129
127
|
def sections(cnt)
|
130
128
|
c = Asciidoctor.convert(cnt, backend: flavor.to_sym, header_footer: true)
|
131
|
-
Nokogiri::XML(c
|
129
|
+
x = Nokogiri::XML(c)
|
130
|
+
x.xpath("//xmlns:clause").each { |n| n["unnumbered"] = true }
|
131
|
+
file = Tempfile.new(%w(foo presentation.xml))
|
132
|
+
file.write(x.to_xml(indent: 0))
|
133
|
+
file.close
|
134
|
+
c1 = Util::isodoc_create(@flavor, @manifest.lang, @manifest.script, x, presxml: true)
|
135
|
+
.convert(file.path, nil, true)
|
136
|
+
Nokogiri::XML(c1).at("//xmlns:sections").children.to_xml
|
132
137
|
end
|
133
138
|
|
134
139
|
# @param builder [Nokogiri::XML::Builder]
|
@@ -1,12 +1,11 @@
|
|
1
|
-
require "
|
1
|
+
require "lutaml/model"
|
2
2
|
|
3
3
|
module Metanorma
|
4
4
|
class Collection
|
5
5
|
module Config
|
6
|
-
class CompileOptions < ::
|
7
|
-
attribute :install_fonts,
|
8
|
-
|
9
|
-
attribute :agree_to_terms, ::Shale::Type::Boolean, default: -> { true }
|
6
|
+
class CompileOptions < ::Lutaml::Model::Serializable
|
7
|
+
attribute :install_fonts, :boolean, default: -> { false }
|
8
|
+
attribute :agree_to_terms, :boolean, default: -> { true }
|
10
9
|
end
|
11
10
|
end
|
12
11
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
require "
|
2
|
-
require_relative "../../shale_monkeypatch"
|
1
|
+
require "lutaml/model"
|
3
2
|
require_relative "../../array_monkeypatch"
|
4
3
|
require_relative "compile_options"
|
5
4
|
require_relative "converters"
|
@@ -11,36 +10,35 @@ module Metanorma
|
|
11
10
|
class Collection
|
12
11
|
module Config
|
13
12
|
require "shale/adapter/nokogiri"
|
14
|
-
::
|
13
|
+
Lutaml::Model::Config.configure do |config|
|
14
|
+
config.xml_adapter = Lutaml::Model::XmlAdapter::NokogiriAdapter
|
15
|
+
end
|
15
16
|
|
16
|
-
class Config < ::
|
17
|
+
class Config < ::Lutaml::Model::Serializable
|
17
18
|
attr_accessor :path, :collection, :from_xml
|
18
19
|
|
19
20
|
attribute :bibdata, Bibdata
|
20
21
|
attribute :directive, Directive, collection: true
|
21
22
|
attribute :manifest, Manifest
|
22
|
-
attribute :
|
23
|
-
|
24
|
-
attribute :output_folder,
|
25
|
-
attribute :coverpage, ::Shale::Type::String, default: -> {
|
26
|
-
"cover.html"
|
27
|
-
}
|
23
|
+
attribute :coverpage, :string, default: -> { "cover.html" }
|
24
|
+
attribute :format, :string, collection: true, default: -> { [:html] }
|
25
|
+
attribute :output_folder, :string
|
28
26
|
attribute :compile, CompileOptions
|
29
|
-
attribute :prefatory_content,
|
30
|
-
attribute :final_content,
|
27
|
+
attribute :prefatory_content, :string, raw: true
|
28
|
+
attribute :final_content, :string, raw: true
|
31
29
|
attribute :documents, Bibdata, collection: true
|
32
|
-
attribute :xmlns,
|
30
|
+
attribute :xmlns, :string, default: -> { "http://metanorma.org" }
|
33
31
|
|
34
32
|
yaml do
|
35
|
-
map "directives",
|
36
|
-
|
37
|
-
map "bibdata",
|
38
|
-
|
33
|
+
map "directives", to: :directive, with: { from: :directives_from_yaml,
|
34
|
+
to: :directives_to_yaml }
|
35
|
+
map "bibdata", to: :bibdata, with: { from: :bibdata_from_yaml,
|
36
|
+
to: :bibdata_to_yaml }
|
39
37
|
map "manifest", to: :manifest
|
40
|
-
map "format", to: :format
|
38
|
+
map "format", to: :format, render_default: true
|
41
39
|
map "output_folder", to: :output_folder
|
42
|
-
map "coverpage", to: :coverpage
|
43
|
-
map "compile", to: :compile
|
40
|
+
map "coverpage", to: :coverpage, render_default: true
|
41
|
+
map "compile", to: :compile, render_default: true
|
44
42
|
map "prefatory-content", to: :prefatory_content
|
45
43
|
map "final-content", to: :final_content
|
46
44
|
end
|
@@ -49,27 +47,31 @@ module Metanorma
|
|
49
47
|
root "metanorma-collection"
|
50
48
|
# namespace "http://metanorma.org", "m"
|
51
49
|
# map_attribute "xmlns", to: :xmlns
|
52
|
-
map_element "bibdata",
|
53
|
-
|
54
|
-
map_element "directive",
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
map_element "format", to: :format
|
50
|
+
map_element "bibdata", to: :bibdata, with: { from: :bibdata_from_xml,
|
51
|
+
to: :bibdata_to_xml }
|
52
|
+
map_element "directive", to: :directive
|
53
|
+
map_element "entry", to: :manifest, with: { from: :manifest_from_xml,
|
54
|
+
to: :manifest_to_xml }
|
55
|
+
map_element "format", to: :format, render_default: true
|
59
56
|
map_element "output_folder", to: :output_folder
|
60
|
-
map_element "coverpage", to: :coverpage
|
61
|
-
map_element "compile", to: :compile
|
62
|
-
map_element "prefatory-content",
|
63
|
-
|
57
|
+
map_element "coverpage", to: :coverpage, render_default: true
|
58
|
+
map_element "compile", to: :compile, render_default: true
|
59
|
+
map_element "prefatory-content",
|
60
|
+
to: :prefatory_content,
|
61
|
+
with: { from: :prefatory_from_xml,
|
62
|
+
to: :prefatory_to_xml }
|
64
63
|
map_element "doc-container",
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
64
|
+
to: :documents,
|
65
|
+
with: { from: :documents_from_xml,
|
66
|
+
to: :documents_to_xml }
|
67
|
+
map_element "final-content",
|
68
|
+
to: :final_content,
|
69
|
+
with: { from: :final_from_xml,
|
70
|
+
to: :final_to_xml }
|
69
71
|
end
|
70
72
|
|
71
73
|
def manifest_from_xml(model, node)
|
72
|
-
model.manifest = Manifest.from_xml(node.to_xml)
|
74
|
+
model.manifest = Manifest.from_xml(node.node.to_xml)
|
73
75
|
end
|
74
76
|
|
75
77
|
def manifest_to_xml(model, parent, doc)
|
@@ -78,7 +80,7 @@ module Metanorma
|
|
78
80
|
end
|
79
81
|
|
80
82
|
def prefatory_from_xml(model, node)
|
81
|
-
model.prefatory_content = node
|
83
|
+
model.prefatory_content = node
|
82
84
|
end
|
83
85
|
|
84
86
|
def prefatory_to_xml(model, parent, doc)
|
@@ -92,7 +94,8 @@ module Metanorma
|
|
92
94
|
def content_to_xml(model, parent, doc, type)
|
93
95
|
x = model.send("#{type}_content") or return
|
94
96
|
n = Nokogiri::XML(x)
|
95
|
-
elem = if n.elements.size == 1
|
97
|
+
elem = if n.elements.size == 1
|
98
|
+
"<#{type}-content>#{x}</#{type}-content>" # n.root
|
96
99
|
else
|
97
100
|
b = Nokogiri::XML::Builder.new
|
98
101
|
model.collection.content_to_xml(type, b)
|
@@ -102,19 +105,7 @@ module Metanorma
|
|
102
105
|
end
|
103
106
|
|
104
107
|
def final_from_xml(model, node)
|
105
|
-
model.final_content = node
|
106
|
-
end
|
107
|
-
|
108
|
-
def directive_from_xml(model, node)
|
109
|
-
model.directive ||= []
|
110
|
-
model.directive << Directive.from_xml(node.to_xml)
|
111
|
-
end
|
112
|
-
|
113
|
-
def directive_to_xml(model, parent, doc)
|
114
|
-
Array(model.directive).each do |e|
|
115
|
-
elem = e.to_xml
|
116
|
-
doc.add_element(parent, elem)
|
117
|
-
end
|
108
|
+
model.final_content = node
|
118
109
|
end
|
119
110
|
|
120
111
|
def directives_from_yaml(model, value)
|
@@ -134,28 +125,6 @@ module Metanorma
|
|
134
125
|
end
|
135
126
|
end
|
136
127
|
|
137
|
-
def documents_from_xml(model, value)
|
138
|
-
x = if value.is_a?(Shale::Adapter::Nokogiri::Node)
|
139
|
-
value.content
|
140
|
-
else Nokogiri::XML(value)
|
141
|
-
end
|
142
|
-
model.documents = x.xpath(".//bibdata")
|
143
|
-
.each_with_object([]) do |b, m|
|
144
|
-
m << Bibdata.from_xml(b.to_xml)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
def documents_to_xml(model, parent, doc)
|
149
|
-
b = Nokogiri::XML::Builder.new do |xml|
|
150
|
-
xml.document do |m|
|
151
|
-
model.collection.doccontainer(m) or return
|
152
|
-
end
|
153
|
-
end
|
154
|
-
b.parent.elements.first.elements.each do |x|
|
155
|
-
doc.add_element(parent, x)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
128
|
include Converters
|
160
129
|
end
|
161
130
|
end
|
@@ -14,7 +14,8 @@ module Metanorma
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def bibdata_from_xml(model, node)
|
17
|
-
|
17
|
+
node and
|
18
|
+
model.bibdata = Relaton::Cli.parse_xml(node.node.adapter_node)
|
18
19
|
end
|
19
20
|
|
20
21
|
def bibdata_to_xml(model, parent, doc)
|
@@ -24,6 +25,31 @@ module Metanorma
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def nop_to_yaml(model, doc); end
|
28
|
+
|
29
|
+
def documents_from_xml(model, value)
|
30
|
+
model.documents = value
|
31
|
+
.each_with_object([]) do |b, m|
|
32
|
+
m << b
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def documents_to_xml(model, parent, doc)
|
37
|
+
documents_to_xml?(doc) or return
|
38
|
+
b = Nokogiri::XML::Builder.new do |xml|
|
39
|
+
xml.document do |m|
|
40
|
+
model.collection.doccontainer(m) or return
|
41
|
+
end
|
42
|
+
end
|
43
|
+
b.parent.elements.first.elements
|
44
|
+
.each { |x| doc.add_element(parent, x) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def documents_to_xml?(doc)
|
48
|
+
ret = doc.parent.elements.detect do |x|
|
49
|
+
x.name == "doc-container"
|
50
|
+
end
|
51
|
+
!ret
|
52
|
+
end
|
27
53
|
end
|
28
54
|
end
|
29
55
|
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
module Metanorma
|
2
2
|
class Collection
|
3
3
|
module Config
|
4
|
-
class Directive < ::
|
5
|
-
attribute :key,
|
6
|
-
attribute :value,
|
4
|
+
class Directive < ::Lutaml::Model::Serializable
|
5
|
+
attribute :key, :string
|
6
|
+
attribute :value, :string
|
7
|
+
|
8
|
+
xml do
|
9
|
+
root "directive"
|
10
|
+
map_element "key", to: :key
|
11
|
+
map_element "value", to: :value
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require "
|
2
|
-
|
1
|
+
require "lutaml/model"
|
2
|
+
require "lutaml/model/xml_adapter/nokogiri_adapter"
|
3
3
|
require_relative "../../array_monkeypatch"
|
4
4
|
require_relative "converters"
|
5
5
|
require_relative "bibdata"
|
@@ -8,38 +8,45 @@ module Metanorma
|
|
8
8
|
class Collection
|
9
9
|
module Config
|
10
10
|
require "shale/adapter/nokogiri"
|
11
|
-
::
|
11
|
+
Lutaml::Model::Config.configure do |config|
|
12
|
+
config.xml_adapter = Lutaml::Model::XmlAdapter::NokogiriAdapter
|
13
|
+
end
|
12
14
|
|
13
|
-
class Manifest < ::
|
14
|
-
attribute :identifier,
|
15
|
-
|
16
|
-
attribute :id,
|
15
|
+
class Manifest < ::Lutaml::Model::Serializable
|
16
|
+
attribute :identifier, :string,
|
17
|
+
default: -> { UUIDTools::UUID.random_create.to_s }
|
18
|
+
attribute :id, :string
|
17
19
|
attribute :bibdata, Bibdata
|
18
|
-
attribute :type,
|
19
|
-
attribute :title,
|
20
|
-
attribute :url,
|
21
|
-
attribute :
|
22
|
-
attribute :
|
23
|
-
attribute :
|
20
|
+
attribute :type, :string
|
21
|
+
attribute :title, :string
|
22
|
+
attribute :url, :string
|
23
|
+
attribute :level, :string
|
24
|
+
attribute :attachment, :boolean
|
25
|
+
attribute :sectionsplit, :boolean
|
26
|
+
attribute :index, :boolean, default: -> { true }
|
24
27
|
attribute :entry, Manifest, collection: true
|
25
|
-
attribute :file,
|
28
|
+
attribute :file, :string
|
26
29
|
|
27
30
|
yaml do
|
28
31
|
map "identifier", to: :identifier
|
29
32
|
map "type", to: :type
|
30
|
-
map "level",
|
33
|
+
map "level", to: :level,
|
34
|
+
with: { from: :level_from_yaml, to: :nop_to_yaml }
|
31
35
|
map "title", to: :title
|
32
36
|
map "url", to: :url
|
33
37
|
map "attachment", to: :attachment
|
34
38
|
map "sectionsplit", to: :sectionsplit
|
35
39
|
map "index", to: :index
|
36
40
|
map "file", to: :file
|
37
|
-
map "fileref",
|
41
|
+
map "fileref", to: :file,
|
42
|
+
with: { from: :fileref_from_yaml, to: :nop_to_yaml }
|
38
43
|
map "entry", to: :entry
|
39
|
-
map "docref",
|
40
|
-
|
41
|
-
map "
|
42
|
-
|
44
|
+
map "docref", to: :entry,
|
45
|
+
with: { from: :docref_from_yaml, to: :nop_to_yaml }
|
46
|
+
map "manifest", to: :entry,
|
47
|
+
with: { from: :docref_from_yaml, to: :nop_to_yaml }
|
48
|
+
map "bibdata", to: :bibdata, with: { from: :bibdata_from_yaml,
|
49
|
+
to: :bibdata_to_yaml }
|
43
50
|
end
|
44
51
|
|
45
52
|
xml do
|
@@ -50,16 +57,16 @@ module Metanorma
|
|
50
57
|
map_attribute "index", to: :index
|
51
58
|
map_attribute "url", to: :url
|
52
59
|
map_attribute "fileref", to: :file
|
53
|
-
map_element "identifier", to: :identifier
|
60
|
+
map_element "identifier", to: :identifier, render_default: true
|
54
61
|
map_element "type", to: :type
|
55
62
|
map_element "title", to: :title
|
56
|
-
map_element "bibdata",
|
57
|
-
|
63
|
+
map_element "bibdata", to: :bibdata, with: { from: :bibdata_from_xml,
|
64
|
+
to: :bibdata_to_xml }
|
58
65
|
map_element "entry", to: :entry
|
59
66
|
end
|
60
67
|
|
61
68
|
def entry_from_xml(model, node)
|
62
|
-
model.entry = Manifest.from_xml(node.
|
69
|
+
model.entry = Manifest.from_xml(node.node.to_xml)
|
63
70
|
end
|
64
71
|
|
65
72
|
def entry_to_xml(model, parent, doc)
|
@@ -210,10 +210,10 @@ module Metanorma
|
|
210
210
|
ret[val[:type]] ||= {}
|
211
211
|
index = if val[:container] || val[:label].nil? || val[:label].empty?
|
212
212
|
UUIDTools::UUID.random_create.to_s
|
213
|
-
else val[:label]
|
213
|
+
else val[:label].gsub(%r{<[^>]+>}, "")
|
214
214
|
end
|
215
215
|
ret[val[:type]][index] = key
|
216
|
-
ret[val[:type]][
|
216
|
+
v = val[:value] and ret[val[:type]][v.gsub(%r{<[^>]+>}, "")] = key
|
217
217
|
end
|
218
218
|
|
219
219
|
# Also parse all ids in doc (including ones which won't be xref targets)
|
@@ -228,8 +228,8 @@ module Metanorma
|
|
228
228
|
end
|
229
229
|
|
230
230
|
def key(ident)
|
231
|
-
@c.decode(ident).gsub(/(\p{Zs})+/, " ")
|
232
|
-
|
231
|
+
@c.decode(ident).gsub(/(\p{Zs})+/, " ")
|
232
|
+
.sub(/^metanorma-collection /, "")
|
233
233
|
end
|
234
234
|
|
235
235
|
def keys
|
@@ -43,7 +43,8 @@ module Metanorma
|
|
43
43
|
@compile = Compile.new
|
44
44
|
@compile.load_flavor(@flavor)
|
45
45
|
|
46
|
-
|
46
|
+
# output processor for flavour
|
47
|
+
@isodoc = Util::isodoc_create(@flavor, @lang, @scropt, @xml)
|
47
48
|
@outdir = dir_name_cleanse(options[:output_folder])
|
48
49
|
@coverpage = options[:coverpage] || collection.coverpage
|
49
50
|
@format = ::Metanorma::Util.sort_extensions_execution(options[:format])
|
@@ -55,7 +55,7 @@ module Metanorma
|
|
55
55
|
def docid_to_citeas(bib)
|
56
56
|
docid = bib.at(ns("./docidentifier[@primary = 'true']")) ||
|
57
57
|
bib.at(ns("./docidentifier")) or return
|
58
|
-
docid_prefix(docid)
|
58
|
+
::Metanorma::Collection::Util::key(docid_prefix(docid))
|
59
59
|
end
|
60
60
|
|
61
61
|
def collect_erefs(docxml)
|
@@ -168,21 +168,13 @@ module Metanorma
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
|
-
def isodoc_create
|
172
|
-
isodoc = Util::load_isodoc(@flavor)
|
173
|
-
isodoc.i18n_init(@lang, @script, @locale) # read in internationalisation
|
174
|
-
isodoc.metadata_init(@lang, @script, @locale, isodoc.i18n)
|
175
|
-
isodoc.info(@xml, nil)
|
176
|
-
isodoc
|
177
|
-
end
|
178
|
-
|
179
171
|
# create the @meta class of isodoc, for populating Liquid,
|
180
172
|
# with "navigation" set to the index bar.
|
181
173
|
# extracted from the manifest
|
182
174
|
def isodoc_populate
|
183
175
|
@isodoc.info(@xml, nil)
|
184
176
|
{ navigation: indexfile(@manifest), nav_object: index_object(@manifest),
|
185
|
-
docrefs: liquid_docrefs(@manifest),
|
177
|
+
bibdata: @bibdata.to_hash, docrefs: liquid_docrefs(@manifest),
|
186
178
|
"prefatory-content": isodoc_builder(@xml.at("//prefatory-content")),
|
187
179
|
"final-content": isodoc_builder(@xml.at("//final-content")),
|
188
180
|
doctitle: @bibdata.title.first.title.content,
|
@@ -82,13 +82,13 @@ module Metanorma
|
|
82
82
|
|
83
83
|
def sectionsplit_prep(file, filename, dir)
|
84
84
|
@splitdir = dir
|
85
|
-
|
85
|
+
xml, type = sectionsplit_preprocess_semxml(file, filename)
|
86
86
|
flags = { format: :asciidoc, extension_keys: [:presentation],
|
87
87
|
type: type }.merge(@compile_opts)
|
88
|
-
Compile.new.compile(
|
89
|
-
f = File.open(
|
90
|
-
encoding: "utf-8")
|
88
|
+
Compile.new.compile(xml, flags)
|
89
|
+
f = File.open(xml.sub(/\.xml$/, ".presentation.xml"), encoding: "utf-8")
|
91
90
|
r = Nokogiri::XML(f, &:huge)
|
91
|
+
f.close
|
92
92
|
r.xpath("//xmlns:svgmap1").each { |x| x.name = "svgmap" }
|
93
93
|
r
|
94
94
|
end
|
@@ -202,13 +202,11 @@ module Metanorma
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def titlerender(section)
|
205
|
-
title = section.at(ns("./title")) or return "[Untitled]"
|
205
|
+
title = section.at(ns("./fmt-title")) or return "[Untitled]"
|
206
206
|
t = title.dup
|
207
207
|
t.xpath(ns(".//tab | .//br")).each { |x| x.replace(" ") }
|
208
208
|
t.xpath(ns(".//bookmark")).each(&:remove)
|
209
|
-
t.xpath(
|
210
|
-
.each { |x| x.replace(x.children) }
|
211
|
-
t.children.to_xml
|
209
|
+
t.xpath('.//text()').map(&:text).join
|
212
210
|
end
|
213
211
|
end
|
214
212
|
end
|
@@ -25,8 +25,9 @@ module Metanorma
|
|
25
25
|
def gather_citeases(xml)
|
26
26
|
xml.xpath("//*[@citeas]").each_with_object({}) do |e, m|
|
27
27
|
/^semantic__/.match?(e.name) and next
|
28
|
-
|
29
|
-
m[
|
28
|
+
k = key(e["citeas"])
|
29
|
+
m[k] ||= []
|
30
|
+
m[k] << e
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -61,10 +62,23 @@ module Metanorma
|
|
61
62
|
def attr(_key); end
|
62
63
|
end
|
63
64
|
|
64
|
-
def load_isodoc(flavor)
|
65
|
+
def load_isodoc(flavor, presxml: false)
|
65
66
|
x = Asciidoctor.load nil, backend: flavor.to_sym
|
67
|
+
if presxml
|
68
|
+
x.converter.presentation_xml_converter(Dummy.new)
|
69
|
+
else
|
66
70
|
x.converter.html_converter(Dummy.new) # to obtain Isodoc class
|
71
|
+
end
|
67
72
|
end
|
73
|
+
|
74
|
+
def isodoc_create(flavor, lang, script, xml, presxml: false)
|
75
|
+
isodoc = Util::load_isodoc(flavor, presxml: presxml)
|
76
|
+
isodoc.i18n_init(lang, script, nil) # read in internationalisation
|
77
|
+
# TODO locale?
|
78
|
+
isodoc.metadata_init(lang, script, nil, isodoc.i18n)
|
79
|
+
isodoc.info(xml, nil)
|
80
|
+
isodoc
|
81
|
+
end
|
68
82
|
end
|
69
83
|
end
|
70
84
|
end
|
data/lib/metanorma/version.rb
CHANGED
data/metanorma.gemspec
CHANGED
@@ -27,10 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_runtime_dependency "concurrent-ruby"
|
28
28
|
spec.add_runtime_dependency "fontist", ">= 1.14.3"
|
29
29
|
spec.add_runtime_dependency "htmlentities"
|
30
|
-
spec.add_runtime_dependency "isodoc", ">= 2.
|
30
|
+
spec.add_runtime_dependency "isodoc", ">= 2.12.2"
|
31
31
|
spec.add_runtime_dependency "mn2pdf", "~> 2"
|
32
32
|
spec.add_runtime_dependency "nokogiri"
|
33
|
-
spec.add_runtime_dependency "shale"
|
34
33
|
|
35
34
|
# get relaton-cli to avoid circular reference with metanorma-standoc
|
36
35
|
# spec.add_dependency "relaton-cli"
|
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: 2.0.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
75
|
+
version: 2.12.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
82
|
+
version: 2.12.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: mn2pdf
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: shale
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: debug
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -348,7 +334,6 @@ files:
|
|
348
334
|
- lib/metanorma/processor.rb
|
349
335
|
- lib/metanorma/processor/processor.rb
|
350
336
|
- lib/metanorma/registry/registry.rb
|
351
|
-
- lib/metanorma/shale_monkeypatch.rb
|
352
337
|
- lib/metanorma/util/fontist_helper.rb
|
353
338
|
- lib/metanorma/util/util.rb
|
354
339
|
- lib/metanorma/util/worker_pool.rb
|