metanorma-standoc 1.6.5 → 1.8.1
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/.github/workflows/rake.yml +17 -0
- data/lib/asciidoctor/standoc/base.rb +31 -44
- data/lib/asciidoctor/standoc/basicdoc.rng +20 -3
- data/lib/asciidoctor/standoc/blocks.rb +7 -7
- data/lib/asciidoctor/standoc/blocks_notes.rb +2 -2
- data/lib/asciidoctor/standoc/cleanup.rb +5 -6
- data/lib/asciidoctor/standoc/cleanup_block.rb +3 -11
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +89 -20
- data/lib/asciidoctor/standoc/cleanup_inline.rb +23 -25
- data/lib/asciidoctor/standoc/cleanup_ref.rb +0 -85
- data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +94 -0
- data/lib/asciidoctor/standoc/cleanup_terms.rb +1 -6
- data/lib/asciidoctor/standoc/converter.rb +2 -51
- data/lib/asciidoctor/standoc/front.rb +2 -2
- data/lib/asciidoctor/standoc/front_contributor.rb +8 -4
- data/lib/asciidoctor/standoc/inline.rb +8 -6
- data/lib/asciidoctor/standoc/isodoc.rng +36 -3
- data/lib/asciidoctor/standoc/lists.rb +2 -2
- data/lib/asciidoctor/standoc/macros.rb +14 -1
- data/lib/asciidoctor/standoc/macros_plantuml.rb +1 -1
- data/lib/asciidoctor/standoc/ref_sect.rb +2 -2
- data/lib/asciidoctor/standoc/reqt.rb +6 -1
- data/lib/asciidoctor/standoc/section.rb +14 -89
- data/lib/asciidoctor/standoc/table.rb +1 -1
- data/lib/asciidoctor/standoc/terms.rb +125 -0
- data/lib/asciidoctor/standoc/utils.rb +2 -94
- data/lib/metanorma/standoc/version.rb +1 -1
- data/metanorma-standoc.gemspec +2 -3
- data/spec/asciidoctor-standoc/base_spec.rb +44 -9
- data/spec/asciidoctor-standoc/blocks_spec.rb +6 -1
- data/spec/asciidoctor-standoc/cleanup_sections_spec.rb +12 -7
- data/spec/asciidoctor-standoc/cleanup_spec.rb +116 -4
- data/spec/asciidoctor-standoc/inline_spec.rb +4 -5
- data/spec/asciidoctor-standoc/isobib_cache_spec.rb +4 -4
- data/spec/asciidoctor-standoc/macros_lutaml_spec.rb +1 -1
- data/spec/asciidoctor-standoc/macros_spec.rb +30 -0
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +17 -5
- data/spec/asciidoctor-standoc/refs_spec.rb +12 -12
- data/spec/asciidoctor-standoc/section_spec.rb +149 -4
- data/spec/asciidoctor-standoc/table_spec.rb +60 -0
- data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +48 -48
- data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
- data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
- data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +36 -36
- data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
- data/spec/vcr_cassettes/isobib_get_124.yml +14 -14
- data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +8 -8
- data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +65 -59
- metadata +18 -31
- data/lib/asciidoctor/standoc/log.rb +0 -59
@@ -5,103 +5,11 @@ require "json"
|
|
5
5
|
require "pathname"
|
6
6
|
require "open-uri"
|
7
7
|
require "uuidtools"
|
8
|
-
require "sterile"
|
9
8
|
require "mimemagic"
|
10
9
|
|
11
10
|
module Asciidoctor
|
12
11
|
module Standoc
|
13
12
|
module Utils
|
14
|
-
class << self
|
15
|
-
def anchor_or_uuid(node = nil)
|
16
|
-
uuid = UUIDTools::UUID.random_create
|
17
|
-
node.nil? || node.id.nil? || node.id.empty? ? "_" + uuid : node.id
|
18
|
-
end
|
19
|
-
|
20
|
-
def asciidoc_sub(x)
|
21
|
-
return nil if x.nil?
|
22
|
-
return "" if x.empty?
|
23
|
-
d = Asciidoctor::Document.new(x.lines.entries, { header_footer: false,
|
24
|
-
backend: :standoc })
|
25
|
-
b = d.parse.blocks.first
|
26
|
-
b.apply_subs(b.source)
|
27
|
-
end
|
28
|
-
|
29
|
-
def localdir(node)
|
30
|
-
docfile = node.attr("docfile")
|
31
|
-
docfile.nil? ? './' : Pathname.new(docfile).parent.to_s + '/'
|
32
|
-
end
|
33
|
-
|
34
|
-
def smartformat(n)
|
35
|
-
n.gsub(/ --? /, " — ").
|
36
|
-
gsub(/--/, "—").smart_format.gsub(/</, "<").gsub(/>/, ">")
|
37
|
-
end
|
38
|
-
|
39
|
-
def endash_date(elem)
|
40
|
-
elem.traverse do |n|
|
41
|
-
n.text? and n.replace(n.text.gsub(/\s+--?\s+/, "–").gsub(/--/, "–"))
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# Set hash value using keys path
|
46
|
-
# mod from https://stackoverflow.com/a/42425884
|
47
|
-
def set_nested_value(hash, keys, new_val)
|
48
|
-
key = keys[0]
|
49
|
-
if keys.length == 1
|
50
|
-
hash[key] = hash[key].is_a?(Array) ? (hash[key] << new_val) :
|
51
|
-
hash[key].nil? ? new_val : [hash[key], new_val]
|
52
|
-
return hash
|
53
|
-
end
|
54
|
-
if hash[key].is_a?(Array)
|
55
|
-
hash[key][-1] = {} if hash[key][-1].nil?
|
56
|
-
set_nested_value(hash[key][-1], keys[1..-1], new_val)
|
57
|
-
elsif hash[key].nil? || hash[key].empty?
|
58
|
-
hash[key] = {}
|
59
|
-
set_nested_value(hash[key], keys[1..-1], new_val)
|
60
|
-
elsif hash[key].is_a?(Hash) && !hash[key][keys[1]]
|
61
|
-
set_nested_value(hash[key], keys[1..-1], new_val)
|
62
|
-
elsif !hash[key][keys[1]]
|
63
|
-
hash[key] = [hash[key], {}]
|
64
|
-
set_nested_value(hash[key][-1], keys[1..-1], new_val)
|
65
|
-
else
|
66
|
-
set_nested_value(hash[key], keys[1..-1], new_val)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def flatten_rawtext_lines(node, result)
|
71
|
-
node.lines.each do |x|
|
72
|
-
if node.respond_to?(:context) && (node.context == :literal ||
|
73
|
-
node.context == :listing)
|
74
|
-
result << x.gsub(/</, "<").gsub(/>/, ">")
|
75
|
-
else
|
76
|
-
# strip not only HTML <tag>, and Asciidoc xrefs <<xref>>
|
77
|
-
result << x.gsub(/<[^>]*>+/, "")
|
78
|
-
end
|
79
|
-
end
|
80
|
-
result
|
81
|
-
end
|
82
|
-
|
83
|
-
# if node contains blocks, flatten them into a single line;
|
84
|
-
# and extract only raw text
|
85
|
-
def flatten_rawtext(node)
|
86
|
-
result = []
|
87
|
-
if node.respond_to?(:blocks) && node.blocks?
|
88
|
-
node.blocks.each { |b| result << flatten_rawtext(b) }
|
89
|
-
elsif node.respond_to?(:lines)
|
90
|
-
result = flatten_rawtext_lines(node, result)
|
91
|
-
elsif node.respond_to?(:text)
|
92
|
-
result << node.text.gsub(/<[^>]*>+/, "")
|
93
|
-
else
|
94
|
-
result << node.content.gsub(/<[^>]*>+/, "")
|
95
|
-
end
|
96
|
-
result.reject(&:empty?)
|
97
|
-
end
|
98
|
-
|
99
|
-
def reqt_subpart(x)
|
100
|
-
%w(specification measurement-target verification import label
|
101
|
-
subject inherit classification title).include? x
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
13
|
def convert(node, transform = nil, opts = {})
|
106
14
|
transform ||= node.node_name
|
107
15
|
opts.empty? ? (send transform, node) : (send transform, node, opts)
|
@@ -175,14 +83,14 @@ module Asciidoctor
|
|
175
83
|
SUBCLAUSE_XPATH = "//clause[not(parent::sections)]"\
|
176
84
|
"[not(ancestor::boilerplate)]".freeze
|
177
85
|
|
178
|
-
|
86
|
+
def isodoc(lang, script, i18nyaml = nil)
|
179
87
|
conv = html_converter(EmptyAttr.new)
|
180
88
|
i18n = conv.i18n_init(lang, script, i18nyaml)
|
181
89
|
conv.metadata_init(lang, script, i18n)
|
182
90
|
conv
|
183
91
|
end
|
184
92
|
|
185
|
-
|
93
|
+
class EmptyAttr
|
186
94
|
def attr(_x)
|
187
95
|
nil
|
188
96
|
end
|
data/metanorma-standoc.gemspec
CHANGED
@@ -28,20 +28,19 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_dependency "asciidoctor", "~> 2.0.0"
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
|
-
spec.add_dependency "isodoc", "~> 1.
|
31
|
+
spec.add_dependency "isodoc", "~> 1.5.0"
|
32
32
|
spec.add_dependency "iev", "~> 0.2.1"
|
33
33
|
spec.add_dependency "metanorma-plugin-datastruct"
|
34
34
|
spec.add_dependency "metanorma-plugin-lutaml", "~> 0.2.1"
|
35
35
|
# relaton-cli not just relaton, to avoid circular reference in metanorma
|
36
36
|
spec.add_dependency "relaton-cli", "~> 1.7.0"
|
37
37
|
spec.add_dependency "relaton-iev", "~> 1.1.0"
|
38
|
-
spec.add_dependency "sterile", "~> 1.0.14"
|
39
38
|
spec.add_dependency "concurrent-ruby"
|
40
39
|
spec.add_dependency "unicode2latex", "~> 0.0.1"
|
40
|
+
spec.add_dependency "metanorma-utils", "~> 1"
|
41
41
|
spec.add_dependency "mimemagic"
|
42
42
|
spec.add_dependency "mathml2asciimath"
|
43
43
|
spec.add_dependency "latexmath"
|
44
|
-
spec.add_dependency "fontist", "~> 1.5.0"
|
45
44
|
|
46
45
|
spec.add_development_dependency "byebug"
|
47
46
|
spec.add_development_dependency "sassc", "2.4.0"
|
@@ -32,7 +32,36 @@ RSpec.describe Asciidoctor::Standoc do
|
|
32
32
|
expect(File.exist?("htmlstyle.css")).to be false
|
33
33
|
end
|
34
34
|
|
35
|
-
it "
|
35
|
+
it "assigns default scripts to major languages" do
|
36
|
+
FileUtils.rm_f "test.doc"
|
37
|
+
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
38
|
+
= Document title
|
39
|
+
Author
|
40
|
+
:docfile: test.adoc
|
41
|
+
:novalid:
|
42
|
+
:language: ar
|
43
|
+
INPUT
|
44
|
+
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
|
45
|
+
<bibdata type='standard'>
|
46
|
+
<title language='en' format='text/plain'>Document title</title>
|
47
|
+
<language>ar</language>
|
48
|
+
<script>Arab</script>
|
49
|
+
<status>
|
50
|
+
<stage>published</stage>
|
51
|
+
</status>
|
52
|
+
<copyright>
|
53
|
+
<from>2021</from>
|
54
|
+
</copyright>
|
55
|
+
<ext>
|
56
|
+
<doctype>article</doctype>
|
57
|
+
</ext>
|
58
|
+
</bibdata>
|
59
|
+
<sections> </sections>
|
60
|
+
</standard-document>
|
61
|
+
OUTPUT
|
62
|
+
end
|
63
|
+
|
64
|
+
it "processes publisher abbreviations" do
|
36
65
|
mock_org_abbrevs
|
37
66
|
expect(xmlpp(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
38
67
|
= Document title
|
@@ -40,7 +69,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
40
69
|
:docfile: test.adoc
|
41
70
|
:nodoc:
|
42
71
|
:novalid:
|
43
|
-
:publisher: International Electrotechnical Commission
|
72
|
+
:publisher: International Electrotechnical Commission;IETF;ISO
|
44
73
|
INPUT
|
45
74
|
<standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
|
46
75
|
<bibdata type='standard'>
|
@@ -91,7 +120,7 @@ INPUT
|
|
91
120
|
<stage>published</stage>
|
92
121
|
</status>
|
93
122
|
<copyright>
|
94
|
-
<from
|
123
|
+
<from>#{Time.now.year}</from>
|
95
124
|
<owner>
|
96
125
|
<organization>
|
97
126
|
<name>International Electrotechnical Commission</name>
|
@@ -100,7 +129,7 @@ INPUT
|
|
100
129
|
</owner>
|
101
130
|
</copyright>
|
102
131
|
<copyright>
|
103
|
-
<from
|
132
|
+
<from>#{Time.now.year}</from>
|
104
133
|
<owner>
|
105
134
|
<organization>
|
106
135
|
<name>IETF</name>
|
@@ -108,7 +137,7 @@ INPUT
|
|
108
137
|
</owner>
|
109
138
|
</copyright>
|
110
139
|
<copyright>
|
111
|
-
<from
|
140
|
+
<from>#{Time.now.year}</from>
|
112
141
|
<owner>
|
113
142
|
<organization>
|
114
143
|
<name>International Standards Organization</name>
|
@@ -181,6 +210,7 @@ OUTPUT
|
|
181
210
|
:role: author
|
182
211
|
:affiliation: Slate Rock and Gravel Company
|
183
212
|
:affiliation_abbrev: SRG
|
213
|
+
:affiliation_subdiv: Hermeneutics Unit; Exegetical Subunit
|
184
214
|
:address: 6 Rubble Way, Bedrock
|
185
215
|
:contributor-uri: http://slate.example.com
|
186
216
|
:phone: 123
|
@@ -191,13 +221,14 @@ OUTPUT
|
|
191
221
|
:role_2: editor
|
192
222
|
:affiliation_2: Rockhead and Quarry Cave Construction Company
|
193
223
|
:affiliation_abbrev_2: RQCCC
|
224
|
+
:affiliation_subdiv_2: Hermeneutics Unit; Exegetical Subunit
|
194
225
|
:address_2: 6A Rubble Way, + \\
|
195
226
|
Bedrock
|
196
227
|
:email_2: barney@rockhead.example.com
|
197
228
|
:phone_2: 789
|
198
229
|
:fax_2: 012
|
199
|
-
:publisher: "Hanna Barbera"
|
200
|
-
:copyright-holder: "Ribose, Inc."
|
230
|
+
:publisher: "Hanna Barbera"; "Cartoon Network"; "Ribose, Inc."
|
231
|
+
:copyright-holder: "Ribose, Inc."; Hanna Barbera
|
201
232
|
:part-of: ABC
|
202
233
|
:translated-from: DEF,GHI;JKL MNO,PQR
|
203
234
|
:keywords: a, b, c
|
@@ -288,6 +319,8 @@ OUTPUT
|
|
288
319
|
<organization>
|
289
320
|
<name>Slate Rock and Gravel Company</name>
|
290
321
|
<abbreviation>SRG</abbreviation>
|
322
|
+
<subdivision>Hermeneutics Unit</subdivision>
|
323
|
+
<subdivision>Exegetical Subunit</subdivision>
|
291
324
|
<address>
|
292
325
|
<formattedAddress>
|
293
326
|
6 Rubble Way, Bedrock
|
@@ -312,6 +345,8 @@ OUTPUT
|
|
312
345
|
<organization>
|
313
346
|
<name>Rockhead and Quarry Cave Construction Company</name>
|
314
347
|
<abbreviation>RQCCC</abbreviation>
|
348
|
+
<subdivision>Hermeneutics Unit</subdivision>
|
349
|
+
<subdivision>Exegetical Subunit</subdivision>
|
315
350
|
<address>
|
316
351
|
<formattedAddress>6A Rubble Way, <br/>Bedrock</formattedAddress>
|
317
352
|
</address>
|
@@ -425,7 +460,7 @@ OUTPUT
|
|
425
460
|
:tc-docnumber: 2000
|
426
461
|
:language: el
|
427
462
|
:script: Grek
|
428
|
-
:publisher: IEC
|
463
|
+
:publisher: IEC;IETF;ISO
|
429
464
|
:uri: A
|
430
465
|
:xml-uri: B
|
431
466
|
:html-uri: C
|
@@ -623,7 +658,7 @@ OUTPUT
|
|
623
658
|
<stage>published</stage>
|
624
659
|
</status>
|
625
660
|
<copyright>
|
626
|
-
<from
|
661
|
+
<from>#{Time.now.year}</from>
|
627
662
|
<owner>
|
628
663
|
<organization>
|
629
664
|
<name>International Standards Organization</name>
|
@@ -340,7 +340,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
340
340
|
|
341
341
|
NOTE: This is not a termnote
|
342
342
|
|
343
|
-
|
343
|
+
====
|
344
|
+
This is not a termexample
|
345
|
+
====
|
344
346
|
|
345
347
|
[.nonterm]
|
346
348
|
=== Term1
|
@@ -355,6 +357,9 @@ RSpec.describe Asciidoctor::Standoc do
|
|
355
357
|
<note id='_'>
|
356
358
|
<p id='_'>This is not a termnote</p>
|
357
359
|
</note>
|
360
|
+
<example id='_'>
|
361
|
+
<p id='_'>This is not a termexample</p>
|
362
|
+
</example>
|
358
363
|
<clause id="_" inline-header="false" obligation="normative">
|
359
364
|
<title>Term1</title>
|
360
365
|
<note id="_">
|
@@ -3,7 +3,7 @@ require "relaton_iec"
|
|
3
3
|
require "fileutils"
|
4
4
|
|
5
5
|
RSpec.describe Asciidoctor::Standoc do
|
6
|
-
it "
|
6
|
+
it "appends any initial user-supplied text to boilerplate in terms and definitions" do
|
7
7
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
8
8
|
#{ASCIIDOC_BLANK_HDR}
|
9
9
|
== Terms and Definitions
|
@@ -20,7 +20,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
20
20
|
<sections>
|
21
21
|
<terms id="_" obligation="normative"><title>Terms and definitions</title>
|
22
22
|
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
23
|
-
|
23
|
+
<p id='_'>I am boilerplate</p>
|
24
|
+
<ul id='_'>
|
25
|
+
<li>
|
26
|
+
<p id='_'>So am I</p>
|
27
|
+
</li>
|
28
|
+
</ul>
|
24
29
|
<term id="term-time">
|
25
30
|
<preferred>Time</preferred>
|
26
31
|
<definition><p id="_">This paragraph is extraneous</p></definition>
|
@@ -400,7 +405,7 @@ INPUT
|
|
400
405
|
<stage>published</stage>
|
401
406
|
</status>
|
402
407
|
<copyright>
|
403
|
-
<from
|
408
|
+
<from>#{Time.now.year}</from>
|
404
409
|
</copyright>
|
405
410
|
<ext>
|
406
411
|
<doctype>article</doctype>
|
@@ -692,7 +697,7 @@ INPUT
|
|
692
697
|
<stage>published</stage>
|
693
698
|
</status>
|
694
699
|
<copyright>
|
695
|
-
<from
|
700
|
+
<from>#{Time.now.year}</from>
|
696
701
|
</copyright>
|
697
702
|
<ext>
|
698
703
|
<doctype>article</doctype>
|
@@ -923,7 +928,7 @@ INPUT
|
|
923
928
|
<stage>published</stage>
|
924
929
|
</status>
|
925
930
|
<copyright>
|
926
|
-
<from
|
931
|
+
<from>#{Time.now.year}</from>
|
927
932
|
</copyright>
|
928
933
|
<ext>
|
929
934
|
<doctype>article</doctype>
|
@@ -1157,7 +1162,7 @@ INPUT
|
|
1157
1162
|
<stage>published</stage>
|
1158
1163
|
</status>
|
1159
1164
|
<copyright>
|
1160
|
-
<from
|
1165
|
+
<from>#{Time.now.year}</from>
|
1161
1166
|
</copyright>
|
1162
1167
|
<ext>
|
1163
1168
|
<doctype>article</doctype>
|
@@ -1388,7 +1393,7 @@ INPUT
|
|
1388
1393
|
<stage>published</stage>
|
1389
1394
|
</status>
|
1390
1395
|
<copyright>
|
1391
|
-
<from
|
1396
|
+
<from>#{Time.now.year}</from>
|
1392
1397
|
</copyright>
|
1393
1398
|
<ext>
|
1394
1399
|
<doctype>article</doctype>
|
@@ -7,11 +7,14 @@ RSpec.describe Asciidoctor::Standoc do
|
|
7
7
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
8
8
|
#{ASCIIDOC_BLANK_HDR}
|
9
9
|
== "Quotation" A's
|
10
|
+
|
11
|
+
'24:00:00'.
|
10
12
|
INPUT
|
11
13
|
#{BLANK_HDR}
|
12
14
|
<sections>
|
13
15
|
<clause id="_" inline-header="false" obligation="normative">
|
14
16
|
<title>“Quotation” A’s</title>
|
17
|
+
<p id='_'>‘24:00:00’.</p>
|
15
18
|
</clause>
|
16
19
|
</sections>
|
17
20
|
</standard-document>
|
@@ -1864,6 +1867,8 @@ input = <<~INPUT
|
|
1864
1867
|
<<1:>>
|
1865
1868
|
<<1#b>>
|
1866
1869
|
<<:a#b:>>
|
1870
|
+
<</%ab>>
|
1871
|
+
<<1!>>
|
1867
1872
|
|
1868
1873
|
INPUT
|
1869
1874
|
expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).gsub(/<p id="_[^"]+">/, "").gsub('</p>', ""))).to be_equivalent_to (<<~"OUTPUT")
|
@@ -1876,7 +1881,7 @@ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).
|
|
1876
1881
|
<stage>published</stage>
|
1877
1882
|
</status>
|
1878
1883
|
<copyright>
|
1879
|
-
<from
|
1884
|
+
<from>#{Time.now.year}</from>
|
1880
1885
|
</copyright>
|
1881
1886
|
<ext>
|
1882
1887
|
<doctype>article</doctype>
|
@@ -1885,18 +1890,27 @@ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true).
|
|
1885
1890
|
<sections>
|
1886
1891
|
<clause id='a_b' inline-header='false' obligation='normative'>
|
1887
1892
|
<title>A</title>
|
1888
|
-
<
|
1893
|
+
<eref bibitemid='__ab' citeas=''/>
|
1889
1894
|
<xref target='_'/>
|
1890
1895
|
<xref target='_1'/>
|
1891
1896
|
<xref target='_1_'/>
|
1892
1897
|
<xref target='1#b'/>
|
1893
1898
|
<xref target='_a#b_'/>
|
1899
|
+
<xref target='_%ab'/>
|
1900
|
+
<xref target='_1_'/>
|
1894
1901
|
</clause>
|
1895
1902
|
</sections>
|
1903
|
+
<bibliography>
|
1904
|
+
<references hidden='true' normative='false'>
|
1905
|
+
<bibitem id='__ab' type='internal'>
|
1906
|
+
<docidentifier type='repository'>//ab</docidentifier>
|
1907
|
+
</bibitem>
|
1908
|
+
</references>
|
1909
|
+
</bibliography>
|
1896
1910
|
</standard-document>
|
1897
1911
|
OUTPUT
|
1898
1912
|
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <clause id="a_b" inline-header="false" obligation="normative"/> from a:b}).to_stderr
|
1899
|
-
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <
|
1913
|
+
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <eref bibitemid="__ab" citeas=""/> from /_ab}).to_stderr
|
1900
1914
|
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_"/> from :}).to_stderr
|
1901
1915
|
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1"/> from 1}).to_stderr
|
1902
1916
|
expect{Asciidoctor.convert(input, backend: :standoc, header_footer: true)}.to output(%r{normalised identifier in <xref target="_1_"/> from 1:}).to_stderr
|
@@ -1929,7 +1943,7 @@ expect(xmlpp(Asciidoctor.convert(input, backend: :standoc, header_footer: true))
|
|
1929
1943
|
<stage>published</stage>
|
1930
1944
|
</status>
|
1931
1945
|
<copyright>
|
1932
|
-
<from
|
1946
|
+
<from>#{Time.now.year}</from>
|
1933
1947
|
</copyright>
|
1934
1948
|
<ext>
|
1935
1949
|
<doctype>article</doctype>
|
@@ -2106,6 +2120,104 @@ mock_mathml_italicise({ uppergreek: true, upperroman: true, lowergreek: true, lo
|
|
2106
2120
|
|
2107
2121
|
end
|
2108
2122
|
|
2123
|
+
it "process express_ref macro with existing bibliography" do
|
2124
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
2125
|
+
#{ASCIIDOC_BLANK_HDR}
|
2126
|
+
== Clause
|
2127
|
+
|
2128
|
+
<<uml:A:A.B.C,C>>
|
2129
|
+
<<uml:A>>
|
2130
|
+
<<express-schema:action:action.AA,AA>>
|
2131
|
+
<<express-schema:action:action.AB>>
|
2132
|
+
|
2133
|
+
[[action]]
|
2134
|
+
[type="express-schema"]
|
2135
|
+
== Action
|
2136
|
+
|
2137
|
+
[[action.AA]]
|
2138
|
+
=== AA
|
2139
|
+
|
2140
|
+
[bibliography]
|
2141
|
+
== Bibliography
|
2142
|
+
* [[[D,E]]] F
|
2143
|
+
INPUT
|
2144
|
+
#{BLANK_HDR}
|
2145
|
+
<sections>
|
2146
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
2147
|
+
<title>Clause</title>
|
2148
|
+
<p id='_'>
|
2149
|
+
<eref bibitemid='uml_A' citeas="">
|
2150
|
+
<localityStack>
|
2151
|
+
<locality type='anchor'><referenceFrom>A.B.C</referenceFrom></locality>
|
2152
|
+
</localityStack>
|
2153
|
+
C
|
2154
|
+
</eref>
|
2155
|
+
<eref bibitemid='uml_A' citeas=""/>
|
2156
|
+
<xref target='action.AA'>AA</xref>
|
2157
|
+
<xref target='action'>** Missing target action.AB</xref>
|
2158
|
+
</p>
|
2159
|
+
</clause>
|
2160
|
+
<clause id='action' type='express-schema' inline-header='false' obligation='normative'>
|
2161
|
+
<title>Action</title>
|
2162
|
+
<clause id='action.AA' inline-header='false' obligation='normative'>
|
2163
|
+
<title>AA</title>
|
2164
|
+
</clause>
|
2165
|
+
</clause>
|
2166
|
+
</sections>
|
2167
|
+
<bibliography>
|
2168
|
+
<references id='_' normative='false' obligation='informative'>
|
2169
|
+
<title>Bibliography</title>
|
2170
|
+
<bibitem id='D'>
|
2171
|
+
<formattedref format='application/x-isodoc+xml'>F</formattedref>
|
2172
|
+
<docidentifier>E</docidentifier>
|
2173
|
+
</bibitem>
|
2174
|
+
</references>
|
2175
|
+
<references hidden='true' normative='false'>
|
2176
|
+
<bibitem id='uml_A' type='internal'>
|
2177
|
+
<docidentifier type='repository'>uml/A</docidentifier>
|
2178
|
+
</bibitem>
|
2179
|
+
</references>
|
2180
|
+
</bibliography>
|
2181
|
+
</standard-document>
|
2182
|
+
OUTPUT
|
2183
|
+
end
|
2184
|
+
|
2185
|
+
|
2186
|
+
it "process express_ref macro with no existing bibliography" do
|
2187
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true, agree_to_terms: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
2188
|
+
#{ASCIIDOC_BLANK_HDR}
|
2189
|
+
== Clause
|
2190
|
+
|
2191
|
+
<<express-schema:A:A.B.C,C>>
|
2192
|
+
<<express-schema:A>>
|
2193
|
+
INPUT
|
2194
|
+
#{BLANK_HDR}
|
2195
|
+
<sections>
|
2196
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
2197
|
+
<title>Clause</title>
|
2198
|
+
<p id='_'>
|
2199
|
+
<eref bibitemid='express-schema_A' citeas="">
|
2200
|
+
<localityStack>
|
2201
|
+
<locality type='anchor'><referenceFrom>A.B.C</referenceFrom></locality>
|
2202
|
+
</localityStack>
|
2203
|
+
C
|
2204
|
+
</eref>
|
2205
|
+
<eref bibitemid='express-schema_A' citeas=""/>
|
2206
|
+
</p>
|
2207
|
+
</clause>
|
2208
|
+
</sections>
|
2209
|
+
<bibliography>
|
2210
|
+
<references hidden='true' normative='false'>
|
2211
|
+
<bibitem id='express-schema_A' type='internal'>
|
2212
|
+
<docidentifier type='repository'>express-schema/A</docidentifier>
|
2213
|
+
</bibitem>
|
2214
|
+
</references>
|
2215
|
+
</bibliography>
|
2216
|
+
</standard-document>
|
2217
|
+
OUTPUT
|
2218
|
+
end
|
2219
|
+
|
2220
|
+
|
2109
2221
|
private
|
2110
2222
|
|
2111
2223
|
def mock_mathml_italicise(x)
|