asciidoctor 1.5.6 → 1.5.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +52 -1
- data/README-fr.adoc +21 -15
- data/README-jp.adoc +20 -8
- data/README-zh_CN.adoc +21 -9
- data/README.adoc +10 -7
- data/Rakefile +11 -4
- data/lib/asciidoctor.rb +30 -27
- data/lib/asciidoctor/abstract_node.rb +0 -5
- data/lib/asciidoctor/converter/html5.rb +1 -1
- data/lib/asciidoctor/extensions.rb +4 -5
- data/lib/asciidoctor/parser.rb +96 -105
- data/lib/asciidoctor/path_resolver.rb +7 -7
- data/lib/asciidoctor/reader.rb +88 -84
- data/lib/asciidoctor/substitutors.rb +19 -14
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +5 -5
- data/man/asciidoctor.adoc +1 -1
- data/test/attributes_test.rb +20 -20
- data/test/blocks_test.rb +51 -16
- data/test/converter_test.rb +10 -10
- data/test/document_test.rb +84 -69
- data/test/extensions_test.rb +48 -5
- data/test/invoker_test.rb +21 -21
- data/test/links_test.rb +4 -4
- data/test/lists_test.rb +10 -10
- data/test/paragraphs_test.rb +1 -1
- data/test/parser_test.rb +4 -4
- data/test/paths_test.rb +7 -0
- data/test/reader_test.rb +46 -12
- data/test/sections_test.rb +64 -42
- data/test/substitutions_test.rb +34 -14
- data/test/tables_test.rb +2 -2
- data/test/text_test.rb +12 -10
- metadata +3 -3
data/lib/asciidoctor/version.rb
CHANGED
data/man/asciidoctor.1
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
'\" t
|
2
2
|
.\" Title: asciidoctor
|
3
3
|
.\" Author: Dan Allen, Sarah White, Ryan Waldron
|
4
|
-
.\" Generator: Asciidoctor 1.5.6
|
5
|
-
.\" Date: 2017-07-
|
4
|
+
.\" Generator: Asciidoctor 1.5.6.1
|
5
|
+
.\" Date: 2017-07-23
|
6
6
|
.\" Manual: Asciidoctor Manual
|
7
|
-
.\" Source: Asciidoctor 1.5.6
|
7
|
+
.\" Source: Asciidoctor 1.5.6.1
|
8
8
|
.\" Language: English
|
9
9
|
.\"
|
10
|
-
.TH "ASCIIDOCTOR" "1" "2017-07-
|
10
|
+
.TH "ASCIIDOCTOR" "1" "2017-07-23" "Asciidoctor 1.5.6.1" "Asciidoctor Manual"
|
11
11
|
.ie \n(.g .ds Aq \(aq
|
12
12
|
.el .ds Aq '
|
13
13
|
.ss \n[.ss] 0
|
@@ -242,4 +242,4 @@ Free use of this software is granted under the terms of the MIT License.
|
|
242
242
|
\fBDan Allen, Sarah White, Ryan Waldron\fP
|
243
243
|
.RS 4
|
244
244
|
Author(s).
|
245
|
-
.RE
|
245
|
+
.RE
|
data/man/asciidoctor.adoc
CHANGED
data/test/attributes_test.rb
CHANGED
@@ -362,12 +362,12 @@ content
|
|
362
362
|
assert_equal val, doc.attributes[key]
|
363
363
|
end
|
364
364
|
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
365
|
+
refute doc.attributes.key?('backend-html5')
|
366
|
+
refute doc.attributes.key?('backend-html5-doctype-article')
|
367
|
+
refute doc.attributes.key?('basebackend-html')
|
368
|
+
refute doc.attributes.key?('basebackend-html-doctype-article')
|
369
|
+
refute doc.attributes.key?('doctype-article')
|
370
|
+
refute doc.attributes.key?('filetype-html')
|
371
371
|
end
|
372
372
|
|
373
373
|
test 'backend attributes defined in document options overrides backend attribute in document' do
|
@@ -420,7 +420,7 @@ content
|
|
420
420
|
|
421
421
|
test 'set_attribute should set attribute if key is not locked' do
|
422
422
|
doc = empty_document
|
423
|
-
|
423
|
+
refute doc.attr? 'foo'
|
424
424
|
res = doc.set_attribute 'foo', 'baz'
|
425
425
|
assert res
|
426
426
|
assert_equal 'baz', (doc.attr 'foo')
|
@@ -430,7 +430,7 @@ content
|
|
430
430
|
doc = empty_document :attributes => { 'foo' => 'bar' }
|
431
431
|
assert_equal 'bar', (doc.attr 'foo')
|
432
432
|
res = doc.set_attribute 'foo', 'baz'
|
433
|
-
|
433
|
+
refute res
|
434
434
|
assert_equal 'bar', (doc.attr 'foo')
|
435
435
|
end
|
436
436
|
|
@@ -439,7 +439,7 @@ content
|
|
439
439
|
assert_equal '', (doc.attr 'backend-html5')
|
440
440
|
res = doc.set_attribute 'backend', 'docbook5'
|
441
441
|
assert res
|
442
|
-
|
442
|
+
refute doc.attr? 'backend-html5'
|
443
443
|
assert_equal '', (doc.attr 'backend-docbook5')
|
444
444
|
end
|
445
445
|
|
@@ -467,10 +467,10 @@ toc toc-placement! | |content |macro |nil
|
|
467
467
|
raw_attrs, toc, toc_position, toc_placement, toc_class = expect
|
468
468
|
attrs = Hash[*raw_attrs.split.map {|e| e.include?('=') ? e.split('=', 2) : [e, ''] }.flatten]
|
469
469
|
doc = document_from_string '', :attributes => attrs
|
470
|
-
toc ? (assert doc.attr?('toc', toc)) : (
|
471
|
-
toc_position ? (assert doc.attr?('toc-position', toc_position)) : (
|
472
|
-
toc_placement ? (assert doc.attr?('toc-placement', toc_placement)) : (
|
473
|
-
toc_class ? (assert doc.attr?('toc-class', toc_class)) : (
|
470
|
+
toc ? (assert doc.attr?('toc', toc)) : (refute doc.attr?('toc'))
|
471
|
+
toc_position ? (assert doc.attr?('toc-position', toc_position)) : (refute doc.attr?('toc-position'))
|
472
|
+
toc_placement ? (assert doc.attr?('toc-placement', toc_placement)) : (refute doc.attr?('toc-placement'))
|
473
|
+
toc_class ? (assert doc.attr?('toc-class', toc_class)) : (refute doc.attr?('toc-class'))
|
474
474
|
end
|
475
475
|
end
|
476
476
|
end
|
@@ -1116,7 +1116,7 @@ paragraph
|
|
1116
1116
|
|
1117
1117
|
doc = document_from_string input
|
1118
1118
|
para = doc.blocks.first
|
1119
|
-
|
1119
|
+
refute para.attributes.has_key?('id')
|
1120
1120
|
end
|
1121
1121
|
|
1122
1122
|
test 'role? returns true if role is assigned' do
|
@@ -1140,7 +1140,7 @@ A paragraph
|
|
1140
1140
|
p = doc.blocks.first
|
1141
1141
|
assert p.role?('lead')
|
1142
1142
|
p2 = doc.blocks.last
|
1143
|
-
|
1143
|
+
refute p2.role?('final')
|
1144
1144
|
end
|
1145
1145
|
|
1146
1146
|
test 'has_role? can check for precense of role name' do
|
@@ -1151,7 +1151,7 @@ A paragraph
|
|
1151
1151
|
|
1152
1152
|
doc = document_from_string input
|
1153
1153
|
p = doc.blocks.first
|
1154
|
-
|
1154
|
+
refute p.role?('lead')
|
1155
1155
|
assert p.has_role?('lead')
|
1156
1156
|
end
|
1157
1157
|
|
@@ -1265,7 +1265,7 @@ A normal paragraph
|
|
1265
1265
|
assert res
|
1266
1266
|
assert_equal 'role2', para.attributes['role']
|
1267
1267
|
assert para.has_role? 'role2'
|
1268
|
-
|
1268
|
+
refute para.has_role?('role1')
|
1269
1269
|
end
|
1270
1270
|
|
1271
1271
|
test 'roles are removed when last role is removed using remove_role' do
|
@@ -1293,7 +1293,7 @@ A normal paragraph
|
|
1293
1293
|
refute res
|
1294
1294
|
assert_equal 'role1', para.attributes['role']
|
1295
1295
|
assert para.has_role? 'role1'
|
1296
|
-
|
1296
|
+
refute para.has_role?('role2')
|
1297
1297
|
end
|
1298
1298
|
|
1299
1299
|
test 'roles are not changed when using remove_role if the node has no roles' do
|
@@ -1305,7 +1305,7 @@ A normal paragraph
|
|
1305
1305
|
res = para.remove_role 'role1'
|
1306
1306
|
refute res
|
1307
1307
|
assert_equal nil, para.attributes['role']
|
1308
|
-
|
1308
|
+
refute para.has_role?('role1')
|
1309
1309
|
end
|
1310
1310
|
|
1311
1311
|
test 'option can be specified in first position of block style using shorthand syntax' do
|
@@ -1344,7 +1344,7 @@ content
|
|
1344
1344
|
section = doc.blocks[0]
|
1345
1345
|
refute_nil section
|
1346
1346
|
assert_equal :section, section.context
|
1347
|
-
|
1347
|
+
refute section.special
|
1348
1348
|
output = doc.convert
|
1349
1349
|
assert_css 'section', output, 1
|
1350
1350
|
assert_css 'section#idname', output, 1
|
data/test/blocks_test.rb
CHANGED
@@ -85,6 +85,23 @@ second paragraph
|
|
85
85
|
assert_xpath '//p', output, 2
|
86
86
|
end
|
87
87
|
|
88
|
+
test 'comment block between paragraphs offset by blank lines inside delimited block' do
|
89
|
+
input = <<-EOS
|
90
|
+
====
|
91
|
+
first paragraph
|
92
|
+
|
93
|
+
////
|
94
|
+
block comment
|
95
|
+
////
|
96
|
+
|
97
|
+
second paragraph
|
98
|
+
====
|
99
|
+
EOS
|
100
|
+
output = render_embedded_string input
|
101
|
+
refute_match(/block comment/, output)
|
102
|
+
assert_xpath '//p', output, 2
|
103
|
+
end
|
104
|
+
|
88
105
|
test 'adjacent comment block between paragraphs' do
|
89
106
|
input = <<-EOS
|
90
107
|
first paragraph
|
@@ -133,7 +150,7 @@ block comment
|
|
133
150
|
EOS
|
134
151
|
|
135
152
|
output = render_embedded_string input
|
136
|
-
|
153
|
+
refute_empty output.strip, "Line should be emitted => #{input.rstrip}"
|
137
154
|
end
|
138
155
|
|
139
156
|
test 'preprocessor directives should not be processed within comment block within block metadata' do
|
@@ -181,9 +198,9 @@ line should not be rendered
|
|
181
198
|
assert_xpath '//p', output, 0
|
182
199
|
end
|
183
200
|
|
184
|
-
# WARNING
|
185
|
-
# it happens because we always look a line ahead
|
186
|
-
test 'preprocessor directives should not be processed
|
201
|
+
# WARNING this assertion fails if the directive is the first line of the paragraph instead of the second
|
202
|
+
# it happens because we always look a line ahead; not sure what we can do about it
|
203
|
+
test 'preprocessor directives should not be processed on subsequent lines of a comment paragraph' do
|
187
204
|
input = <<-EOS
|
188
205
|
[comment]
|
189
206
|
first line of content
|
@@ -237,6 +254,24 @@ not this text
|
|
237
254
|
assert_xpath '/*[@class="exampleblock"]', result, 1
|
238
255
|
assert_xpath '/*[@class="exampleblock"]//*[normalize-space(text())="not this text"]', result, 1
|
239
256
|
end
|
257
|
+
|
258
|
+
# NOTE this test verifies the nil return value of Parser#next_block
|
259
|
+
test 'should not drop content that follows skipped content inside a delimited block' do
|
260
|
+
input = <<-EOS
|
261
|
+
====
|
262
|
+
paragraph
|
263
|
+
|
264
|
+
[comment#idname]
|
265
|
+
skip
|
266
|
+
|
267
|
+
paragraph
|
268
|
+
====
|
269
|
+
EOS
|
270
|
+
result = render_embedded_string input
|
271
|
+
assert_xpath '/*[@class="exampleblock"]', result, 1
|
272
|
+
assert_xpath '/*[@class="exampleblock"]//*[@class="paragraph"]', result, 2
|
273
|
+
assert_xpath '//*[@class="paragraph"][@id="idname"]', result, 0
|
274
|
+
end
|
240
275
|
end
|
241
276
|
|
242
277
|
context 'Quote and Verse Blocks' do
|
@@ -605,7 +640,7 @@ You just write.
|
|
605
640
|
assert_nil doc.blocks[0].number
|
606
641
|
output = doc.render
|
607
642
|
assert_xpath '(//*[@class="exampleblock"])[1]/*[@class="title"][text()="Look! Writing Docs with AsciiDoc"]', output, 1
|
608
|
-
|
643
|
+
refute doc.attributes.has_key?('example-number')
|
609
644
|
end
|
610
645
|
|
611
646
|
test 'automatic caption can be turned off and on and modified' do
|
@@ -1127,7 +1162,7 @@ This is a passthrough block.
|
|
1127
1162
|
EOS
|
1128
1163
|
|
1129
1164
|
block = block_from_string input
|
1130
|
-
|
1165
|
+
refute_nil block
|
1131
1166
|
assert_equal 1, block.lines.size
|
1132
1167
|
assert_equal 'This is a passthrough block.', block.source
|
1133
1168
|
end
|
@@ -1402,7 +1437,7 @@ section paragraph
|
|
1402
1437
|
assert_xpath '//*[@id="content"]/h1[text()="Section Title"]', output, 1
|
1403
1438
|
assert_xpath '//*[@class="paragraph"]', output, 1
|
1404
1439
|
assert_xpath '//*[@class="paragraph"]/*[@class="title"][text()="Block title"]', output, 1
|
1405
|
-
|
1440
|
+
refute_empty errors
|
1406
1441
|
assert_match(/only book doctypes can contain level 0 sections/, errors)
|
1407
1442
|
end
|
1408
1443
|
|
@@ -1433,7 +1468,7 @@ Block content
|
|
1433
1468
|
|
1434
1469
|
output = render_embedded_string input
|
1435
1470
|
assert output.include?('Block content')
|
1436
|
-
|
1471
|
+
refute output.include?('[]')
|
1437
1472
|
end
|
1438
1473
|
|
1439
1474
|
test 'empty block anchor should not appear in output' do
|
@@ -1446,7 +1481,7 @@ Block content
|
|
1446
1481
|
|
1447
1482
|
output = render_embedded_string input
|
1448
1483
|
assert output.include?('Block content')
|
1449
|
-
|
1484
|
+
refute output.include?('[[]]')
|
1450
1485
|
end
|
1451
1486
|
end
|
1452
1487
|
|
@@ -1726,7 +1761,7 @@ image::images/tiger.png[Tiger]
|
|
1726
1761
|
output = doc.render
|
1727
1762
|
assert_xpath '//*[@class="imageblock"]//img[@src="images/tiger.png"][@alt="Tiger"]', output, 1
|
1728
1763
|
assert_xpath '//*[@class="imageblock"]/*[@class="title"][text() = "Voila! The AsciiDoc Tiger"]', output, 1
|
1729
|
-
|
1764
|
+
refute doc.attributes.has_key?('figure-number')
|
1730
1765
|
end
|
1731
1766
|
|
1732
1767
|
test 'can align image in DocBook backend' do
|
@@ -1809,7 +1844,7 @@ image::{bogus}[]
|
|
1809
1844
|
EOS
|
1810
1845
|
|
1811
1846
|
output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
|
1812
|
-
|
1847
|
+
assert_empty output.strip
|
1813
1848
|
assert_includes warnings, 'dropping line containing reference to missing attribute'
|
1814
1849
|
end
|
1815
1850
|
|
@@ -1821,7 +1856,7 @@ image::{bogus}[]
|
|
1821
1856
|
EOS
|
1822
1857
|
|
1823
1858
|
output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
|
1824
|
-
|
1859
|
+
assert_empty output.strip
|
1825
1860
|
assert_includes warnings, 'dropping line containing reference to missing attribute'
|
1826
1861
|
end
|
1827
1862
|
|
@@ -1837,7 +1872,7 @@ image::{bogus}[]
|
|
1837
1872
|
output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
|
1838
1873
|
assert_css 'img', output, 0
|
1839
1874
|
assert_css 'h2', output, 1
|
1840
|
-
|
1875
|
+
refute output.include?('== Section Title')
|
1841
1876
|
assert_includes warnings, 'dropping line containing reference to missing attribute'
|
1842
1877
|
end
|
1843
1878
|
|
@@ -2651,7 +2686,7 @@ public class Printer {
|
|
2651
2686
|
assert_match(/\.<em>out<\/em>\./, output, 1)
|
2652
2687
|
assert_match(/\*asterisks\*/, output, 1)
|
2653
2688
|
assert_match(/<strong>bold<\/strong>/, output, 1)
|
2654
|
-
|
2689
|
+
refute output.include?(Asciidoctor::Substitutors::PASS_START)
|
2655
2690
|
end
|
2656
2691
|
|
2657
2692
|
test 'should link to CodeRay stylesheet if source-highlighter is coderay and linkcss is set' do
|
@@ -2743,7 +2778,7 @@ puts HTML::Pipeline.new(filters, {}).call(input)[:output]
|
|
2743
2778
|
:source-highlighter: coderay
|
2744
2779
|
EOS
|
2745
2780
|
doc = document_from_string input, :safe => Asciidoctor::SafeMode::SERVER
|
2746
|
-
|
2781
|
+
assert_nil doc.attributes['source-highlighter']
|
2747
2782
|
end
|
2748
2783
|
end
|
2749
2784
|
|
@@ -3151,7 +3186,7 @@ content
|
|
3151
3186
|
block = doc.blocks.first
|
3152
3187
|
assert_nil block.id
|
3153
3188
|
assert_nil(block.attr 'reftext')
|
3154
|
-
|
3189
|
+
refute doc.catalog[:ids].has_key?('illegal$id')
|
3155
3190
|
end
|
3156
3191
|
|
3157
3192
|
test 'should not recognize block anchor that starts with digit' do
|
data/test/converter_test.rb
CHANGED
@@ -167,25 +167,25 @@ Sidebar content
|
|
167
167
|
caches = Asciidoctor::Converter::TemplateConverter.caches
|
168
168
|
if defined? ::ThreadSafe::Cache
|
169
169
|
assert caches[:templates].is_a?(::ThreadSafe::Cache)
|
170
|
-
|
170
|
+
refute_empty caches[:templates]
|
171
171
|
paragraph_template_before = caches[:templates].values.find {|t| File.basename(t.file) == 'block_paragraph.html.haml' }
|
172
|
-
|
172
|
+
refute_nil paragraph_template_before
|
173
173
|
|
174
174
|
# should use cache
|
175
175
|
doc = Asciidoctor::Document.new [], :template_dir => template_dir
|
176
176
|
template_converter = doc.converter.find_converter('paragraph')
|
177
177
|
paragraph_template_after = template_converter.templates['paragraph']
|
178
|
-
|
178
|
+
refute_nil paragraph_template_after
|
179
179
|
assert paragraph_template_before.eql?(paragraph_template_after)
|
180
180
|
|
181
181
|
# should not use cache
|
182
182
|
doc = Asciidoctor::Document.new [], :template_dir => template_dir, :template_cache => false
|
183
183
|
template_converter = doc.converter.find_converter('paragraph')
|
184
184
|
paragraph_template_after = template_converter.templates['paragraph']
|
185
|
-
|
186
|
-
|
185
|
+
refute_nil paragraph_template_after
|
186
|
+
refute paragraph_template_before.eql?(paragraph_template_after)
|
187
187
|
else
|
188
|
-
|
188
|
+
assert_empty caches
|
189
189
|
end
|
190
190
|
ensure
|
191
191
|
# clean up
|
@@ -199,10 +199,10 @@ Sidebar content
|
|
199
199
|
caches = { :scans => {}, :templates => {} }
|
200
200
|
doc = Asciidoctor::Document.new [], :template_dir => template_dir, :template_cache => caches
|
201
201
|
doc.converter
|
202
|
-
|
203
|
-
|
202
|
+
refute_empty caches[:scans]
|
203
|
+
refute_empty caches[:templates]
|
204
204
|
paragraph_template = caches[:templates].values.find {|t| File.basename(t.file) == 'block_paragraph.html.haml' }
|
205
|
-
|
205
|
+
refute_nil paragraph_template
|
206
206
|
assert paragraph_template.is_a? ::Tilt::HamlTemplate
|
207
207
|
end
|
208
208
|
|
@@ -231,7 +231,7 @@ Sidebar content
|
|
231
231
|
assert selected.is_a? Asciidoctor::Converter::TemplateConverter
|
232
232
|
template = selected.templates[node_name]
|
233
233
|
assert template.is_a? Tilt::ERBTemplate
|
234
|
-
|
234
|
+
refute template.is_a? Tilt::ErubisTemplate
|
235
235
|
assert template.instance_variable_get('@engine').is_a? ::ERB
|
236
236
|
assert_equal %(block_#{node_name}.html.erb), File.basename(selected.templates[node_name].file)
|
237
237
|
end
|
data/test/document_test.rb
CHANGED
@@ -18,7 +18,7 @@ context 'Document' do
|
|
18
18
|
assert_equal 'header', doc.header.sectname
|
19
19
|
assert_equal 14, doc.blocks.size
|
20
20
|
assert_equal :preamble, doc.blocks[0].context
|
21
|
-
|
21
|
+
assert_equal :section, doc.blocks[1].context
|
22
22
|
|
23
23
|
# verify compat-mode is set when atx-style doctitle is used
|
24
24
|
result = doc.blocks[0].convert
|
@@ -61,9 +61,9 @@ context 'Document' do
|
|
61
61
|
assert_equal Asciidoctor::SafeMode::SECURE, doc.attr('safe-mode-level')
|
62
62
|
assert_equal 'secure', doc.attr('safe-mode-name')
|
63
63
|
assert doc.attr?('safe-mode-secure')
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
refute doc.attr?('safe-mode-unsafe')
|
65
|
+
refute doc.attr?('safe-mode-safe')
|
66
|
+
refute doc.attr?('safe-mode-server')
|
67
67
|
end
|
68
68
|
|
69
69
|
test 'safe mode level can be set in the constructor' do
|
@@ -105,8 +105,8 @@ context 'Document' do
|
|
105
105
|
:sectnums!:
|
106
106
|
EOS
|
107
107
|
doc = document_from_string input, :backend => 'docbook'
|
108
|
-
|
109
|
-
|
108
|
+
refute doc.attr?('toc')
|
109
|
+
refute doc.attr?('sectnums')
|
110
110
|
end
|
111
111
|
|
112
112
|
test 'noheader attribute should suppress info element when converting to DocBook' do
|
@@ -127,7 +127,7 @@ content
|
|
127
127
|
:numbered!:
|
128
128
|
EOS
|
129
129
|
doc = document_from_string input, :backend => 'docbook'
|
130
|
-
|
130
|
+
refute doc.attr?('sectnums')
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
@@ -169,7 +169,7 @@ preamble
|
|
169
169
|
EOS
|
170
170
|
doc = Asciidoctor.load(input, :safe => Asciidoctor::SafeMode::SAFE)
|
171
171
|
assert_equal 'Document Title', doc.doctitle
|
172
|
-
|
172
|
+
refute doc.attr?('docfile')
|
173
173
|
assert_equal doc.base_dir, doc.attr('docdir')
|
174
174
|
end
|
175
175
|
|
@@ -182,7 +182,7 @@ preamble
|
|
182
182
|
EOS
|
183
183
|
doc = Asciidoctor.load(input, :safe => Asciidoctor::SafeMode::SAFE)
|
184
184
|
assert_equal 'Document Title', doc.doctitle
|
185
|
-
|
185
|
+
refute doc.attr?('docfile')
|
186
186
|
assert_equal doc.base_dir, doc.attr('docdir')
|
187
187
|
end
|
188
188
|
|
@@ -195,14 +195,14 @@ preamble
|
|
195
195
|
EOS
|
196
196
|
doc = Asciidoctor.load(input.lines.entries, :safe => Asciidoctor::SafeMode::SAFE)
|
197
197
|
assert_equal 'Document Title', doc.doctitle
|
198
|
-
|
198
|
+
refute doc.attr?('docfile')
|
199
199
|
assert_equal doc.base_dir, doc.attr('docdir')
|
200
200
|
end
|
201
201
|
|
202
202
|
test 'should accept attributes as array' do
|
203
203
|
# NOTE there's a tab character before idseparator
|
204
204
|
doc = Asciidoctor.load('text', :attributes => %w(toc sectnums source-highlighter=coderay idprefix idseparator=-))
|
205
|
-
|
205
|
+
assert_kind_of Hash, doc.attributes
|
206
206
|
assert doc.attr?('toc')
|
207
207
|
assert_equal '', doc.attr('toc')
|
208
208
|
assert doc.attr?('sectnums')
|
@@ -217,7 +217,7 @@ preamble
|
|
217
217
|
|
218
218
|
test 'should accept attributes as empty array' do
|
219
219
|
doc = Asciidoctor.load('text', :attributes => [])
|
220
|
-
|
220
|
+
assert_kind_of Hash, doc.attributes
|
221
221
|
end
|
222
222
|
|
223
223
|
test 'should accept attributes as string' do
|
@@ -225,7 +225,7 @@ preamble
|
|
225
225
|
source-highlighter=coderay
|
226
226
|
idprefix
|
227
227
|
idseparator=-')
|
228
|
-
|
228
|
+
assert_kind_of Hash, doc.attributes
|
229
229
|
assert doc.attr?('toc')
|
230
230
|
assert_equal '', doc.attr('toc')
|
231
231
|
assert doc.attr?('sectnums')
|
@@ -240,7 +240,7 @@ idseparator=-')
|
|
240
240
|
|
241
241
|
test 'should accept values containing spaces in attributes string' do
|
242
242
|
doc = Asciidoctor.load('text', :attributes => %(idprefix idseparator=- note-caption=Note\\ to\\\tself toc))
|
243
|
-
|
243
|
+
assert_kind_of Hash, doc.attributes
|
244
244
|
assert doc.attr?('idprefix')
|
245
245
|
assert_equal '', doc.attr('idprefix')
|
246
246
|
assert doc.attr?('idseparator')
|
@@ -251,12 +251,12 @@ idseparator=-')
|
|
251
251
|
|
252
252
|
test 'should accept attributes as empty string' do
|
253
253
|
doc = Asciidoctor.load('text', :attributes => '')
|
254
|
-
|
254
|
+
assert_kind_of Hash, doc.attributes
|
255
255
|
end
|
256
256
|
|
257
257
|
test 'should accept attributes as nil' do
|
258
258
|
doc = Asciidoctor.load('text', :attributes => nil)
|
259
|
-
|
259
|
+
assert_kind_of Hash, doc.attributes
|
260
260
|
end
|
261
261
|
|
262
262
|
test 'should accept attributes if hash like' do
|
@@ -275,7 +275,7 @@ idseparator=-')
|
|
275
275
|
end
|
276
276
|
|
277
277
|
doc = Asciidoctor.load('text', :attributes => Hashish.new)
|
278
|
-
|
278
|
+
assert_kind_of Hash, doc.attributes
|
279
279
|
assert doc.attributes.has_key?('toc')
|
280
280
|
end
|
281
281
|
|
@@ -546,9 +546,9 @@ term without description::
|
|
546
546
|
result = doc.find_by
|
547
547
|
refute_nil result
|
548
548
|
assert_equal 3, result.size
|
549
|
-
|
550
|
-
|
551
|
-
|
549
|
+
assert_kind_of Asciidoctor::Document, result[0]
|
550
|
+
assert_kind_of Asciidoctor::List, result[1]
|
551
|
+
assert_kind_of Asciidoctor::ListItem, result[2]
|
552
552
|
end
|
553
553
|
end
|
554
554
|
|
@@ -557,7 +557,7 @@ term without description::
|
|
557
557
|
sample_input_path = fixture_path('sample.asciidoc')
|
558
558
|
|
559
559
|
output = Asciidoctor.convert_file sample_input_path, :header_footer => true, :to_file => false
|
560
|
-
|
560
|
+
refute_empty output
|
561
561
|
assert_xpath '/html', output, 1
|
562
562
|
assert_xpath '/html/head', output, 1
|
563
563
|
assert_xpath '/html/body', output, 1
|
@@ -569,12 +569,12 @@ term without description::
|
|
569
569
|
sample_input_path = fixture_path('sample.asciidoc')
|
570
570
|
|
571
571
|
output = Asciidoctor.convert_file sample_input_path, :header_footer => true, :to_file => false
|
572
|
-
|
572
|
+
refute_empty output
|
573
573
|
lines = output.split("\n")
|
574
|
-
|
574
|
+
assert_equal lines.size, output.split(/\r\n|\r|\n/).size
|
575
575
|
raw_lengths = lines.map(&:length)
|
576
576
|
trimmed_lengths = lines.map {|line| line.rstrip.length }
|
577
|
-
|
577
|
+
assert_equal raw_lengths, trimmed_lengths
|
578
578
|
end
|
579
579
|
|
580
580
|
test 'should accept attributes as array' do
|
@@ -608,8 +608,8 @@ text
|
|
608
608
|
assert_css 'html:root > head > link[rel="stylesheet"][href="./asciidoctor.css"]', output, 0
|
609
609
|
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
|
610
610
|
styles = stylenode.content
|
611
|
-
|
612
|
-
|
611
|
+
refute_nil styles
|
612
|
+
refute_empty styles.strip
|
613
613
|
end
|
614
614
|
|
615
615
|
test 'should link to default stylesheet by default even if linkcss is unset in document' do
|
@@ -644,8 +644,8 @@ text
|
|
644
644
|
assert_css 'html:root > head > style', output, 1
|
645
645
|
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
|
646
646
|
styles = stylenode.content
|
647
|
-
|
648
|
-
|
647
|
+
refute_nil styles
|
648
|
+
refute_empty styles.strip
|
649
649
|
end
|
650
650
|
|
651
651
|
test 'should not link to stylesheet if stylesheet is unset' do
|
@@ -692,8 +692,8 @@ text
|
|
692
692
|
:attributes => {'stylesheet' => 'custom.css', 'stylesdir' => './stylesheets', 'linkcss!' => ''}
|
693
693
|
stylenode = xmlnodes_at_css 'html:root > head > style', output, 1
|
694
694
|
styles = stylenode.content
|
695
|
-
|
696
|
-
|
695
|
+
refute_nil styles
|
696
|
+
refute_empty styles.strip
|
697
697
|
end
|
698
698
|
|
699
699
|
test 'should convert source file and write result to adjacent file by default' do
|
@@ -703,7 +703,7 @@ text
|
|
703
703
|
Asciidoctor.convert_file sample_input_path
|
704
704
|
assert File.exist?(sample_output_path)
|
705
705
|
output = IO.read(sample_output_path)
|
706
|
-
|
706
|
+
refute_empty output
|
707
707
|
assert_xpath '/html', output, 1
|
708
708
|
assert_xpath '/html/head', output, 1
|
709
709
|
assert_xpath '/html/body', output, 1
|
@@ -721,7 +721,7 @@ text
|
|
721
721
|
Asciidoctor.convert_file sample_input_path, :to_file => sample_output_path
|
722
722
|
assert File.exist?(sample_output_path)
|
723
723
|
output = IO.read(sample_output_path)
|
724
|
-
|
724
|
+
refute_empty output
|
725
725
|
assert_xpath '/html', output, 1
|
726
726
|
assert_xpath '/html/head', output, 1
|
727
727
|
assert_xpath '/html/body', output, 1
|
@@ -740,7 +740,7 @@ text
|
|
740
740
|
Asciidoctor.convert_file sample_input_path, :to_file => 'result.html', :base_dir => fixture_dir
|
741
741
|
assert File.exist?(sample_output_path)
|
742
742
|
output = IO.read(sample_output_path)
|
743
|
-
|
743
|
+
refute_empty output
|
744
744
|
assert_xpath '/html', output, 1
|
745
745
|
assert_xpath '/html/head', output, 1
|
746
746
|
assert_xpath '/html/body', output, 1
|
@@ -865,7 +865,7 @@ text
|
|
865
865
|
cases.each do |attr_val, markup|
|
866
866
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
867
867
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => %(linkcss copycss! #{attr_val})
|
868
|
-
|
868
|
+
refute_empty output
|
869
869
|
assert_css 'script[src="modernizr.js"]', output, markup[:head_script]
|
870
870
|
assert_css 'meta[http-equiv="imagetoolbar"]', output, markup[:meta]
|
871
871
|
assert_css 'body > a#top', output, markup[:top_link]
|
@@ -877,7 +877,7 @@ text
|
|
877
877
|
sample_input_path = fixture_path('basic.asciidoc')
|
878
878
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
879
879
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo1' => '', 'nofooter' => ''}
|
880
|
-
|
880
|
+
refute_empty output
|
881
881
|
assert_css 'body > a#top', output, 1
|
882
882
|
end
|
883
883
|
|
@@ -886,25 +886,25 @@ text
|
|
886
886
|
|
887
887
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
888
888
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo' => '', 'docinfodir' => 'custom-docinfodir'}
|
889
|
-
|
889
|
+
refute_empty output
|
890
890
|
assert_css 'script[src="bootstrap.js"]', output, 1
|
891
891
|
assert_css 'meta[name="robots"]', output, 0
|
892
892
|
|
893
893
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
894
894
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo1' => '', 'docinfodir' => 'custom-docinfodir'}
|
895
|
-
|
895
|
+
refute_empty output
|
896
896
|
assert_css 'script[src="bootstrap.js"]', output, 0
|
897
897
|
assert_css 'meta[name="robots"]', output, 1
|
898
898
|
|
899
899
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
900
900
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo2' => '', 'docinfodir' => './custom-docinfodir'}
|
901
|
-
|
901
|
+
refute_empty output
|
902
902
|
assert_css 'script[src="bootstrap.js"]', output, 1
|
903
903
|
assert_css 'meta[name="robots"]', output, 1
|
904
904
|
|
905
905
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
906
906
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo2' => '', 'docinfodir' => 'custom-docinfodir/subfolder'}
|
907
|
-
|
907
|
+
refute_empty output
|
908
908
|
assert_css 'script[src="bootstrap.js"]', output, 0
|
909
909
|
assert_css 'meta[name="robots"]', output, 0
|
910
910
|
end
|
@@ -914,13 +914,13 @@ text
|
|
914
914
|
|
915
915
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
916
916
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo' => ''}
|
917
|
-
|
917
|
+
refute_empty output
|
918
918
|
assert_css 'productname', output, 0
|
919
919
|
assert_css 'copyright', output, 1
|
920
920
|
|
921
921
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
922
922
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo1' => ''}
|
923
|
-
|
923
|
+
refute_empty output
|
924
924
|
assert_css 'productname', output, 1
|
925
925
|
assert_xpath '//xmlns:productname[text()="Asciidoctor™"]', output, 1
|
926
926
|
assert_css 'edition', output, 1
|
@@ -929,7 +929,7 @@ text
|
|
929
929
|
|
930
930
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
931
931
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo2' => ''}
|
932
|
-
|
932
|
+
refute_empty output
|
933
933
|
assert_css 'productname', output, 1
|
934
934
|
assert_xpath '//xmlns:productname[text()="Asciidoctor™"]', output, 1
|
935
935
|
assert_css 'edition', output, 1
|
@@ -942,19 +942,19 @@ text
|
|
942
942
|
|
943
943
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
944
944
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo' => ''}
|
945
|
-
|
945
|
+
refute_empty output
|
946
946
|
assert_css 'body script', output, 1
|
947
947
|
assert_css 'a#top', output, 0
|
948
948
|
|
949
949
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
950
950
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo1' => ''}
|
951
|
-
|
951
|
+
refute_empty output
|
952
952
|
assert_css 'body script', output, 0
|
953
953
|
assert_css 'a#top', output, 1
|
954
954
|
|
955
955
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
956
956
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo2' => ''}
|
957
|
-
|
957
|
+
refute_empty output
|
958
958
|
assert_css 'body script', output, 1
|
959
959
|
assert_css 'a#top', output, 1
|
960
960
|
end
|
@@ -964,20 +964,20 @@ text
|
|
964
964
|
|
965
965
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
966
966
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo' => ''}
|
967
|
-
|
967
|
+
refute_empty output
|
968
968
|
assert_css 'article > revhistory', output, 1
|
969
969
|
assert_xpath '/xmlns:article/xmlns:revhistory/xmlns:revision/xmlns:revnumber[text()="1.0"]', output, 1 # verifies substitutions are performed
|
970
970
|
assert_css 'glossary#_glossary', output, 0
|
971
971
|
|
972
972
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
973
973
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo1' => ''}
|
974
|
-
|
974
|
+
refute_empty output
|
975
975
|
assert_css 'article > revhistory', output, 0
|
976
976
|
assert_css 'glossary#_glossary', output, 1
|
977
977
|
|
978
978
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
979
979
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo2' => ''}
|
980
|
-
|
980
|
+
refute_empty output
|
981
981
|
assert_css 'article > revhistory', output, 1
|
982
982
|
assert_xpath '/xmlns:article/xmlns:revhistory/xmlns:revision/xmlns:revnumber[text()="1.0"]', output, 1 # verifies substitutions are performed
|
983
983
|
assert_css 'glossary#_glossary', output, 1
|
@@ -1000,7 +1000,7 @@ text
|
|
1000
1000
|
end
|
1001
1001
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
1002
1002
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER, :attributes => {'docinfo2' => ''}
|
1003
|
-
|
1003
|
+
refute_empty output
|
1004
1004
|
assert_css 'productname', output, 1
|
1005
1005
|
assert_css 'edition', output, 1
|
1006
1006
|
assert_xpath '//xmlns:edition[text()="1.0"]', output, 1 # verifies substitutions are performed
|
@@ -1019,13 +1019,13 @@ text
|
|
1019
1019
|
|
1020
1020
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
1021
1021
|
:header_footer => true, :safe => Asciidoctor::SafeMode::SERVER
|
1022
|
-
|
1022
|
+
refute_empty output
|
1023
1023
|
assert_css 'script[src="modernizr.js"]', output, 0
|
1024
1024
|
assert_css 'meta[http-equiv="imagetoolbar"]', output, 0
|
1025
1025
|
|
1026
1026
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
1027
1027
|
:header_footer => true, :backend => 'docbook', :safe => Asciidoctor::SafeMode::SERVER
|
1028
|
-
|
1028
|
+
refute_empty output
|
1029
1029
|
assert_css 'productname', output, 0
|
1030
1030
|
assert_css 'copyright', output, 0
|
1031
1031
|
end
|
@@ -1035,13 +1035,13 @@ text
|
|
1035
1035
|
|
1036
1036
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
1037
1037
|
:header_footer => true, :attributes => {'docinfo2' => ''}
|
1038
|
-
|
1038
|
+
refute_empty output
|
1039
1039
|
assert_css 'script[src="modernizr.js"]', output, 0
|
1040
1040
|
assert_css 'meta[http-equiv="imagetoolbar"]', output, 0
|
1041
1041
|
|
1042
1042
|
output = Asciidoctor.convert_file sample_input_path, :to_file => false,
|
1043
1043
|
:header_footer => true, :backend => 'docbook', :attributes => {'docinfo2' => ''}
|
1044
|
-
|
1044
|
+
refute_empty output
|
1045
1045
|
assert_css 'productname', output, 0
|
1046
1046
|
assert_css 'copyright', output, 0
|
1047
1047
|
end
|
@@ -1056,7 +1056,7 @@ text
|
|
1056
1056
|
:attributes => { 'docinfo' => '', 'bootstrap-version' => nil, 'linkcss' => '', 'attribute-missing' => 'drop-line' }
|
1057
1057
|
[output, err.string]
|
1058
1058
|
end
|
1059
|
-
|
1059
|
+
refute_empty output
|
1060
1060
|
assert_css 'script', output, 0
|
1061
1061
|
assert_xpath %(//meta[@name="copyright"][@content="(C) OpenDevise"]), output, 1
|
1062
1062
|
assert_includes warnings, 'dropping line containing reference to missing attribute'
|
@@ -1069,7 +1069,7 @@ text
|
|
1069
1069
|
:header_footer => true,
|
1070
1070
|
:safe => :server,
|
1071
1071
|
:attributes => { 'docinfo' => '', 'docinfosubs' => 'attributes,replacements', 'linkcss' => '' }
|
1072
|
-
|
1072
|
+
refute_empty output
|
1073
1073
|
assert_css 'script[src="bootstrap.3.2.0.min.js"]', output, 1
|
1074
1074
|
assert_xpath %(//meta[@name="copyright"][@content="#{decode_char 169} OpenDevise"]), output, 1
|
1075
1075
|
end
|
@@ -1093,9 +1093,9 @@ text
|
|
1093
1093
|
assert_equal 'html', doc.attributes['basebackend']
|
1094
1094
|
assert doc.attributes.has_key? 'basebackend-html'
|
1095
1095
|
converter = doc.converter
|
1096
|
-
|
1096
|
+
assert_kind_of Asciidoctor::Converter::Html5Converter, converter
|
1097
1097
|
BUILT_IN_ELEMENTS.each do |element|
|
1098
|
-
|
1098
|
+
assert_respond_to converter, element
|
1099
1099
|
end
|
1100
1100
|
end
|
1101
1101
|
|
@@ -1107,9 +1107,9 @@ text
|
|
1107
1107
|
assert_equal 'docbook', doc.attributes['basebackend']
|
1108
1108
|
assert doc.attributes.has_key? 'basebackend-docbook'
|
1109
1109
|
converter = doc.converter
|
1110
|
-
|
1110
|
+
assert_kind_of Asciidoctor::Converter::DocBook45Converter, converter
|
1111
1111
|
BUILT_IN_ELEMENTS.each do |element|
|
1112
|
-
|
1112
|
+
assert_respond_to converter, element
|
1113
1113
|
end
|
1114
1114
|
end
|
1115
1115
|
|
@@ -1121,9 +1121,9 @@ text
|
|
1121
1121
|
assert_equal 'docbook', doc.attributes['basebackend']
|
1122
1122
|
assert doc.attributes.has_key? 'basebackend-docbook'
|
1123
1123
|
converter = doc.converter
|
1124
|
-
|
1124
|
+
assert_kind_of Asciidoctor::Converter::DocBook5Converter, converter
|
1125
1125
|
BUILT_IN_ELEMENTS.each do |element|
|
1126
|
-
|
1126
|
+
assert_respond_to converter, element
|
1127
1127
|
end
|
1128
1128
|
end
|
1129
1129
|
|
@@ -1146,7 +1146,7 @@ text
|
|
1146
1146
|
doc = document_from_string('Snorf')
|
1147
1147
|
assert_nil doc.doctitle
|
1148
1148
|
assert_nil doc.name
|
1149
|
-
|
1149
|
+
refute doc.has_header?
|
1150
1150
|
assert_nil doc.header
|
1151
1151
|
end
|
1152
1152
|
|
@@ -1395,17 +1395,17 @@ content
|
|
1395
1395
|
|
1396
1396
|
test 'should not choke on empty source' do
|
1397
1397
|
doc = Asciidoctor::Document.new ''
|
1398
|
-
|
1398
|
+
assert_empty doc.blocks
|
1399
1399
|
assert_nil doc.doctitle
|
1400
|
-
|
1400
|
+
refute doc.has_header?
|
1401
1401
|
assert_nil doc.header
|
1402
1402
|
end
|
1403
1403
|
|
1404
1404
|
test 'should not choke on nil source' do
|
1405
1405
|
doc = Asciidoctor::Document.new nil
|
1406
|
-
|
1406
|
+
assert_empty doc.blocks
|
1407
1407
|
assert_nil doc.doctitle
|
1408
|
-
|
1408
|
+
refute doc.has_header?
|
1409
1409
|
assert_nil doc.header
|
1410
1410
|
end
|
1411
1411
|
|
@@ -1434,6 +1434,21 @@ more info...
|
|
1434
1434
|
assert_xpath '//*[@id="header"]/*[@class="details"]/span[@id="revremark"][text() = "See changelog."]', output, 1
|
1435
1435
|
end
|
1436
1436
|
|
1437
|
+
test 'should parse revision line if date is empty' do
|
1438
|
+
input = <<-EOS
|
1439
|
+
= Document Title
|
1440
|
+
Author Name
|
1441
|
+
v1.0.0,:remark
|
1442
|
+
|
1443
|
+
content
|
1444
|
+
EOS
|
1445
|
+
|
1446
|
+
doc = document_from_string input
|
1447
|
+
assert_equal '1.0.0', doc.attributes['revnumber']
|
1448
|
+
assert_nil doc.attributes['revdate']
|
1449
|
+
assert_equal 'remark', doc.attributes['revremark']
|
1450
|
+
end
|
1451
|
+
|
1437
1452
|
test 'should include revision history if revdate and revnumber is set' do
|
1438
1453
|
input = <<-EOS
|
1439
1454
|
= Document Title
|
@@ -1612,7 +1627,7 @@ content
|
|
1612
1627
|
|
1613
1628
|
test 'with header footer' do
|
1614
1629
|
doc = document_from_string "= Title\n\nparagraph"
|
1615
|
-
|
1630
|
+
refute doc.attr?('embedded')
|
1616
1631
|
result = doc.render
|
1617
1632
|
assert_xpath '/html', result, 1
|
1618
1633
|
assert_xpath '//*[@id="header"]', result, 1
|
@@ -2329,7 +2344,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
|
|
2329
2344
|
naughty_path = "#{disk_root}etc/passwd"
|
2330
2345
|
doc = empty_document
|
2331
2346
|
secure_path = doc.normalize_asset_path(naughty_path)
|
2332
|
-
|
2347
|
+
refute_equal naughty_path, secure_path
|
2333
2348
|
assert_match(/^#{doc.base_dir}/, secure_path)
|
2334
2349
|
end
|
2335
2350
|
|
@@ -2337,7 +2352,7 @@ asciidoctor - converts AsciiDoc source files to HTML, DocBook and other formats
|
|
2337
2352
|
naughty_path = 'safe/ok/../../../../../etc/passwd'
|
2338
2353
|
doc = empty_document
|
2339
2354
|
secure_path = redirect_streams { doc.normalize_asset_path(naughty_path) }
|
2340
|
-
|
2355
|
+
refute_equal naughty_path, secure_path
|
2341
2356
|
assert_match(/^#{doc.base_dir}/, secure_path)
|
2342
2357
|
end
|
2343
2358
|
|