metanorma-standoc 1.3.26 → 1.3.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/standoc/base.rb +3 -3
- data/lib/asciidoctor/standoc/blocks.rb +5 -1
- data/lib/asciidoctor/standoc/cleanup.rb +8 -0
- data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +1 -3
- data/lib/asciidoctor/standoc/cleanup_ref.rb +11 -6
- data/lib/asciidoctor/standoc/cleanup_section.rb +15 -2
- data/lib/asciidoctor/standoc/inline.rb +1 -1
- data/lib/asciidoctor/standoc/isodoc.rng +6 -3
- data/lib/asciidoctor/standoc/ref.rb +1 -1
- data/lib/asciidoctor/standoc/section.rb +36 -9
- data/lib/asciidoctor/standoc/validate_section.rb +1 -1
- data/lib/metanorma/standoc/version.rb +1 -1
- data/spec/asciidoctor-standoc/blocks_spec.rb +2 -1
- data/spec/asciidoctor-standoc/cleanup_spec.rb +20 -26
- data/spec/asciidoctor-standoc/inline_spec.rb +1 -1
- data/spec/asciidoctor-standoc/macros_spec.rb +2 -2
- data/spec/asciidoctor-standoc/refs_dl_spec.rb +91 -3
- data/spec/asciidoctor-standoc/refs_spec.rb +13 -13
- data/spec/asciidoctor-standoc/section_spec.rb +139 -6
- data/spec/asciidoctor-standoc/validate_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3532b7b46d28cfd680ed255546a5a9fb9ba5658b3c05d9df3de9e1a31a03ab08
|
4
|
+
data.tar.gz: 549dc05067472220e8a60846620ec2d778803ead8303aaded1196a58a2f51247
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3539ca5c4d4c5807a4981fbfc4705e8810834ea500ae3636a713b307456758c2ad5a24956e317ea34b52a4f06d23abb6a55ab16c7aea69c04ce685b3b0975b53
|
7
|
+
data.tar.gz: 46f2361f7f9d5d544bfb098940af446719276422d31310444d6b2d13b6f754c49e93e71d8d959cd4dc5e5740cca6fc66071e0231abc69cef1f0464dcc0b55e31
|
@@ -43,7 +43,7 @@ module Asciidoctor
|
|
43
43
|
def skip(node, name = nil)
|
44
44
|
name = name || node.node_name
|
45
45
|
w = "converter missing for #{name} node in Metanorma backend"
|
46
|
-
@log.add("
|
46
|
+
@log.add("AsciiDoc Input", node, w)
|
47
47
|
nil
|
48
48
|
end
|
49
49
|
|
@@ -109,7 +109,7 @@ module Asciidoctor
|
|
109
109
|
@fontheader = default_fonts(node)
|
110
110
|
@files_to_delete = []
|
111
111
|
@filename = node.attr("docfile") ?
|
112
|
-
node.attr("docfile").gsub(/\.adoc$/, "")
|
112
|
+
File.basename(node.attr("docfile")).gsub(/\.adoc$/, "") : ""
|
113
113
|
@localdir = Utils::localdir(node)
|
114
114
|
@no_isobib_cache = node.attr("no-isobib-cache")
|
115
115
|
@no_isobib = node.attr("no-isobib")
|
@@ -241,7 +241,7 @@ module Asciidoctor
|
|
241
241
|
def extract_termsource_refs(text, node)
|
242
242
|
matched = TERM_REFERENCE_RE.match text
|
243
243
|
matched.nil? and
|
244
|
-
@log.add("
|
244
|
+
@log.add("AsciiDoc Input", node, "term reference not in expected format: #{text}")
|
245
245
|
matched
|
246
246
|
end
|
247
247
|
|
@@ -244,7 +244,11 @@ module Asciidoctor
|
|
244
244
|
end
|
245
245
|
|
246
246
|
def pass(node)
|
247
|
-
|
247
|
+
noko do |xml|
|
248
|
+
xml.passthrough **attr_code(formats: node.attr("format")) do |p|
|
249
|
+
p << HTMLEntities.new.encode(node.content, :basic, :hexadecimal)
|
250
|
+
end
|
251
|
+
end
|
248
252
|
end
|
249
253
|
end
|
250
254
|
end
|
@@ -64,6 +64,7 @@ module Asciidoctor
|
|
64
64
|
boilerplate_cleanup(xmldoc)
|
65
65
|
smartquotes_cleanup(xmldoc)
|
66
66
|
para_cleanup(xmldoc)
|
67
|
+
img_cleanup(xmldoc)
|
67
68
|
xmldoc
|
68
69
|
end
|
69
70
|
|
@@ -158,6 +159,13 @@ module Asciidoctor
|
|
158
159
|
x.replace(x.children)
|
159
160
|
end
|
160
161
|
end
|
162
|
+
|
163
|
+
def img_cleanup(xmldoc)
|
164
|
+
return xmldoc unless @datauriimage
|
165
|
+
xmldoc.xpath("//image").each do |i|
|
166
|
+
i["src"] = datauri(i["src"])
|
167
|
+
end
|
168
|
+
end
|
161
169
|
end
|
162
170
|
end
|
163
171
|
end
|
@@ -18,7 +18,6 @@ module Asciidoctor
|
|
18
18
|
source.each do |s|
|
19
19
|
@anchors[s["bibitemid"]] or
|
20
20
|
@log.add("Crossreferences", nil, "term source #{s['bibitemid']} not referenced")
|
21
|
-
#warn "term source #{s['bibitemid']} not referenced"
|
22
21
|
end
|
23
22
|
if source.empty? && term.nil?
|
24
23
|
div.next = @no_terms_boilerplate
|
@@ -49,8 +48,7 @@ module Asciidoctor
|
|
49
48
|
TERM_CLAUSE = "//sections/terms | "\
|
50
49
|
"//sections/clause[descendant::terms]".freeze
|
51
50
|
|
52
|
-
NORM_REF = "//bibliography/references[
|
53
|
-
"title = 'Normative references']".freeze
|
51
|
+
NORM_REF = "//bibliography/references[@normative = 'true']".freeze
|
54
52
|
|
55
53
|
def boilerplate_isodoc(xmldoc)
|
56
54
|
x = xmldoc.dup
|
@@ -5,7 +5,7 @@ module Asciidoctor
|
|
5
5
|
module Standoc
|
6
6
|
module Cleanup
|
7
7
|
def biblio_reorder(xmldoc)
|
8
|
-
xmldoc.xpath("//references[
|
8
|
+
xmldoc.xpath("//references[@normative = 'false']").each do |r|
|
9
9
|
biblio_reorder1(r)
|
10
10
|
end
|
11
11
|
end
|
@@ -49,8 +49,8 @@ module Asciidoctor
|
|
49
49
|
# consecutively, but that standards codes are preserved as is:
|
50
50
|
# only numeric references are renumbered
|
51
51
|
def biblio_renumber(xmldoc)
|
52
|
-
r = xmldoc.at("//references[
|
53
|
-
"//clause[
|
52
|
+
r = xmldoc.at("//references[@normative = 'false'] | "\
|
53
|
+
"//clause[.//references[@normative = 'false']]") or return
|
54
54
|
r.xpath(".//bibitem[not(ancestor::bibitem)]").each_with_index do |b, i|
|
55
55
|
next unless docid = b.at("./docidentifier[@type = 'metanorma']")
|
56
56
|
next unless /^\[\d+\]$/.match(docid.text)
|
@@ -67,18 +67,23 @@ module Asciidoctor
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def normref_cleanup(xmldoc)
|
70
|
-
r = xmldoc.at(NORM_REF) || return
|
71
|
-
|
72
|
-
preface = r.xpath("./title/following-sibling::*") &
|
70
|
+
r = xmldoc.at(self.class::NORM_REF) || return
|
71
|
+
preface = r.xpath("./title/following-sibling::*") & # intersection
|
73
72
|
r.xpath("./bibitem[1]/preceding-sibling::*")
|
74
73
|
preface.each { |n| n.remove }
|
75
74
|
end
|
76
75
|
|
77
76
|
def biblio_cleanup(xmldoc)
|
78
77
|
biblio_reorder(xmldoc)
|
78
|
+
biblio_nested(xmldoc)
|
79
79
|
biblio_renumber(xmldoc)
|
80
|
+
end
|
81
|
+
|
82
|
+
def biblio_nested(xmldoc)
|
80
83
|
xmldoc.xpath("//references[references]").each do |t|
|
81
84
|
t.name = "clause"
|
85
|
+
t.xpath("./references").each { |r| r["normative"] = t["normative"] }
|
86
|
+
t.delete("normative")
|
82
87
|
end
|
83
88
|
end
|
84
89
|
|
@@ -11,7 +11,7 @@ module Asciidoctor
|
|
11
11
|
module Cleanup
|
12
12
|
def make_preface(x, s)
|
13
13
|
if x.at("//foreword | //introduction | //acknowledgements | "\
|
14
|
-
"
|
14
|
+
"//*[@preface]")
|
15
15
|
preface = s.add_previous_sibling("<preface/>").first
|
16
16
|
f = x.at("//foreword") and preface.add_child f.remove
|
17
17
|
f = x.at("//introduction") and preface.add_child f.remove
|
@@ -22,7 +22,7 @@ module Asciidoctor
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def move_clauses_into_preface(x, preface)
|
25
|
-
x.xpath("
|
25
|
+
x.xpath("//*[@preface]").each do |c|
|
26
26
|
c.delete("preface")
|
27
27
|
preface.add_child c.remove
|
28
28
|
end
|
@@ -66,9 +66,22 @@ module Asciidoctor
|
|
66
66
|
def sections_order_cleanup(x)
|
67
67
|
s = x.at("//sections")
|
68
68
|
make_preface(x, s)
|
69
|
+
make_annexes(x)
|
69
70
|
make_bibliography(x, s)
|
70
71
|
x.xpath("//sections/annex").reverse_each { |r| s.next = r.remove }
|
71
72
|
end
|
73
|
+
|
74
|
+
def make_annexes(x)
|
75
|
+
x.xpath("//*[@annex]").each do |y|
|
76
|
+
y.delete("annex")
|
77
|
+
next if y.name == "annex"
|
78
|
+
y.wrap("<annex/>")
|
79
|
+
y.parent["id"] = "_#{UUIDTools::UUID.random_create}"
|
80
|
+
y.parent["obligation"] = y["obligation"]
|
81
|
+
y.parent["language"] = y["language"]
|
82
|
+
y.parent["script"] = y["script"]
|
83
|
+
end
|
84
|
+
end
|
72
85
|
|
73
86
|
def maxlevel(x)
|
74
87
|
max = 5
|
@@ -197,7 +197,7 @@ module Asciidoctor
|
|
197
197
|
types = /^data:/.match(uri) ? datauri2mime(uri) : MIME::Types.type_for(uri)
|
198
198
|
type = types.first.to_s
|
199
199
|
uri = uri.sub(%r{^data:image/\*;}, "data:#{type};")
|
200
|
-
attr_code(src:
|
200
|
+
attr_code(src: uri, #@datauriimage ? datauri(uri) : uri,
|
201
201
|
id: Utils::anchor_or_uuid,
|
202
202
|
mimetype: type,
|
203
203
|
height: node.attr("height") || "auto",
|
@@ -129,6 +129,9 @@
|
|
129
129
|
</choice>
|
130
130
|
</attribute>
|
131
131
|
</optional>
|
132
|
+
<attribute name="normative">
|
133
|
+
<data type="boolean"/>
|
134
|
+
</attribute>
|
132
135
|
<optional>
|
133
136
|
<ref name="section-title"/>
|
134
137
|
</optional>
|
@@ -303,11 +306,11 @@
|
|
303
306
|
<ref name="paragraph"/>
|
304
307
|
</element>
|
305
308
|
</define>
|
306
|
-
<define name="TextElement" combine="choice">
|
307
|
-
<ref name="concept"/>
|
308
|
-
</define>
|
309
309
|
</include>
|
310
310
|
<!-- end overrides -->
|
311
|
+
<define name="TextElement" combine="choice">
|
312
|
+
<ref name="concept"/>
|
313
|
+
</define>
|
311
314
|
<define name="concept">
|
312
315
|
<element name="concept">
|
313
316
|
<optional>
|
@@ -153,7 +153,7 @@ module Asciidoctor
|
|
153
153
|
# TODO: alternative where only title is available
|
154
154
|
def refitem(xml, item, node)
|
155
155
|
unless m = NON_ISO_REF.match(item)
|
156
|
-
@log.add("
|
156
|
+
@log.add("AsciiDoc Input", node, "#{MALFORMED_REF}: #{item}")
|
157
157
|
return
|
158
158
|
end
|
159
159
|
unless m[:code] && /^\d+$/.match(m[:code])
|
@@ -53,7 +53,15 @@ module Asciidoctor
|
|
53
53
|
def section_attributes(node)
|
54
54
|
{ id: Utils::anchor_or_uuid(node),
|
55
55
|
language: node.attributes["language"],
|
56
|
-
script: node.attributes["script"]
|
56
|
+
script: node.attributes["script"],
|
57
|
+
annex: (
|
58
|
+
((node.attr("style") == "appendix" || node.role == "appendix") &&
|
59
|
+
node.level == 1) ? true : nil
|
60
|
+
),
|
61
|
+
preface: (
|
62
|
+
(node.role == "preface" || node.attr("style") == "preface") ?
|
63
|
+
true : nil),
|
64
|
+
}
|
57
65
|
end
|
58
66
|
|
59
67
|
def section(node)
|
@@ -75,7 +83,12 @@ module Asciidoctor
|
|
75
83
|
else
|
76
84
|
if @term_def then term_def_subclause_parse(a, xml, node)
|
77
85
|
elsif @definitions then symbols_parse(a, xml, node)
|
86
|
+
elsif @norm_ref then norm_ref_parse(a, xml, node)
|
78
87
|
elsif @biblio then bibliography_parse(a, xml, node)
|
88
|
+
elsif node.attr("style") == "bibliography" && sectiontype(node, false) == "normative references"
|
89
|
+
norm_ref_parse(a, xml, node)
|
90
|
+
elsif node.attr("style") == "bibliography" && sectiontype(node, false) == "bibliography"
|
91
|
+
bibliography_parse(a, xml, node)
|
79
92
|
elsif node.attr("style") == "bibliography"
|
80
93
|
bibliography_parse(a, xml, node)
|
81
94
|
elsif node.attr("style") == "abstract"
|
@@ -118,7 +131,6 @@ module Asciidoctor
|
|
118
131
|
def clause_parse(attrs, xml, node)
|
119
132
|
attrs["inline-header".to_sym] = node.option? "inline-header"
|
120
133
|
attrs[:bibitem] = true if node.option? "bibitem"
|
121
|
-
attrs[:preface] = true if node.role == "preface" || node.attr("style") == "preface"
|
122
134
|
attrs[:level] = node.attr("level")
|
123
135
|
set_obligation(attrs, node)
|
124
136
|
xml.send "clause", **attr_code(attrs) do |xml_section|
|
@@ -137,11 +149,11 @@ module Asciidoctor
|
|
137
149
|
end
|
138
150
|
|
139
151
|
def bibliography_parse(attrs, xml, node)
|
152
|
+
node.option? "bibitem" and return bibitem_parse(attrs, xml, node)
|
140
153
|
node.attr("style") == "bibliography" or
|
141
|
-
|
142
|
-
@log.add("Asciidoctor Input", node, "Section not marked up as [bibliography]!")
|
154
|
+
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
143
155
|
@biblio = true
|
144
|
-
xml.references **attr_code(attrs) do |xml_section|
|
156
|
+
xml.references **attr_code(attrs.merge(normative: false)) do |xml_section|
|
145
157
|
title = node.level == 1 ? "Bibliography" : node.title
|
146
158
|
xml_section.title { |t| t << title }
|
147
159
|
xml_section << node.content
|
@@ -180,14 +192,16 @@ module Asciidoctor
|
|
180
192
|
|
181
193
|
# subclause contains subclauses
|
182
194
|
def term_def_subclause_parse(attrs, xml, node)
|
183
|
-
node.role == "nonterm"
|
184
|
-
sectiontype(node, false) == "terms and definitions" and
|
195
|
+
node.role == "nonterm" and
|
185
196
|
return nonterm_term_def_subclause_parse(attrs, xml, node)
|
197
|
+
st = sectiontype(node, false)
|
186
198
|
return symbols_parse(attrs, xml, node) if @definitions
|
187
199
|
sub = node.find_by(context: :section) { |s| s.level == node.level + 1 }
|
188
200
|
sub.empty? || (return term_def_parse(attrs, xml, node, false))
|
189
|
-
|
201
|
+
st == "symbols and abbreviated terms" and
|
190
202
|
(return symbols_parse(attrs, xml, node))
|
203
|
+
st == "terms and definitions" and
|
204
|
+
return clause_parse(attrs, xml, node)
|
191
205
|
term_def_subclause_parse1(attrs, xml, node)
|
192
206
|
end
|
193
207
|
|
@@ -222,9 +236,22 @@ module Asciidoctor
|
|
222
236
|
end
|
223
237
|
end
|
224
238
|
|
239
|
+
def bibitem_parse(attrs, xml, node)
|
240
|
+
norm_ref = @norm_ref
|
241
|
+
biblio = @biblio
|
242
|
+
@biblio = false
|
243
|
+
@norm_ref = false
|
244
|
+
clause_parse(attrs, xml, node)
|
245
|
+
@biblio = biblio
|
246
|
+
@norm_ref = norm_ref
|
247
|
+
end
|
248
|
+
|
225
249
|
def norm_ref_parse(attrs, xml, node)
|
250
|
+
node.option? "bibitem" and return bibitem_parse(attrs, xml, node)
|
251
|
+
node.attr("style") == "bibliography" or
|
252
|
+
@log.add("AsciiDoc Input", node, "Section not marked up as [bibliography]!")
|
226
253
|
@norm_ref = true
|
227
|
-
xml.references **attr_code(attrs) do |xml_section|
|
254
|
+
xml.references **attr_code(attrs.merge(normative: true)) do |xml_section|
|
228
255
|
xml_section.title { |t| t << "Normative References" }
|
229
256
|
xml_section << node.content
|
230
257
|
end
|
@@ -15,7 +15,7 @@ module Asciidoctor
|
|
15
15
|
annotations = x.elements.select { |e| e.name == "annotation" }
|
16
16
|
if callouts.size != annotations.size
|
17
17
|
#warn "#{x['id']}: mismatch of callouts and annotations"
|
18
|
-
@log.add("
|
18
|
+
@log.add("AsciiDoc Input", x, "mismatch of callouts and annotations")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -6,13 +6,14 @@ RSpec.describe Asciidoctor::Standoc do
|
|
6
6
|
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
7
7
|
#{ASCIIDOC_BLANK_HDR}
|
8
8
|
|
9
|
+
[format="rfc,html"]
|
9
10
|
++++
|
10
11
|
<abc>X > Y</abc>
|
11
12
|
++++
|
12
13
|
INPUT
|
13
14
|
#{BLANK_HDR}
|
14
15
|
<sections>
|
15
|
-
<abc
|
16
|
+
<passthrough formats='rfc,html'><abc>X > Y</abc></passthrough>
|
16
17
|
</sections>
|
17
18
|
</standard-document>
|
18
19
|
OUTPUT
|
@@ -330,7 +330,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
330
330
|
<eref type="inline" bibitemid="iso216" citeas="ISO 216:2001"/>
|
331
331
|
</p>
|
332
332
|
</foreword></preface><sections>
|
333
|
-
</sections><bibliography><references id="_" obligation="informative">
|
333
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
334
334
|
<title>Normative References</title>
|
335
335
|
#{NORM_REF_BOILERPLATE}
|
336
336
|
<bibitem id="iso216" type="standard">
|
@@ -408,7 +408,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
408
408
|
|
409
409
|
</p>
|
410
410
|
</foreword></preface><sections>
|
411
|
-
</sections><bibliography><references id="_" obligation="informative">
|
411
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
412
412
|
<title>Normative References</title>
|
413
413
|
#{NORM_REF_BOILERPLATE}
|
414
414
|
<bibitem id="iso216" type="standard">
|
@@ -446,7 +446,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
446
446
|
<eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
|
447
447
|
</p>
|
448
448
|
</foreword></preface><sections>
|
449
|
-
</sections><bibliography><references id="_" obligation="informative">
|
449
|
+
</sections><bibliography><references id="_" obligation="informative" normative="false">
|
450
450
|
<title>Bibliography</title>
|
451
451
|
<bibitem id="iso216" type="standard">
|
452
452
|
<title format="text/plain">Reference</title>
|
@@ -509,7 +509,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
509
509
|
INPUT
|
510
510
|
#{BLANK_HDR}
|
511
511
|
<sections></sections>
|
512
|
-
<bibliography><references id="_" obligation="informative"><title>Normative References</title>
|
512
|
+
<bibliography><references id="_" obligation="informative" normative="true"><title>Normative References</title>
|
513
513
|
#{NORM_REF_BOILERPLATE}
|
514
514
|
<bibitem id="iso216" type="standard">
|
515
515
|
<title format="text/plain">Reference</title>
|
@@ -556,7 +556,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
556
556
|
#{BLANK_HDR}
|
557
557
|
<sections> </sections>
|
558
558
|
<bibliography>
|
559
|
-
<references id='_' obligation='informative'>
|
559
|
+
<references id='_' obligation='informative' normative="false">
|
560
560
|
<title>Bibliography</title>
|
561
561
|
<p id='_'>This is extraneous information</p>
|
562
562
|
<bibitem id='iso216' type='standard'>
|
@@ -937,7 +937,7 @@ end
|
|
937
937
|
<p id="_">Footnote2</p>
|
938
938
|
</fn>
|
939
939
|
</p>
|
940
|
-
</clause></sections><bibliography><references id="_" obligation="informative">
|
940
|
+
</clause></sections><bibliography><references id="_" obligation="informative" normative="true">
|
941
941
|
<title>Normative References</title>
|
942
942
|
#{NORM_REF_BOILERPLATE}
|
943
943
|
<bibitem id="iso123" type="standard">
|
@@ -1168,7 +1168,7 @@ end
|
|
1168
1168
|
</localityStack>
|
1169
1169
|
</origin>
|
1170
1170
|
</termsource>
|
1171
|
-
</term></terms></sections><bibliography><references id="_" obligation="informative">
|
1171
|
+
</term></terms></sections><bibliography><references id="_" obligation="informative" normative="true">
|
1172
1172
|
<title>Normative References</title>
|
1173
1173
|
#{NORM_REF_BOILERPLATE}
|
1174
1174
|
<bibitem type="standard" id="IEC60050-102">
|
@@ -1338,21 +1338,16 @@ end
|
|
1338
1338
|
end
|
1339
1339
|
|
1340
1340
|
it "cleans up text MathML" do
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
:docfile: test.adoc
|
1345
|
-
:nodoc:
|
1346
|
-
:novalid:
|
1347
|
-
:no-isobib:
|
1348
|
-
|
1349
|
-
++++
|
1341
|
+
expect(Asciidoctor::Standoc::Converter.new(nil, backend: :standoc, header_footer: true).cleanup(Nokogiri::XML(<<~"INPUT")).to_xml).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1342
|
+
#{BLANK_HDR}
|
1343
|
+
<sections>
|
1350
1344
|
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
|
1351
|
-
|
1345
|
+
</sections>
|
1346
|
+
</standard-document>
|
1352
1347
|
INPUT
|
1353
1348
|
#{BLANK_HDR}
|
1354
1349
|
<sections>
|
1355
|
-
<stem type="MathML"><math><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
|
1350
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mn>1</mn><mi>r</mi></mfrac></math></stem>
|
1356
1351
|
</sections>
|
1357
1352
|
|
1358
1353
|
|
@@ -1380,7 +1375,7 @@ end
|
|
1380
1375
|
<p id="_"><eref type="inline" bibitemid="iso123" citeas="[2]"/>
|
1381
1376
|
<eref type="inline" bibitemid="iso124" citeas="ISO 124"/></p>
|
1382
1377
|
</clause>
|
1383
|
-
</sections><bibliography><references id="_" obligation="informative">
|
1378
|
+
</sections><bibliography><references id="_" obligation="informative" normative="false">
|
1384
1379
|
<title>Bibliography</title>
|
1385
1380
|
<bibitem id="iso124" type="standard">
|
1386
1381
|
<title format="text/plain">Standard 124</title>
|
@@ -1436,7 +1431,7 @@ OUTPUT
|
|
1436
1431
|
<eref type="inline" bibitemid="iso125" citeas="ISO 125"/>
|
1437
1432
|
<eref type="inline" bibitemid="iso126" citeas="[4]"/></p>
|
1438
1433
|
</clause>
|
1439
|
-
</sections><bibliography><clause id="_" obligation="informative"><title>Bibliography</title><references id="_" obligation="informative">
|
1434
|
+
</sections><bibliography><clause id="_" obligation="informative"><title>Bibliography</title><references id="_" obligation="informative" normative="false">
|
1440
1435
|
<title>Clause 1</title>
|
1441
1436
|
<bibitem id="iso124" type="standard">
|
1442
1437
|
<title format="text/plain">Standard 124</title>
|
@@ -1456,8 +1451,7 @@ OUTPUT
|
|
1456
1451
|
<docidentifier type="metanorma">[2]</docidentifier>
|
1457
1452
|
</bibitem>
|
1458
1453
|
</references>
|
1459
|
-
<references id="_" obligation="informative">
|
1460
|
-
|
1454
|
+
<references id="_" obligation="informative" normative="false">
|
1461
1455
|
<bibitem id="iso125" type="standard">
|
1462
1456
|
<title format="text/plain">Standard 124</title>
|
1463
1457
|
<docidentifier>ISO 125</docidentifier>
|
@@ -1491,7 +1485,7 @@ OUTPUT
|
|
1491
1485
|
#{BLANK_HDR}
|
1492
1486
|
<sections>
|
1493
1487
|
|
1494
|
-
</sections><bibliography><references id="_" obligation="informative">
|
1488
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
1495
1489
|
<title>Normative References</title><p id="_">There are no normative references in this document.</p>
|
1496
1490
|
</references></bibliography>
|
1497
1491
|
</standard-document>
|
@@ -1510,7 +1504,7 @@ OUTPUT
|
|
1510
1504
|
#{BLANK_HDR}
|
1511
1505
|
<sections>
|
1512
1506
|
|
1513
|
-
</sections><bibliography><references id="_" obligation="informative">
|
1507
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
1514
1508
|
<title>Normative References</title><p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
1515
1509
|
<bibitem id="a">
|
1516
1510
|
<formattedref format="application/x-isodoc+xml">A</formattedref>
|
@@ -1539,7 +1533,7 @@ it "inserts boilerplate before empty Normative References in French" do
|
|
1539
1533
|
#{BLANK_HDR.sub(/<language>en/, "<language>fr")}
|
1540
1534
|
<sections>
|
1541
1535
|
|
1542
|
-
</sections><bibliography><references id="_" obligation="informative">
|
1536
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
1543
1537
|
<title>Normative References</title><p id="_">Le présent document ne contient aucune référence normative.</p>
|
1544
1538
|
</references></bibliography>
|
1545
1539
|
</standard-document>
|
@@ -1584,7 +1578,7 @@ it "removes bibdata bibitem IDs" do
|
|
1584
1578
|
</bibdata>
|
1585
1579
|
<sections> </sections>
|
1586
1580
|
<bibliography>
|
1587
|
-
<references id='_' obligation='informative'>
|
1581
|
+
<references id='_' obligation='informative' normative="true">
|
1588
1582
|
<title>Normative References</title>
|
1589
1583
|
<p id="_">There are no normative references in this document.</p>
|
1590
1584
|
</references>
|
@@ -227,7 +227,7 @@ text, including <strong><em>nest</em></strong>ed markup.</p>
|
|
227
227
|
#{BLANK_HDR}
|
228
228
|
<sections>
|
229
229
|
|
230
|
-
</sections><bibliography><references id="_" obligation="informative">
|
230
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
231
231
|
<title>Normative References</title>
|
232
232
|
<p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
233
233
|
<bibitem id="ISO712">
|
@@ -27,7 +27,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
27
27
|
</preface>
|
28
28
|
<sections> </sections>
|
29
29
|
<bibliography>
|
30
|
-
<references id='_' obligation='informative'>
|
30
|
+
<references id='_' obligation='informative' normative="false">
|
31
31
|
<title>Bibliography</title>
|
32
32
|
<bibitem id='ref1'>
|
33
33
|
<formattedref format='application/x-isodoc+xml'>
|
@@ -178,7 +178,7 @@ INPUT
|
|
178
178
|
</clause>
|
179
179
|
</sections>
|
180
180
|
<bibliography>
|
181
|
-
<references id='_' obligation='informative'>
|
181
|
+
<references id='_' obligation='informative' normative="false">
|
182
182
|
<title>Bibliography</title>
|
183
183
|
<bibitem id='blah'>
|
184
184
|
<formattedref format='application/x-isodoc+xml'>
|
@@ -38,7 +38,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
38
38
|
INPUT
|
39
39
|
#{BLANK_HDR}
|
40
40
|
<sections>
|
41
|
-
</sections><bibliography><references id="_" obligation="informative">
|
41
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
42
42
|
<title>Normative References</title>
|
43
43
|
#{NORM_REF_BOILERPLATE}
|
44
44
|
<bibitem id="iso123" type="standard">
|
@@ -287,7 +287,7 @@ formattedref::
|
|
287
287
|
INPUT
|
288
288
|
#{BLANK_HDR}
|
289
289
|
<sections>
|
290
|
-
</sections><bibliography><references id="_" obligation="informative">
|
290
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
291
291
|
<title>Normative References</title>
|
292
292
|
#{NORM_REF_BOILERPLATE}
|
293
293
|
<bibitem id="TC211" type="standard">
|
@@ -605,7 +605,7 @@ series.formattedref.script:: Latn
|
|
605
605
|
INPUT
|
606
606
|
#{BLANK_HDR}
|
607
607
|
<sections>
|
608
|
-
</sections><bibliography><references id="_" obligation="informative">
|
608
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
609
609
|
<title>Normative References</title>
|
610
610
|
#{NORM_REF_BOILERPLATE}
|
611
611
|
<bibitem id="TC211" type="standard">
|
@@ -757,4 +757,92 @@ home run record in 1998.</note>
|
|
757
757
|
OUTPUT
|
758
758
|
end
|
759
759
|
|
760
|
+
it "processes mix of dl and default references" do
|
761
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
762
|
+
#{ASCIIDOC_BLANK_HDR}
|
763
|
+
|
764
|
+
== Section
|
765
|
+
|
766
|
+
=== Subsection
|
767
|
+
|
768
|
+
[bibliography]
|
769
|
+
=== Normative References
|
770
|
+
|
771
|
+
* [[[A, B]]], Title
|
772
|
+
|
773
|
+
[%bibitem]
|
774
|
+
==== Standard
|
775
|
+
id:: iso123
|
776
|
+
docid::
|
777
|
+
type::: ISO
|
778
|
+
id::: ISO 123
|
779
|
+
type:: standard
|
780
|
+
contributor::
|
781
|
+
role::: publisher
|
782
|
+
organization:::
|
783
|
+
name:::: ISO
|
784
|
+
contributor::
|
785
|
+
role::: author
|
786
|
+
person:::
|
787
|
+
name::::
|
788
|
+
+
|
789
|
+
--
|
790
|
+
completename::
|
791
|
+
language::: en
|
792
|
+
content::: Fred
|
793
|
+
--
|
794
|
+
contributor::
|
795
|
+
role::: author
|
796
|
+
person:::
|
797
|
+
name::::
|
798
|
+
completename::::: Jack
|
799
|
+
|
800
|
+
INPUT
|
801
|
+
#{BLANK_HDR}
|
802
|
+
<sections>
|
803
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
804
|
+
<title>Section</title>
|
805
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
806
|
+
<title>Subsection</title>
|
807
|
+
</clause>
|
808
|
+
<references id='_' obligation='informative' normative="true">
|
809
|
+
<title>Normative References</title>
|
810
|
+
<bibitem id='A'>
|
811
|
+
<formattedref format='application/x-isodoc+xml'>Title</formattedref>
|
812
|
+
<docidentifier>B</docidentifier>
|
813
|
+
</bibitem>
|
814
|
+
<bibitem id='iso123' type='standard'>
|
815
|
+
<fetched>#{Date.today.to_s}</fetched>
|
816
|
+
<title type='main' format='text/plain' language='en' script='Latn'>Standard</title>
|
817
|
+
<docidentifier type='ISO'>ISO 123</docidentifier>
|
818
|
+
<contributor>
|
819
|
+
<role type='publisher'/>
|
820
|
+
<organization>
|
821
|
+
<name>ISO</name>
|
822
|
+
</organization>
|
823
|
+
</contributor>
|
824
|
+
<contributor>
|
825
|
+
<role type='author'/>
|
826
|
+
<person>
|
827
|
+
<name>
|
828
|
+
<completename language='en'>Fred</completename>
|
829
|
+
</name>
|
830
|
+
</person>
|
831
|
+
</contributor>
|
832
|
+
<contributor>
|
833
|
+
<role type='author'/>
|
834
|
+
<person>
|
835
|
+
<name>
|
836
|
+
<completename>Jack</completename>
|
837
|
+
</name>
|
838
|
+
</person>
|
839
|
+
</contributor>
|
840
|
+
</bibitem>
|
841
|
+
</references>
|
842
|
+
</clause>
|
843
|
+
</sections>
|
844
|
+
</standard-document>
|
845
|
+
OUTPUT
|
846
|
+
|
847
|
+
end
|
760
848
|
end
|
@@ -14,7 +14,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
14
14
|
INPUT
|
15
15
|
#{BLANK_HDR}
|
16
16
|
<sections>
|
17
|
-
</sections><bibliography><references id="_" obligation="informative">
|
17
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
18
18
|
<title>Normative References</title>
|
19
19
|
#{NORM_REF_BOILERPLATE}
|
20
20
|
<bibitem id="iso123" type="standard">
|
@@ -57,7 +57,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
57
57
|
INPUT
|
58
58
|
#{BLANK_HDR}
|
59
59
|
<sections>
|
60
|
-
</sections><bibliography><references id="_" obligation="informative">
|
60
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
61
61
|
<title>Normative References</title>
|
62
62
|
#{NORM_REF_BOILERPLATE}
|
63
63
|
<bibitem id="iso123" type="standard">
|
@@ -125,7 +125,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
125
125
|
</foreword>
|
126
126
|
</preface>
|
127
127
|
<sections>
|
128
|
-
</sections><bibliography><references id="_" obligation="informative"><title>Normative References</title>
|
128
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true"><title>Normative References</title>
|
129
129
|
#{NORM_REF_BOILERPLATE}
|
130
130
|
<bibitem type="standard" id="iso123">
|
131
131
|
<uri type="src">https://www.iso.org/standard/23281.html</uri>
|
@@ -236,7 +236,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
236
236
|
#{BLANK_HDR}
|
237
237
|
<sections>
|
238
238
|
|
239
|
-
</sections><bibliography><references id="_" obligation="informative"><title>Normative References</title>
|
239
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true"><title>Normative References</title>
|
240
240
|
#{NORM_REF_BOILERPLATE}
|
241
241
|
<bibitem id='iso123' type='standard'>
|
242
242
|
<fetched>#{Date.today}</fetched>
|
@@ -469,7 +469,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
469
469
|
INPUT
|
470
470
|
#{BLANK_HDR}
|
471
471
|
<sections>
|
472
|
-
</sections><bibliography><references id="_" obligation="informative">
|
472
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
473
473
|
<title>Normative References</title>
|
474
474
|
#{NORM_REF_BOILERPLATE}
|
475
475
|
<bibitem id="iso123" type="standard">
|
@@ -518,7 +518,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
518
518
|
#{BLANK_HDR}
|
519
519
|
<sections>
|
520
520
|
|
521
|
-
</sections><bibliography><references id="_" obligation="informative">
|
521
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
522
522
|
<title>Normative References</title>
|
523
523
|
#{NORM_REF_BOILERPLATE}
|
524
524
|
<bibitem type="standard" id="iso123">
|
@@ -741,7 +741,7 @@ RSpec.describe Asciidoctor::Standoc do
|
|
741
741
|
#{BLANK_HDR}
|
742
742
|
<sections>
|
743
743
|
|
744
|
-
</sections><bibliography><references id="_" obligation="informative">
|
744
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
745
745
|
<title>Normative References</title>
|
746
746
|
#{NORM_REF_BOILERPLATE}
|
747
747
|
<bibitem id='iso123'>
|
@@ -820,7 +820,7 @@ OUTPUT
|
|
820
820
|
INPUT
|
821
821
|
#{BLANK_HDR}
|
822
822
|
<sections>
|
823
|
-
</sections><bibliography><references id="_" obligation="informative">
|
823
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
824
824
|
<title>Normative References</title>
|
825
825
|
#{NORM_REF_BOILERPLATE}
|
826
826
|
<bibitem id="iso123" type="standard">
|
@@ -901,7 +901,7 @@ OUTPUT
|
|
901
901
|
INPUT
|
902
902
|
#{BLANK_HDR}
|
903
903
|
<sections>
|
904
|
-
</sections><bibliography><references id="_" obligation="informative">
|
904
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
905
905
|
<title>Normative References</title>
|
906
906
|
#{NORM_REF_BOILERPLATE}
|
907
907
|
<bibitem id="iso123" type="standard">
|
@@ -968,7 +968,7 @@ OUTPUT
|
|
968
968
|
<eref type="inline" bibitemid="iso123" citeas="RFC 8341"/>
|
969
969
|
</p>
|
970
970
|
</clause>
|
971
|
-
</sections><bibliography><references id="_" obligation="informative">
|
971
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
972
972
|
<title>Normative References</title>
|
973
973
|
#{NORM_REF_BOILERPLATE}
|
974
974
|
<bibitem id="iso123" type="standard">
|
@@ -1095,7 +1095,7 @@ OUTPUT
|
|
1095
1095
|
#{BLANK_HDR}
|
1096
1096
|
<sections>
|
1097
1097
|
|
1098
|
-
</sections><bibliography><references id="_" obligation="informative">
|
1098
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
1099
1099
|
<title>Normative References</title>
|
1100
1100
|
#{NORM_REF_BOILERPLATE}
|
1101
1101
|
<bibitem id="iso123">
|
@@ -1135,7 +1135,7 @@ OUTPUT
|
|
1135
1135
|
<sections>
|
1136
1136
|
|
1137
1137
|
</sections>
|
1138
|
-
<bibliography><references id="_" obligation="informative">
|
1138
|
+
<bibliography><references id="_" obligation="informative" normative="false">
|
1139
1139
|
<title>Bibliography</title><bibitem id="iso123">
|
1140
1140
|
<formattedref format="application/x-isodoc+xml">
|
1141
1141
|
<em>Standard</em>
|
@@ -1199,7 +1199,7 @@ OUTPUT
|
|
1199
1199
|
</bibdata>
|
1200
1200
|
<sections>
|
1201
1201
|
|
1202
|
-
</sections><bibliography><references id="_" obligation="informative">
|
1202
|
+
</sections><bibliography><references id="_" obligation="informative" normative="true">
|
1203
1203
|
<title>Normative References</title>
|
1204
1204
|
#{NORM_REF_BOILERPLATE}
|
1205
1205
|
<bibitem id="iso123" type="standard">
|
@@ -167,12 +167,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
167
167
|
<clause id="_" inline-header="false" obligation="normative">
|
168
168
|
<title>Annex A.1</title>
|
169
169
|
</clause>
|
170
|
-
</annex><bibliography><references id="_" obligation="informative">
|
170
|
+
</annex><bibliography><references id="_" obligation="informative" normative="true">
|
171
171
|
<title>Normative References</title>
|
172
172
|
<p id="_">There are no normative references in this document.</p>
|
173
173
|
</references><clause id="_" obligation="informative">
|
174
174
|
<title>Bibliography</title>
|
175
|
-
<references id="_" obligation="informative">
|
175
|
+
<references id="_" obligation="informative" normative="false">
|
176
176
|
<title>Bibliography Subsection</title>
|
177
177
|
</references>
|
178
178
|
</clause></bibliography>
|
@@ -372,12 +372,12 @@ RSpec.describe Asciidoctor::Standoc do
|
|
372
372
|
<clause id="_" language="en" script="Latn" inline-header="false" obligation="normative">
|
373
373
|
<title>Annex A.1</title>
|
374
374
|
</clause>
|
375
|
-
</annex><bibliography><references id="_" language="en" script="Latn" obligation="informative">
|
375
|
+
</annex><bibliography><references id="_" language="en" script="Latn" obligation="informative" normative="true">
|
376
376
|
<title>Normative References</title>
|
377
377
|
<p id="_">There are no normative references in this document.</p>
|
378
378
|
</references><clause id="_" language="en" script="Latn" obligation="informative">
|
379
379
|
<title>Bibliography</title>
|
380
|
-
<references id="_" language="en" script="Latn" obligation="informative">
|
380
|
+
<references id="_" language="en" script="Latn" obligation="informative" normative="false">
|
381
381
|
<title>Bibliography Subsection</title>
|
382
382
|
</references>
|
383
383
|
</clause></bibliography>
|
@@ -502,13 +502,13 @@ RSpec.describe Asciidoctor::Standoc do
|
|
502
502
|
</clause>
|
503
503
|
</annex>
|
504
504
|
<bibliography>
|
505
|
-
<references id='_' obligation='informative'>
|
505
|
+
<references id='_' obligation='informative' normative="true">
|
506
506
|
<title>Normative References</title>
|
507
507
|
<p id="_">There are no normative references in this document.</p>
|
508
508
|
</references>
|
509
509
|
<clause id='_' obligation='informative'>
|
510
510
|
<title>Bibliography</title>
|
511
|
-
<references id='_' obligation='informative'>
|
511
|
+
<references id='_' obligation='informative' normative="false">
|
512
512
|
<title>Bibliography Subsection</title>
|
513
513
|
</references>
|
514
514
|
</clause>
|
@@ -843,4 +843,137 @@ RSpec.describe Asciidoctor::Standoc do
|
|
843
843
|
INPUT
|
844
844
|
end
|
845
845
|
|
846
|
+
it "treats terminal terms subclause named as terms clause as a normal clause" do
|
847
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
848
|
+
#{ASCIIDOC_BLANK_HDR}
|
849
|
+
[[tda]]
|
850
|
+
== Terms, definitions, symbols and abbreviations
|
851
|
+
|
852
|
+
[[terms]]
|
853
|
+
=== Terms and definitions
|
854
|
+
|
855
|
+
=== Symbols
|
856
|
+
|
857
|
+
INPUT
|
858
|
+
#{BLANK_HDR}
|
859
|
+
<sections>
|
860
|
+
<terms id='tda' obligation='normative'>
|
861
|
+
<title>Terms, definitions, symbols and abbreviated terms</title>
|
862
|
+
<p id='_'>No terms and definitions are listed in this document.</p>
|
863
|
+
<clause id='terms' inline-header='false' obligation='normative'>
|
864
|
+
<title>Terms and definitions</title>
|
865
|
+
</clause>
|
866
|
+
<definitions id='_'>
|
867
|
+
<title>Symbols</title>
|
868
|
+
</definitions>
|
869
|
+
</terms>
|
870
|
+
</sections>
|
871
|
+
</standard-document>
|
872
|
+
|
873
|
+
OUTPUT
|
874
|
+
end
|
875
|
+
|
876
|
+
it "treats non-terminal terms subclause named as terms clause as a terms clause" do
|
877
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
878
|
+
#{ASCIIDOC_BLANK_HDR}
|
879
|
+
== Scope
|
880
|
+
|
881
|
+
[[tda]]
|
882
|
+
== Terms, definitions, symbols and abbreviations
|
883
|
+
|
884
|
+
[[terms]]
|
885
|
+
=== Terms and definitions
|
886
|
+
|
887
|
+
[[terms-concepts]]
|
888
|
+
==== Basic concepts
|
889
|
+
|
890
|
+
[[term-date]]
|
891
|
+
===== date
|
892
|
+
|
893
|
+
_time_ (<<term-time>>) on the _calendar_ (<<term-calendar>>) _time scale_ (<<term-time-scale>>)
|
894
|
+
|
895
|
+
INPUT
|
896
|
+
#{BLANK_HDR}
|
897
|
+
<sections>
|
898
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
899
|
+
<title>Scope</title>
|
900
|
+
</clause>
|
901
|
+
<clause id='tda' obligation='normative'>
|
902
|
+
<title>Terms and definitions</title>
|
903
|
+
<p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
|
904
|
+
<clause id='terms' obligation='normative'>
|
905
|
+
<title>Terms and definitions</title>
|
906
|
+
<terms id='terms-concepts' obligation='normative'>
|
907
|
+
<title>Basic concepts</title>
|
908
|
+
<term id='term-date'>
|
909
|
+
<preferred>date</preferred>
|
910
|
+
<definition>
|
911
|
+
<p id='_'>
|
912
|
+
<em>time</em>
|
913
|
+
(
|
914
|
+
<xref target='term-time'/>
|
915
|
+
) on the
|
916
|
+
<em>calendar</em>
|
917
|
+
(
|
918
|
+
<xref target='term-calendar'/>
|
919
|
+
)
|
920
|
+
<em>time scale</em>
|
921
|
+
(
|
922
|
+
<xref target='term-time-scale'/>
|
923
|
+
)
|
924
|
+
</p>
|
925
|
+
</definition>
|
926
|
+
</term>
|
927
|
+
</terms>
|
928
|
+
</clause>
|
929
|
+
</clause>
|
930
|
+
</sections>
|
931
|
+
</standard-document>
|
932
|
+
OUTPUT
|
933
|
+
end
|
934
|
+
|
935
|
+
it "leaves alone special titles in preface or appendix" do
|
936
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(strip_guid(<<~"OUTPUT"))
|
937
|
+
#{ASCIIDOC_BLANK_HDR}
|
938
|
+
|
939
|
+
[.preface]
|
940
|
+
[[t1]]
|
941
|
+
== Terms and definitions
|
942
|
+
|
943
|
+
[[t2]]
|
944
|
+
=== Term1
|
945
|
+
|
946
|
+
[appendix,language=fr]
|
947
|
+
[[sym]]
|
948
|
+
== Symbols and abbreviated terms
|
949
|
+
|
950
|
+
[.appendix]
|
951
|
+
[[app]]
|
952
|
+
[bibliography]
|
953
|
+
== Normative Reference
|
954
|
+
INPUT
|
955
|
+
#{BLANK_HDR}
|
956
|
+
<preface>
|
957
|
+
<terms id='t1' obligation='normative'>
|
958
|
+
<title>Terms and definitions</title>
|
959
|
+
<term id='t2'>
|
960
|
+
<preferred>Term1</preferred>
|
961
|
+
</term>
|
962
|
+
</terms>
|
963
|
+
</preface>
|
964
|
+
<sections> </sections>
|
965
|
+
<annex id='_' obligation='' language='fr' script=''>
|
966
|
+
<definitions id='sym' language='fr'>
|
967
|
+
<title>Symbols and abbreviated terms</title>
|
968
|
+
</definitions>
|
969
|
+
</annex>
|
970
|
+
<annex id='_' obligation='' language='' script=''>
|
971
|
+
<references id='app' obligation='informative' normative="false">
|
972
|
+
<title>Bibliography</title>
|
973
|
+
</references>
|
974
|
+
</annex>
|
975
|
+
</standard-document>
|
976
|
+
OUTPUT
|
977
|
+
end
|
978
|
+
|
846
979
|
end
|
@@ -237,5 +237,22 @@ it "warns if id used twice" do
|
|
237
237
|
expect(File.read("test.err")).to include "Anchor abc has already been used at line"
|
238
238
|
end
|
239
239
|
|
240
|
+
it "err file succesfully created for docfile path" do
|
241
|
+
FileUtils.rm_rf "test"
|
242
|
+
FileUtils.mkdir_p "test"
|
243
|
+
Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)
|
244
|
+
= Document title
|
245
|
+
Author
|
246
|
+
:docfile: test#{File::ALT_SEPARATOR || File::SEPARATOR}test.adoc
|
247
|
+
:nodoc:
|
248
|
+
|
249
|
+
[[abc]]
|
250
|
+
== Clause 1
|
251
|
+
|
252
|
+
[[abc]]
|
253
|
+
== Clause 2
|
254
|
+
INPUT
|
255
|
+
expect(File.read("test/test.err")).to include "Anchor abc has already been used at line"
|
256
|
+
end
|
240
257
|
|
241
258
|
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: 1.3.
|
4
|
+
version: 1.3.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|