metanorma-standoc 3.4.0 → 3.4.2
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/.rubocop.yml +1 -1
- data/RELATON_2_MIGRATION.md +18 -5
- data/lib/isodoc/standoc/presentation_xml_convert.rb +8 -0
- data/lib/metanorma/cleanup/asciibib.rb +1 -0
- data/lib/metanorma/cleanup/bibdata.rb +1 -0
- data/lib/metanorma/cleanup/boilerplate.rb +46 -13
- data/lib/metanorma/cleanup/cleanup.rb +1 -1
- data/lib/metanorma/cleanup/reqt.rb +2 -1
- data/lib/metanorma/cleanup/section_names.rb +2 -2
- data/lib/metanorma/cleanup/text.rb +3 -17
- data/lib/metanorma/cleanup/xref.rb +2 -1
- data/lib/metanorma/converter/base.rb +0 -1
- data/lib/metanorma/converter/front.rb +16 -9
- data/lib/metanorma/converter/front_contributor.rb +2 -2
- data/lib/metanorma/converter/init.rb +3 -1
- data/lib/metanorma/converter/log.rb +207 -207
- data/lib/metanorma/converter/macros_terms.rb +1 -1
- data/lib/metanorma/converter/reqt.rb +8 -3
- data/lib/metanorma/converter/utils.rb +16 -40
- data/lib/metanorma/converter/version.rb +1 -1
- data/lib/metanorma-standoc.rb +2 -1
- data/metanorma-standoc.gemspec +6 -5
- metadata +26 -25
- data/lib/metanorma/converter/isolated_converter.rb +0 -57
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 337c4b9070783a56e314d0e8a1855420ddb818da4bc13e9031749cfc497702d8
|
|
4
|
+
data.tar.gz: 04fed5ceea5cc84cf1dfad226e88c38313f405e68436eca36af1b6107e6ae25f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 345e5360ec266c640719931c35aa01cf34c11098c16308b45abd2f46a6acf933b06fda91b95c770b1bd5975df403d7b09df717ebf8e3c33ae1ce54d52dc2514a
|
|
7
|
+
data.tar.gz: 3c375e4e7ab47a72a5d84b7f916b7a08a742491136b35079d05e4a6598429010c1518451e69def8c080eb3f06d5375e623689e6e15c375ac42ab62435c9281ce
|
data/.rubocop.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
inherit_from:
|
|
4
|
-
- https://raw.githubusercontent.com/riboseinc/oss-guides/
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
5
|
|
|
6
6
|
# local repo-specific modifications
|
|
7
7
|
# ...
|
data/RELATON_2_MIGRATION.md
CHANGED
|
@@ -1840,20 +1840,33 @@ def from_xml(xml)
|
|
|
1840
1840
|
# <bibitem> elements are always flavor-independent: use the base
|
|
1841
1841
|
# Relaton::Bib::Bibitem regardless of collection flavor.
|
|
1842
1842
|
# <bibdata> elements carry flavor-specific metadata (<ext> etc.) and
|
|
1843
|
-
# must be parsed with the appropriate flavor
|
|
1843
|
+
# must be parsed with the appropriate flavor Item class.
|
|
1844
1844
|
r = if b.name == "bibitem"
|
|
1845
1845
|
::Relaton::Bib::Bibitem
|
|
1846
1846
|
else
|
|
1847
|
-
mn2relaton_parser(xml.root["flavor"]
|
|
1847
|
+
mn2relaton_parser(xml.root["flavor"])
|
|
1848
1848
|
end
|
|
1849
1849
|
b.xpath("//xmlns:fmt-identifier").each(&:remove)
|
|
1850
1850
|
r.from_xml(b.to_xml)
|
|
1851
1851
|
end
|
|
1852
1852
|
```
|
|
1853
1853
|
|
|
1854
|
-
The `mn2relaton_parser` method
|
|
1855
|
-
|
|
1856
|
-
|
|
1854
|
+
The `mn2relaton_parser` method now returns the flavor's `Item` class (e.g.
|
|
1855
|
+
`Relaton::Iso::Item`) instead of `Bibdata`/`Bibitem`. The `bibdata:` keyword
|
|
1856
|
+
parameter has been removed.
|
|
1857
|
+
|
|
1858
|
+
This is necessary because in Relaton 2.x, `BibdataShared` (defined in
|
|
1859
|
+
`Relaton::Bib`) sets `model ItemData` inside `class_eval`, and Ruby constant
|
|
1860
|
+
lookup resolves `ItemData` in the **definer's** scope (`Relaton::Bib`), not the
|
|
1861
|
+
includer's scope. So `Relaton::Iso::Bibdata.from_xml` produces a generic
|
|
1862
|
+
`Relaton::Bib::ItemData` instance. When `to_xml(bibdata: true)` is called, the
|
|
1863
|
+
generic instance delegates to `Relaton::Bib::Bibdata.to_xml`, which does not know
|
|
1864
|
+
about flavor-specific `ext` attributes, causing a crash.
|
|
1865
|
+
|
|
1866
|
+
By contrast, `Relaton::Iso::Item` explicitly declares `model ItemData` in its own
|
|
1867
|
+
class body within `Relaton::Iso`, correctly resolving to `Relaton::Iso::ItemData`.
|
|
1868
|
+
The resulting `ItemData` instance's `to_xml(bibdata: true)` correctly delegates to
|
|
1869
|
+
`Relaton::Iso::Bibdata.to_xml(self)` via the `namespace` helper.
|
|
1857
1870
|
|
|
1858
1871
|
**Impact on round-trip fidelity:**
|
|
1859
1872
|
|
|
@@ -4,6 +4,8 @@ require_relative "boilerplate_liquid"
|
|
|
4
4
|
module Metanorma
|
|
5
5
|
module Standoc
|
|
6
6
|
module Boilerplate
|
|
7
|
+
include ::Metanorma::Core::Boilerplate
|
|
8
|
+
|
|
7
9
|
def norm_ref_preface(ref, isodoc)
|
|
8
10
|
ins = norm_ref_boilerplate_insert_location(ref)
|
|
9
11
|
ins2 = norm_ref_process_boilerplate_note(ref)
|
|
@@ -73,7 +75,10 @@ module Metanorma
|
|
|
73
75
|
|
|
74
76
|
def boilerplate_cleanup(xmldoc)
|
|
75
77
|
isodoc = boilerplate_isodoc(xmldoc) or return
|
|
78
|
+
had_templates = ::Metanorma::Core::Boilerplate
|
|
79
|
+
.docidentifier_templates?(xmldoc)
|
|
76
80
|
docidentifier_boilerplate_isodoc(xmldoc, isodoc)
|
|
81
|
+
had_templates and refresh_isodoc_bibdata(xmldoc, isodoc)
|
|
77
82
|
termdef_boilerplate_cleanup(xmldoc)
|
|
78
83
|
termdef_boilerplate_insert(xmldoc, isodoc)
|
|
79
84
|
unwrap_boilerplate_clauses(xmldoc, self.class::TERM_CLAUSE)
|
|
@@ -84,15 +89,28 @@ module Metanorma
|
|
|
84
89
|
initial_boilerplate(xmldoc, isodoc)
|
|
85
90
|
end
|
|
86
91
|
|
|
92
|
+
# Re-seed isodoc state from the now-resolved xmldoc bibdata after
|
|
93
|
+
# docidentifier_boilerplate_isodoc has substituted any
|
|
94
|
+
# +@boilerplate="true"+ Liquid templates. Standoc default just
|
|
95
|
+
# re-runs isodoc_bibdata_parse so any cached i18n / meta state
|
|
96
|
+
# picks up the resolved docidentifier values; flavors that
|
|
97
|
+
# populate richer derived state (e.g. metanorma-generic's
|
|
98
|
+
# bibdata_hash) override to refresh that too.
|
|
99
|
+
# See https://github.com/metanorma/metanorma/issues/558.
|
|
100
|
+
def refresh_isodoc_bibdata(xmldoc, _isodoc)
|
|
101
|
+
isodoc_bibdata_parse(xmldoc)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Standoc-side wrapper around Core::Boilerplate's iterator. The
|
|
105
|
+
# core helper owns the loop body (substitute Liquid + Asciidoc,
|
|
106
|
+
# then splice the inner <p> children back); this wrapper supplies
|
|
107
|
+
# standoc-level kwargs from instance state so existing 2-arg
|
|
108
|
+
# callers do not need to thread them through.
|
|
87
109
|
def docidentifier_boilerplate_isodoc(xmldoc, isodoc)
|
|
88
|
-
xmldoc
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
id = boilerplate_snippet_convert(to_xml(d.children), isodoc)
|
|
93
|
-
p = Nokogiri::XML(id).at("//p")
|
|
94
|
-
d.children = p ? to_xml(p&.children) : id
|
|
95
|
-
end
|
|
110
|
+
super(xmldoc, isodoc,
|
|
111
|
+
lang: @lang, script: @script,
|
|
112
|
+
backend: @conv.backend&.to_sym,
|
|
113
|
+
flush_caches: @flush_caches, localdir: @localdir)
|
|
96
114
|
end
|
|
97
115
|
|
|
98
116
|
def initial_boilerplate(xml, isodoc)
|
|
@@ -186,17 +204,32 @@ module Metanorma
|
|
|
186
204
|
end
|
|
187
205
|
|
|
188
206
|
def boilerplate_file_restructure(file)
|
|
189
|
-
ret = adoc2xml(file, @conv.backend
|
|
207
|
+
ret = adoc2xml(file, @conv.backend&.to_sym)
|
|
190
208
|
boilerplate_xml_cleanup(ret)
|
|
191
209
|
ret.name = "boilerplate"
|
|
192
210
|
boilerplate_top_elements(ret)
|
|
193
211
|
ret
|
|
194
212
|
end
|
|
195
213
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
214
|
+
# Standoc-side wrapper around the metanorma-core helper. Existing
|
|
215
|
+
# 2-arg call sites supply no kwargs and inherit them all from
|
|
216
|
+
# instance state; core's docidentifier_boilerplate_isodoc passes
|
|
217
|
+
# kwargs through and they take precedence.
|
|
218
|
+
def boilerplate_snippet_convert(adoc, isodoc, **kwargs)
|
|
219
|
+
defaults = {
|
|
220
|
+
lang: @lang, script: @script,
|
|
221
|
+
backend: @conv.backend&.to_sym,
|
|
222
|
+
flush_caches: @flush_caches, localdir: @localdir,
|
|
223
|
+
}
|
|
224
|
+
super(adoc, isodoc, **defaults.merge(kwargs))
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
# Standoc override of the metanorma-core extension hook.
|
|
228
|
+
# Applies namespace cleanup and externally-sourced footnote separation
|
|
229
|
+
# to a Nokogiri node before the snippet is serialised back into the
|
|
230
|
+
# surrounding document.
|
|
231
|
+
def boilerplate_snippet_cleanup(node)
|
|
232
|
+
boilerplate_xml_cleanup(@conv.separate_numbering_footnotes(node))
|
|
200
233
|
end
|
|
201
234
|
|
|
202
235
|
private
|
|
@@ -143,7 +143,7 @@ module Metanorma
|
|
|
143
143
|
unnumbered_blocks_cleanup(xmldoc)
|
|
144
144
|
termdocsource_cleanup(xmldoc) # feeds: metadata_cleanup
|
|
145
145
|
metadata_cleanup(xmldoc) # feeds: boilerplate_cleanup, bibdata_cleanup,
|
|
146
|
-
# docidentifier_cleanup
|
|
146
|
+
# docidentifier_cleanup
|
|
147
147
|
misccontainer_cleanup(xmldoc)
|
|
148
148
|
sections_cleanup(xmldoc) # feeds: obligations_cleanup, toc_cleanup,
|
|
149
149
|
# floatingtitle_cleanup
|
|
@@ -3,7 +3,8 @@ module Metanorma
|
|
|
3
3
|
module Reqt
|
|
4
4
|
def requirement_cleanup(xmldoc)
|
|
5
5
|
@reqt_models ||=
|
|
6
|
-
@conv.requirements_processor.new({
|
|
6
|
+
@conv.requirements_processor.new({ conv: @conv.presentation_xml_converter(Metanorma::Standoc::EmptyAttr.new),
|
|
7
|
+
default: @default_requirement_model })
|
|
7
8
|
@reqt_models.requirement_cleanup(xmldoc)
|
|
8
9
|
end
|
|
9
10
|
end
|
|
@@ -52,9 +52,9 @@ module Metanorma
|
|
|
52
52
|
SYMABBR = "[.//definitions[@type = 'symbols']]" \
|
|
53
53
|
"[.//definitions[@type = 'abbreviated_terms']]".freeze
|
|
54
54
|
SYM_NO_ABBR = "[.//definitions[@type = 'symbols']]" \
|
|
55
|
-
|
|
55
|
+
"[not(.//definitions[@type = 'abbreviated_terms'])]".freeze
|
|
56
56
|
ABBR_NO_SYM = "[.//definitions[@type = 'abbreviated_terms']]" \
|
|
57
|
-
|
|
57
|
+
"[not(.//definitions[@type = 'symbols'])]".freeze
|
|
58
58
|
|
|
59
59
|
def section_names_terms_cleanup(xml)
|
|
60
60
|
section_names_definitions(xml)
|
|
@@ -30,13 +30,10 @@ module Metanorma
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def lines_strip_textspan(span, nextspan)
|
|
33
|
-
#AAA
|
|
34
33
|
lines = []
|
|
35
34
|
span[:text] and
|
|
36
35
|
lines = span[:text].lines[0..-2].map(&:rstrip) <<
|
|
37
36
|
span[:text].lines[-1]&.sub(/\n$/, "")
|
|
38
|
-
#lines = span[:text].lines[0..-2].map(&:rstrip) <<
|
|
39
|
-
#span[:text].lines[-1]&.sub(/\n$/, "")
|
|
40
37
|
# no final line rstrip: can be space linking to next line
|
|
41
38
|
span[:last] or lines << nextspan[:text].lines.first # next token context
|
|
42
39
|
lines
|
|
@@ -57,9 +54,9 @@ module Metanorma
|
|
|
57
54
|
|
|
58
55
|
def gather_text_for_linebreak_cleanup1(block)
|
|
59
56
|
block.xpath(".//text() | .//eref[not(text())] | " \
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
".//xref[not(text())] | .//termref[not(text())] | " \
|
|
58
|
+
".//link[not(text())] ").map do |e|
|
|
59
|
+
# x = block.xpath(".//text()").map do |e|
|
|
63
60
|
{ elem: e, text: e.text, stem: ancestor_include?(e, %w(stem)),
|
|
64
61
|
skip: ancestor_include?(e, PRESERVE_LINEBREAK_ELEMENTS) }
|
|
65
62
|
end
|
|
@@ -91,17 +88,6 @@ module Metanorma
|
|
|
91
88
|
end
|
|
92
89
|
end
|
|
93
90
|
|
|
94
|
-
#AAA
|
|
95
|
-
# "abc<tag/>", def => "abc",<tag/> def
|
|
96
|
-
# TODO?
|
|
97
|
-
#def uninterrupt_quotes_around_xml1(xmldoc)
|
|
98
|
-
#xmldoc.xpath("//text()[preceding-sibling::*[1]]").each do |n|
|
|
99
|
-
#uninterrupt_quotes_around_xml_skip(n) and next
|
|
100
|
-
#uninterrupt_quotes_around_xml1(n.previous)
|
|
101
|
-
#end
|
|
102
|
-
#end
|
|
103
|
-
|
|
104
|
-
|
|
105
91
|
IGNORE_QUOTES_ELEMENTS =
|
|
106
92
|
%w(pre tt sourcecode stem asciimath figure bibdata passthrough
|
|
107
93
|
identifier metanorma-extension boilerplate).freeze
|
|
@@ -87,7 +87,8 @@ module Metanorma
|
|
|
87
87
|
|
|
88
88
|
def xref_compound_cleanup(xmldoc)
|
|
89
89
|
xmldoc.xpath("//xref").each do |x|
|
|
90
|
-
x["target"]
|
|
90
|
+
next unless x["target"]&.include?(";")
|
|
91
|
+
|
|
91
92
|
locations = x["target"].split(";")
|
|
92
93
|
x["target"] = locations.first.sub(/^[^!]*!/, "")
|
|
93
94
|
xref_compound_cleanup1(x, locations)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require "date"
|
|
2
2
|
require "pathname"
|
|
3
|
-
require_relative "
|
|
4
|
-
require_relative "
|
|
5
|
-
require_relative "
|
|
3
|
+
require_relative "front_contributor"
|
|
4
|
+
require_relative "front_ext"
|
|
5
|
+
require_relative "front_title"
|
|
6
6
|
require "isoics"
|
|
7
7
|
require "isodoc"
|
|
8
8
|
|
|
@@ -56,14 +56,15 @@ module Metanorma
|
|
|
56
56
|
add_noko_elem(xml, "docnumber", node.attr("docnumber"))
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
def metadata_edition(node, xml)
|
|
60
|
+
add_noko_elem(xml, "edition", node.attr("edition"))
|
|
61
|
+
end
|
|
62
|
+
|
|
59
63
|
def metadata_version(node, xml)
|
|
64
|
+
metadata_edition(node, xml)
|
|
60
65
|
draft = metadata_version_value(node)
|
|
61
|
-
add_noko_elem(xml, "edition", node.attr("edition"))
|
|
62
66
|
draft || node.attr("revdate") or return
|
|
63
|
-
xml.version
|
|
64
|
-
add_noko_elem(v, "revision_date", node.attr("revdate"))
|
|
65
|
-
add_noko_elem(v, "draft", draft)
|
|
66
|
-
end
|
|
67
|
+
xml.version draft || node.attr("revdate")
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def metadata_version_value(node)
|
|
@@ -112,6 +113,12 @@ module Metanorma
|
|
|
112
113
|
type or next
|
|
113
114
|
xml.date(type:) { |d| add_noko_elem(d, "on", date) }
|
|
114
115
|
end
|
|
116
|
+
metadata_revdate(node, xml)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def metadata_revdate(node, xml)
|
|
120
|
+
date = node.attr("revdate") or return
|
|
121
|
+
xml.date(type: "updated") { |d| add_noko_elem(d, "on", date) }
|
|
115
122
|
end
|
|
116
123
|
|
|
117
124
|
def metadata_language(node, xml)
|
|
@@ -173,7 +180,7 @@ module Metanorma
|
|
|
173
180
|
|
|
174
181
|
def metadata_classifications(node, xml)
|
|
175
182
|
csv_split(node.attr("classification"), ",")&.each do |c|
|
|
176
|
-
vals = c.split(
|
|
183
|
+
vals = c.split(":", 2)
|
|
177
184
|
vals.size == 1 and vals = ["default", vals[0]]
|
|
178
185
|
add_noko_elem(xml, "classification", vals[1], type: vals[0])
|
|
179
186
|
end
|
|
@@ -109,8 +109,10 @@ module Metanorma
|
|
|
109
109
|
def init_reqt(node)
|
|
110
110
|
@default_requirement_model = node.attr("requirements-model") ||
|
|
111
111
|
default_requirement_model
|
|
112
|
+
@default_requirement_render = node.attr("requirements-render")
|
|
113
|
+
conv = presentation_xml_converter(EmptyAttr.new)
|
|
112
114
|
@reqt_models = requirements_processor
|
|
113
|
-
.new({ default: @default_requirement_model })
|
|
115
|
+
.new({ default: @default_requirement_model, conv: conv })
|
|
114
116
|
end
|
|
115
117
|
|
|
116
118
|
def init_toc(node)
|
|
@@ -3,213 +3,213 @@ module Metanorma
|
|
|
3
3
|
class Converter
|
|
4
4
|
# rubocop:disable Naming/VariableNumber
|
|
5
5
|
STANDOC_LOG_MESSAGES = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
6
|
+
STANDOC_1: { category: "Include",
|
|
7
|
+
error: "Specified boilerplate file does not exist: %s",
|
|
8
|
+
severity: 0 },
|
|
9
|
+
STANDOC_2: { category: "Table", error: "Empty table",
|
|
10
|
+
severity: 0 },
|
|
11
|
+
STANDOC_3: { category: "Crossreferences",
|
|
12
|
+
error: "invalid index \"%s\" cross-reference: " \
|
|
13
|
+
"wrong number of attributes in `index:%s[%s]`",
|
|
14
|
+
severity: 0 },
|
|
15
|
+
STANDOC_4: { category: "Table",
|
|
16
|
+
error: "Table rows in table %s: check rowspan",
|
|
17
|
+
severity: 0 },
|
|
18
|
+
STANDOC_5: { category: "Table",
|
|
19
|
+
error: "Table exceeds maximum number of columns defined (%s)",
|
|
20
|
+
severity: 0 },
|
|
21
|
+
STANDOC_6: { category: "Maths",
|
|
22
|
+
error: "Malformed MathML: %s\n%s",
|
|
23
|
+
severity: 0 },
|
|
24
|
+
STANDOC_7: { category: "Metanorma XML Syntax", error: "%s",
|
|
25
|
+
severity: 2 },
|
|
26
|
+
STANDOC_8: { category: "Anchors", error: "Malformed URI: %s",
|
|
27
|
+
severity: 0 },
|
|
28
|
+
STANDOC_9: { category: "Bibliography",
|
|
29
|
+
error: "Attachment %s does not exist",
|
|
30
|
+
severity: 0 },
|
|
31
|
+
STANDOC_10: { category: "Anchors",
|
|
32
|
+
error: "The following reference is missing an anchor:\n%s",
|
|
33
|
+
severity: 1 },
|
|
34
|
+
STANDOC_11: { category: "Bibliography",
|
|
35
|
+
error: "Reference %s is missing a title",
|
|
36
|
+
severity: 1 },
|
|
37
|
+
STANDOC_12: { category: "Bibliography",
|
|
38
|
+
error: "Reference %s is missing a document identifier (docid)",
|
|
39
|
+
severity: 1 },
|
|
40
|
+
STANDOC_13: { category: "AsciiDoc Input",
|
|
41
|
+
error: "term reference not in expected format:%s",
|
|
42
|
+
severity: 1 },
|
|
43
|
+
STANDOC_14: { category: "Style",
|
|
44
|
+
error: "Style override set for ordered list",
|
|
45
|
+
severity: 2 },
|
|
46
|
+
STANDOC_15: { category: "Crossreferences",
|
|
47
|
+
error: "Could not resolve footnoteblock:[%s]",
|
|
48
|
+
severity: 1 },
|
|
49
|
+
STANDOC_16: { category: "AsciiDoc Input",
|
|
50
|
+
error: "Section not marked up as [bibliography]!",
|
|
51
|
+
severity: 2 },
|
|
52
|
+
STANDOC_17: { category: "Bibliography",
|
|
53
|
+
error: "ERROR: No document identifier retrieved for %s",
|
|
54
|
+
severity: 2 },
|
|
55
|
+
STANDOC_18: { category: "Bibliography",
|
|
56
|
+
error: "ERROR: No title retrieved for %s", severity: 2 },
|
|
57
|
+
STANDOC_19: { category: "Bibliography",
|
|
58
|
+
error: "Cannot find reference %s for local Relaton " \
|
|
59
|
+
"data source %s", severity: 0 },
|
|
60
|
+
STANDOC_20: { category: "AsciiDoc Input",
|
|
61
|
+
error: "Metadata definition list does not follow a term designation",
|
|
62
|
+
severity: 2 },
|
|
63
|
+
STANDOC_21: { category: "Terms",
|
|
64
|
+
error: "Removed duplicate designation %s",
|
|
65
|
+
severity: 2 },
|
|
66
|
+
STANDOC_22: { category: "Bibliography",
|
|
67
|
+
error: "Term \"%s\" does not match IEV %s \"%s\"",
|
|
68
|
+
severity: 1 },
|
|
69
|
+
STANDOC_23: { category: "Anchors",
|
|
70
|
+
error: "Concept cross-reference error: %s",
|
|
71
|
+
severity: 0 },
|
|
72
|
+
STANDOC_24: { category: "Terms",
|
|
73
|
+
error: "Term %s occurs twice as preferred designation: %s",
|
|
74
|
+
severity: 1 },
|
|
75
|
+
STANDOC_25: { category: "Terms", severity: 0,
|
|
76
|
+
error: <<~ERROR.freeze },
|
|
77
|
+
Clause not recognised as a term clause, but contains designation markup
|
|
78
|
+
(<code>preferred:[], admitted:[], alt:[], deprecated:[]</code>):<br/>
|
|
79
|
+
%s</br>
|
|
80
|
+
Ensure the parent clause is recognised as a terms clause by inserting <code>[heading=terms and definitions]</code> above the title,
|
|
81
|
+
in case the heading is not automatically recognised. See also <a href="https://www.metanorma.org/author/topics/sections/concepts/#clause-title">Metanorma documentation</a>.
|
|
82
|
+
ERROR
|
|
83
|
+
STANDOC_26: { category: "AsciiDoc Input",
|
|
84
|
+
error: "Error: Symbol reference in `symbol[%s]` missing: \"%s\" is not defined in document",
|
|
85
|
+
severity: 1 },
|
|
86
|
+
STANDOC_27: { category: "AsciiDoc Input",
|
|
87
|
+
error: "Error: Term reference to `%s` missing: \"%s\" is not defined in document%s",
|
|
88
|
+
severity: 1 },
|
|
89
|
+
STANDOC_28: { category: "Crossreferences",
|
|
90
|
+
error: "term source %s not referenced",
|
|
91
|
+
severity: 1 },
|
|
92
|
+
STANDOC_29: { category: "AsciiDoc Input",
|
|
93
|
+
error: "converter missing for %s node in Metanorma backend",
|
|
94
|
+
severity: 1 },
|
|
95
|
+
STANDOC_30: { category: "Crossreferences",
|
|
96
|
+
error: "%s does not have a corresponding anchor ID in the bibliography!",
|
|
97
|
+
severity: 2 },
|
|
98
|
+
STANDOC_31: { category: "Crossreferences",
|
|
99
|
+
error: "Illegal cross-reference connective: %s",
|
|
100
|
+
severity: 0 },
|
|
101
|
+
STANDOC_32: { category: "Crossreferences",
|
|
102
|
+
error: "%s does not have a corresponding anchor ID in the bibliography!",
|
|
103
|
+
severity: 2 },
|
|
104
|
+
STANDOC_33: { category: "Maths",
|
|
105
|
+
error: "Invalid MathML: %s\n %s%s",
|
|
106
|
+
severity: 0 },
|
|
107
|
+
STANDOC_34: { category: "Style",
|
|
108
|
+
error: "There is an instance of %s nested within %s",
|
|
109
|
+
severity: 2 },
|
|
110
|
+
STANDOC_35: { category: "Style",
|
|
111
|
+
error: "There is a crossreference to an instance of %s nested within %s: %s",
|
|
112
|
+
severity: 2 },
|
|
113
|
+
STANDOC_36: { category: "Anchors",
|
|
114
|
+
error: "ID %s has already been used at line %s",
|
|
115
|
+
severity: 0 },
|
|
116
|
+
STANDOC_37: { category: "Bibliography",
|
|
117
|
+
error: "Cannot process format %s for local Relaton data source %s",
|
|
118
|
+
severity: 0 },
|
|
119
|
+
STANDOC_38: { category: "Anchors",
|
|
120
|
+
error: "Crossreference target %s is undefined",
|
|
121
|
+
severity: 1 },
|
|
122
|
+
STANDOC_39: { category: "Blocks",
|
|
123
|
+
error: "%s is empty",
|
|
124
|
+
severity: 1 },
|
|
125
|
+
STANDOC_40: { category: "Bibliography",
|
|
126
|
+
error: "Could not retrieve %s: no access to online site",
|
|
127
|
+
severity: 1 },
|
|
128
|
+
STANDOC_41: { category: "Include",
|
|
129
|
+
error: "Unresolved directive %s",
|
|
130
|
+
severity: 0 },
|
|
131
|
+
STANDOC_42: { category: "Metanorma XML Syntax",
|
|
132
|
+
error: "Invalid passthrough content: %s\n" \
|
|
133
|
+
"This is not valid Metanorma XML. If you intended a different format, such as HTML, you need to specify `format=` on the pass markup;\n" \
|
|
134
|
+
"refer to https://www.metanorma.org/author/topics/blocks/passthroughs/",
|
|
135
|
+
severity: 0 },
|
|
136
|
+
STANDOC_43: { category: "AsciiDoc Input",
|
|
137
|
+
error: <<~REF.freeze, severity: 1 },
|
|
138
|
+
no anchor on reference, markup may be malformed: see
|
|
139
|
+
https://www.metanorma.org/author/topics/sections/bibliography/ ,
|
|
140
|
+
https://www.metanorma.org/author/iso/topics/markup/#bibliographies : %s
|
|
141
|
+
REF
|
|
142
|
+
STANDOC_44: { category: "Images", error: "Image not found: %s",
|
|
143
|
+
severity: 0 },
|
|
144
|
+
STANDOC_45: { category: "Images",
|
|
145
|
+
error: "Corrupt PNG image detected: %s",
|
|
146
|
+
severity: 2 },
|
|
147
|
+
STANDOC_46: { category: "Images",
|
|
148
|
+
error: "Image too large for Data URI encoding: disable Data URI encoding (`:data-uri-image: false`), or set `:data-uri-maxsize: 0`",
|
|
149
|
+
severity: 0 },
|
|
150
|
+
STANDOC_47: { category: "Crossreferences",
|
|
151
|
+
error: "mismatch of callouts (%s) and annotations (%s)",
|
|
152
|
+
severity: 0 },
|
|
153
|
+
STANDOC_48: { category: "Style", error: "(generic warning) %s",
|
|
154
|
+
severity: 2 },
|
|
155
|
+
STANDOC_49: { category: "Bibliography",
|
|
156
|
+
error: "Numeric reference in normative references",
|
|
157
|
+
severity: 1 },
|
|
158
|
+
STANDOC_50: { category: "Fatal Error", error: "%s", severity: 0 },
|
|
159
|
+
STANDOC_51: { category: "Maths",
|
|
160
|
+
error: "latexmlmath failed to process equation:\n%s",
|
|
161
|
+
severity: 1 },
|
|
162
|
+
STANDOC_52: { category: "Bibliography",
|
|
163
|
+
error: "Bibliographic spans: %s",
|
|
164
|
+
severity: 0 },
|
|
165
|
+
STANDOC_53: { category: "Bibliography",
|
|
166
|
+
error: "Bibliographic spans: %s",
|
|
167
|
+
severity: 1 },
|
|
168
|
+
STANDOC_54: { category: "Bibliography",
|
|
169
|
+
error: "Cannot process file %s for local Relaton data source %s",
|
|
170
|
+
severity: 0 },
|
|
171
|
+
STANDOC_55: { category: "Images",
|
|
172
|
+
error: "Corrupt SVG image detected, error found: %s %s%s%s",
|
|
173
|
+
severity: 2 },
|
|
174
|
+
STANDOC_56: { category: "Images",
|
|
175
|
+
error: "Corrupt SVG image detected, could not be fixed: %s %s%s%s",
|
|
176
|
+
severity: 1 },
|
|
177
|
+
STANDOC_57: { category: "Images",
|
|
178
|
+
error: "SVG image warning: %s %s%s%s",
|
|
179
|
+
severity: 3 },
|
|
180
|
+
STANDOC_58: { category: "Images",
|
|
181
|
+
error: "Corrupt SVG image detected, fix attempted: %s %s: %s %s, Node: %s",
|
|
182
|
+
severity: 2 },
|
|
183
|
+
STANDOC_59: { category: "Images",
|
|
184
|
+
error: "SVG unresolved internal reference: %s line %s",
|
|
185
|
+
severity: 3 },
|
|
186
|
+
STANDOC_60: { category: "Bibliography",
|
|
187
|
+
error: "Unrecognised bibliographic style: %s",
|
|
188
|
+
severity: 1 },
|
|
189
|
+
STANDOC_61: { category: "AsciiDoc Input",
|
|
190
|
+
error: "Improperly nested sourcecode markup: %s",
|
|
191
|
+
severity: 0 },
|
|
192
|
+
STANDOC_62: { category: "Crossreferences",
|
|
193
|
+
error: "Sourcecode with callout markup but no annotations",
|
|
194
|
+
severity: 1 },
|
|
195
|
+
STANDOC_63: { category: "Images",
|
|
196
|
+
error: "Warning on PNG image: %s",
|
|
197
|
+
severity: 3 },
|
|
198
|
+
RELATON_1: { category: "Relaton",
|
|
199
|
+
error: "(Error from Relaton) %s",
|
|
200
|
+
severity: 0 },
|
|
201
|
+
RELATON_2: { category: "Relaton",
|
|
202
|
+
error: "(Error from Relaton) %s",
|
|
203
|
+
severity: 1 },
|
|
204
|
+
RELATON_3: { category: "Relaton",
|
|
205
|
+
error: "(Error from Relaton) %s",
|
|
206
|
+
severity: 2 },
|
|
207
|
+
RELATON_4: { category: "Relaton",
|
|
208
|
+
error: "(Error from Relaton) %s",
|
|
209
|
+
severity: 3 },
|
|
210
|
+
RELATON_5: { category: "Relaton",
|
|
211
|
+
error: "(Error from Relaton IEV) %s",
|
|
212
|
+
severity: 0 },
|
|
213
213
|
|
|
214
214
|
}.freeze
|
|
215
215
|
# rubocop:enable Naming/VariableNumber
|
|
@@ -105,7 +105,7 @@ module Metanorma
|
|
|
105
105
|
class ConceptInlineMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
|
106
106
|
use_dsl
|
|
107
107
|
named :concept
|
|
108
|
-
match
|
|
108
|
+
match /(?<!\{)\{\{(?!\{)(?<content>|.*?[^\\])\}\}(?!\})/m
|
|
109
109
|
using_format :short
|
|
110
110
|
|
|
111
111
|
def preprocess_attrs(target)
|
|
@@ -25,13 +25,18 @@ module Metanorma
|
|
|
25
25
|
!node.attr("type") &&
|
|
26
26
|
!%w(requirement recommendation permission).include?(type) and
|
|
27
27
|
node.set_attr("type", type)
|
|
28
|
-
|
|
29
|
-
.merge(model: @reqt_model_name)
|
|
30
|
-
ret = @reqt_model.requirement(node, obligation, attrs)
|
|
28
|
+
ret = @reqt_model.requirement(node, obligation, requirement_attrs(node))
|
|
31
29
|
@reqt_model = nil unless nested
|
|
32
30
|
ret
|
|
33
31
|
end
|
|
34
32
|
|
|
33
|
+
def requirement_attrs(node)
|
|
34
|
+
keep_attrs(node).merge(id_unnum_attrs(node))
|
|
35
|
+
.merge({ model: @reqt_model_name,
|
|
36
|
+
render: node.attr("render") || @default_requirement_render }
|
|
37
|
+
.compact)
|
|
38
|
+
end
|
|
39
|
+
|
|
35
40
|
def requirement_validate(docxml)
|
|
36
41
|
docxml.xpath("//requirement | //recommendation | //permission")
|
|
37
42
|
.each do |r|
|
|
@@ -4,13 +4,15 @@ require "htmlentities"
|
|
|
4
4
|
require "json"
|
|
5
5
|
require "pathname"
|
|
6
6
|
require "uuidtools"
|
|
7
|
+
require "metanorma-core"
|
|
7
8
|
require_relative "../../nokogiri/xml/builder"
|
|
8
9
|
require_relative "date_utils"
|
|
9
|
-
require_relative "isolated_converter"
|
|
10
10
|
|
|
11
11
|
module Metanorma
|
|
12
12
|
module Standoc
|
|
13
13
|
module Utils
|
|
14
|
+
include ::Metanorma::Core::Boilerplate
|
|
15
|
+
|
|
14
16
|
def convert(node, transform = nil, opts = {})
|
|
15
17
|
transform ||= node.node_name
|
|
16
18
|
opts.empty? ? (send transform, node) : (send transform, node, opts)
|
|
@@ -91,14 +93,9 @@ module Metanorma
|
|
|
91
93
|
|
|
92
94
|
def isodoc(lang, script, locale, i18nyaml = nil)
|
|
93
95
|
conv = presentation_xml_converter(EmptyAttr.new)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
conv.meta.localdir = @localdir
|
|
98
|
-
conv.xref_init(lang, script, nil, i18n, {})
|
|
99
|
-
conv.xrefs.klass.meta = conv.meta
|
|
100
|
-
conv.xrefs.klass.localdir = @localdir
|
|
101
|
-
conv
|
|
96
|
+
Metanorma::Core::Isodoc.init(conv, lang: lang, script: script,
|
|
97
|
+
locale: locale, i18nyaml: i18nyaml,
|
|
98
|
+
localdir: @localdir)
|
|
102
99
|
end
|
|
103
100
|
|
|
104
101
|
def dl_to_attrs(elem, dlist, name)
|
|
@@ -146,24 +143,13 @@ module Metanorma
|
|
|
146
143
|
SECTION_CONTAINERS
|
|
147
144
|
end
|
|
148
145
|
|
|
149
|
-
#
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
:semantic-metadata-headless: true
|
|
157
|
-
:no-isobib:
|
|
158
|
-
#{f}:novalid:
|
|
159
|
-
:!sectids:
|
|
160
|
-
|
|
161
|
-
#{text}
|
|
162
|
-
ADOC
|
|
163
|
-
c = isolated_asciidoctor_convert(doc, backend: flavour,
|
|
164
|
-
header_footer: true)
|
|
165
|
-
ret = Nokogiri::XML(c).at("//xmlns:sections")
|
|
166
|
-
separate_numbering_footnotes(ret)
|
|
146
|
+
# Shadow metanorma-core's adoc2xml so the standoc converter context
|
|
147
|
+
# gets externally-sourced footnotes renumbered automatically
|
|
148
|
+
# (preserving the existing direct-caller behaviour: process_boilerplate_file
|
|
149
|
+
# in cleanup, header conversion in dochistory).
|
|
150
|
+
def adoc2xml(text, flavour, flush_caches: false, localdir: nil)
|
|
151
|
+
ret = super
|
|
152
|
+
ret.is_a?(Nokogiri::XML::Node) ? separate_numbering_footnotes(ret) : ret
|
|
167
153
|
end
|
|
168
154
|
|
|
169
155
|
# separate numbering of externally sourced footnotes
|
|
@@ -199,28 +185,18 @@ module Metanorma
|
|
|
199
185
|
end
|
|
200
186
|
|
|
201
187
|
def add_noko_elem(node, name, val, attrs = {})
|
|
202
|
-
val and !val.empty? or return
|
|
188
|
+
(val and !val.empty?) or return
|
|
203
189
|
node.send name, **attr_code(attrs) do |n|
|
|
204
190
|
n << val
|
|
205
191
|
end
|
|
206
192
|
end
|
|
207
193
|
|
|
208
|
-
module_function :adoc2xml
|
|
209
|
-
|
|
210
194
|
def textcleanup(result)
|
|
211
195
|
text = result.flatten.map(&:rstrip) * "\n"
|
|
212
196
|
text.gsub(/(?<!\s)\s+<fn /, "<fn ")
|
|
213
197
|
end
|
|
214
|
-
|
|
215
|
-
class EmptyAttr
|
|
216
|
-
def attr(_any_attribute)
|
|
217
|
-
nil
|
|
218
|
-
end
|
|
219
|
-
|
|
220
|
-
def attributes
|
|
221
|
-
{}
|
|
222
|
-
end
|
|
223
|
-
end
|
|
224
198
|
end
|
|
199
|
+
|
|
200
|
+
EmptyAttr = Metanorma::Core::Isodoc::EmptyNode
|
|
225
201
|
end
|
|
226
202
|
end
|
data/lib/metanorma-standoc.rb
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
require "asciidoctor" unless defined? Asciidoctor::Converter
|
|
2
|
+
require_relative "isodoc/standoc/presentation_xml_convert"
|
|
2
3
|
require_relative "isodoc/standoc/pdf_convert"
|
|
3
4
|
require_relative "metanorma/converter/converter"
|
|
4
5
|
require_relative "metanorma/converter/version"
|
|
5
6
|
require "asciidoctor/extensions"
|
|
6
|
-
require "metanorma"
|
|
7
|
+
require "metanorma-core"
|
|
7
8
|
require "vectory"
|
|
8
9
|
|
|
9
10
|
if defined? Metanorma::Registry
|
data/metanorma-standoc.gemspec
CHANGED
|
@@ -32,8 +32,8 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
|
33
33
|
spec.add_dependency "crass", "~> 1.0.0"
|
|
34
34
|
# spec.add_dependency "iev", "~> 0.3.5"
|
|
35
|
-
spec.add_dependency "isodoc", "~> 3.
|
|
36
|
-
spec.add_dependency "metanorma", "
|
|
35
|
+
spec.add_dependency "isodoc", "~> 3.6.0"
|
|
36
|
+
spec.add_dependency "metanorma-core", "~> 0.2.0"
|
|
37
37
|
spec.add_dependency "metanorma-plugin-glossarist", "~> 0.3.0"
|
|
38
38
|
spec.add_dependency "metanorma-plugin-lutaml", "~> 0.7.31"
|
|
39
39
|
spec.add_dependency "metanorma-plugin-plantuml", "~> 1.0.0"
|
|
@@ -41,12 +41,12 @@ Gem::Specification.new do |spec|
|
|
|
41
41
|
spec.add_dependency "ruby-jing"
|
|
42
42
|
# relaton-cli not just relaton, to avoid circular reference in metanorma
|
|
43
43
|
spec.add_dependency "concurrent-ruby"
|
|
44
|
-
spec.add_dependency "
|
|
44
|
+
spec.add_dependency "png_conform", "~> 0.1.0"
|
|
45
|
+
spec.add_dependency "relaton-cli", "~> 2.1.0"
|
|
45
46
|
spec.add_dependency "relaton-iev", "~> 2.0.0"
|
|
46
47
|
spec.add_dependency "svg_conform", "~> 0.1.0"
|
|
47
|
-
spec.add_dependency "png_conform", "~> 0.1.0"
|
|
48
48
|
|
|
49
|
-
spec.add_development_dependency "canon", "= 0.
|
|
49
|
+
spec.add_development_dependency "canon" # , "= 0.2.3"
|
|
50
50
|
spec.add_development_dependency "debug"
|
|
51
51
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
|
52
52
|
spec.add_development_dependency "guard", "~> 2.14"
|
|
@@ -61,4 +61,5 @@ Gem::Specification.new do |spec|
|
|
|
61
61
|
spec.add_development_dependency "vcr", "~> 6.1.0"
|
|
62
62
|
spec.add_development_dependency "webmock"
|
|
63
63
|
# spec.metadata["rubygems_mfa_required"] = "true"
|
|
64
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
64
65
|
end
|
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.4.
|
|
4
|
+
version: 3.4.2
|
|
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-05-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -58,28 +58,28 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 3.
|
|
61
|
+
version: 3.6.0
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 3.
|
|
68
|
+
version: 3.6.0
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: metanorma
|
|
70
|
+
name: metanorma-core
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- - "
|
|
73
|
+
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: 0.2.0
|
|
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:
|
|
82
|
+
version: 0.2.0
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: metanorma-plugin-glossarist
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -165,49 +165,49 @@ dependencies:
|
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: '0'
|
|
167
167
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
168
|
+
name: png_conform
|
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
|
170
170
|
requirements:
|
|
171
171
|
- - "~>"
|
|
172
172
|
- !ruby/object:Gem::Version
|
|
173
|
-
version:
|
|
173
|
+
version: 0.1.0
|
|
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:
|
|
180
|
+
version: 0.1.0
|
|
181
181
|
- !ruby/object:Gem::Dependency
|
|
182
|
-
name: relaton-
|
|
182
|
+
name: relaton-cli
|
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
|
185
185
|
- - "~>"
|
|
186
186
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: 2.
|
|
187
|
+
version: 2.1.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: 2.
|
|
194
|
+
version: 2.1.0
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name:
|
|
196
|
+
name: relaton-iev
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
199
|
- - "~>"
|
|
200
200
|
- !ruby/object:Gem::Version
|
|
201
|
-
version: 0.
|
|
201
|
+
version: 2.0.0
|
|
202
202
|
type: :runtime
|
|
203
203
|
prerelease: false
|
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements:
|
|
206
206
|
- - "~>"
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: 0.
|
|
208
|
+
version: 2.0.0
|
|
209
209
|
- !ruby/object:Gem::Dependency
|
|
210
|
-
name:
|
|
210
|
+
name: svg_conform
|
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
|
212
212
|
requirements:
|
|
213
213
|
- - "~>"
|
|
@@ -224,16 +224,16 @@ dependencies:
|
|
|
224
224
|
name: canon
|
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
|
226
226
|
requirements:
|
|
227
|
-
- -
|
|
227
|
+
- - ">="
|
|
228
228
|
- !ruby/object:Gem::Version
|
|
229
|
-
version: 0
|
|
229
|
+
version: '0'
|
|
230
230
|
type: :development
|
|
231
231
|
prerelease: false
|
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
|
233
233
|
requirements:
|
|
234
|
-
- -
|
|
234
|
+
- - ">="
|
|
235
235
|
- !ruby/object:Gem::Version
|
|
236
|
-
version: 0
|
|
236
|
+
version: '0'
|
|
237
237
|
- !ruby/object:Gem::Dependency
|
|
238
238
|
name: debug
|
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -444,6 +444,7 @@ files:
|
|
|
444
444
|
- lib/isodoc/html/htmlstyle.scss
|
|
445
445
|
- lib/isodoc/html/scripts.html
|
|
446
446
|
- lib/isodoc/standoc/pdf_convert.rb
|
|
447
|
+
- lib/isodoc/standoc/presentation_xml_convert.rb
|
|
447
448
|
- lib/metanorma-standoc.rb
|
|
448
449
|
- lib/metanorma/cleanup/amend.rb
|
|
449
450
|
- lib/metanorma/cleanup/asciibib.rb
|
|
@@ -497,7 +498,6 @@ files:
|
|
|
497
498
|
- lib/metanorma/converter/front_title.rb
|
|
498
499
|
- lib/metanorma/converter/init.rb
|
|
499
500
|
- lib/metanorma/converter/inline.rb
|
|
500
|
-
- lib/metanorma/converter/isolated_converter.rb
|
|
501
501
|
- lib/metanorma/converter/lists.rb
|
|
502
502
|
- lib/metanorma/converter/localbib.rb
|
|
503
503
|
- lib/metanorma/converter/log.rb
|
|
@@ -542,7 +542,8 @@ files:
|
|
|
542
542
|
homepage: https://github.com/metanorma/metanorma-standoc
|
|
543
543
|
licenses:
|
|
544
544
|
- BSD-2-Clause
|
|
545
|
-
metadata:
|
|
545
|
+
metadata:
|
|
546
|
+
rubygems_mfa_required: 'true'
|
|
546
547
|
post_install_message:
|
|
547
548
|
rdoc_options: []
|
|
548
549
|
require_paths:
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
module Metanorma
|
|
2
|
-
module Standoc
|
|
3
|
-
module Utils
|
|
4
|
-
# Create an isolated Asciidoctor conversion that doesn't interfere with
|
|
5
|
-
# the current converter's instance variables
|
|
6
|
-
def isolated_asciidoctor_convert(content, options = {})
|
|
7
|
-
# Track that we're in an isolated conversion (for nested calls)
|
|
8
|
-
@isolated_conversion_stack ||= []
|
|
9
|
-
@isolated_conversion_stack << true
|
|
10
|
-
|
|
11
|
-
begin
|
|
12
|
-
preserved_options = extract_preserved_options(options)
|
|
13
|
-
# Merge with isolated options to ensure clean state and skip validation
|
|
14
|
-
isolated_options = preserved_options.merge(options).merge(
|
|
15
|
-
attributes: (preserved_options[:attributes] || {}).merge(
|
|
16
|
-
"novalid" => "", # Force no validation for isolated documents
|
|
17
|
-
),
|
|
18
|
-
)
|
|
19
|
-
Asciidoctor.convert(content, isolated_options)
|
|
20
|
-
ensure
|
|
21
|
-
@isolated_conversion_stack.pop
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
# Extract options that should be preserved from the current conversion context
|
|
28
|
-
def extract_preserved_options(user_opt)
|
|
29
|
-
options = {}
|
|
30
|
-
|
|
31
|
-
# Preserve safe mode to maintain security context
|
|
32
|
-
options[:safe] = user_opt[:safe] if user_opt.key?(:safe)
|
|
33
|
-
|
|
34
|
-
# Preserve local directory context if not explicitly overridden
|
|
35
|
-
@localdir && !user_opt.key?(:base_dir) and
|
|
36
|
-
options[:base_dir] = @localdir
|
|
37
|
-
|
|
38
|
-
# Preserve attributes that are safe to share
|
|
39
|
-
user_opt[:attributes].nil? && respond_to?(:safe_shared_attributes) and
|
|
40
|
-
options[:attributes] = safe_shared_attributes
|
|
41
|
-
|
|
42
|
-
options
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Define attributes that are safe to share between converter instances
|
|
46
|
-
def safe_shared_attributes
|
|
47
|
-
# Only include read-only or configuration attributes
|
|
48
|
-
# Avoid any attributes that could cause state pollution
|
|
49
|
-
{
|
|
50
|
-
"source-highlighter" => "html-pipeline", # Use simple highlighter
|
|
51
|
-
"nofooter" => "",
|
|
52
|
-
"no-header-footer" => "",
|
|
53
|
-
}
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|