asciidoctor 0.1.1 → 0.1.2
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 +7 -0
- data/Gemfile +1 -1
- data/LICENSE +2 -2
- data/README.adoc +461 -0
- data/asciidoctor.gemspec +27 -16
- data/compat/asciidoc.conf +139 -0
- data/lib/asciidoctor.rb +212 -69
- data/lib/asciidoctor/abstract_block.rb +41 -0
- data/lib/asciidoctor/abstract_node.rb +128 -81
- data/lib/asciidoctor/attribute_list.rb +5 -2
- data/lib/asciidoctor/backends/base_template.rb +16 -4
- data/lib/asciidoctor/backends/docbook45.rb +112 -42
- data/lib/asciidoctor/backends/html5.rb +206 -90
- data/lib/asciidoctor/block.rb +5 -5
- data/lib/asciidoctor/cli/invoker.rb +38 -34
- data/lib/asciidoctor/cli/options.rb +3 -3
- data/lib/asciidoctor/document.rb +115 -13
- data/lib/asciidoctor/helpers.rb +16 -0
- data/lib/asciidoctor/lexer.rb +486 -359
- data/lib/asciidoctor/path_resolver.rb +360 -0
- data/lib/asciidoctor/reader.rb +122 -23
- data/lib/asciidoctor/renderer.rb +1 -33
- data/lib/asciidoctor/section.rb +1 -1
- data/lib/asciidoctor/substituters.rb +103 -19
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +6 -6
- data/man/asciidoctor.ad +5 -3
- data/stylesheets/asciidoctor.css +274 -0
- data/test/attributes_test.rb +133 -10
- data/test/blocks_test.rb +302 -17
- data/test/document_test.rb +269 -6
- data/test/fixtures/basic-docinfo.html +1 -0
- data/test/fixtures/basic-docinfo.xml +4 -0
- data/test/fixtures/basic.asciidoc +4 -0
- data/test/fixtures/docinfo.html +1 -0
- data/test/fixtures/docinfo.xml +2 -0
- data/test/fixtures/include-file.asciidoc +22 -1
- data/test/fixtures/stylesheets/custom.css +3 -0
- data/test/invoker_test.rb +38 -6
- data/test/lexer_test.rb +64 -21
- data/test/links_test.rb +4 -0
- data/test/lists_test.rb +251 -12
- data/test/paragraphs_test.rb +225 -30
- data/test/paths_test.rb +174 -0
- data/test/reader_test.rb +89 -2
- data/test/sections_test.rb +518 -16
- data/test/substitutions_test.rb +121 -10
- data/test/tables_test.rb +53 -13
- data/test/test_helper.rb +2 -2
- data/test/text_test.rb +5 -5
- metadata +46 -50
- data/README.asciidoc +0 -296
- data/lib/asciidoctor/errors.rb +0 -5
data/test/substitutions_test.rb
CHANGED
@@ -158,7 +158,7 @@ context 'Substitutions' do
|
|
158
158
|
test 'single-line constrained monospaced string' do
|
159
159
|
para = block_from_string(%q{`a few <\{monospaced\}> words`})
|
160
160
|
# NOTE must use apply_normal_subs because constrained monospaced is handled as a passthrough
|
161
|
-
assert_equal '<
|
161
|
+
assert_equal '<code>a few <{monospaced}> words</code>', para.apply_normal_subs(para.buffer)
|
162
162
|
end
|
163
163
|
|
164
164
|
test 'escaped single-line constrained monospaced string' do
|
@@ -170,7 +170,7 @@ context 'Substitutions' do
|
|
170
170
|
test 'multi-line constrained monospaced string' do
|
171
171
|
para = block_from_string(%Q{`a few\n<\{monospaced\}> words`})
|
172
172
|
# NOTE must use apply_normal_subs because constrained monospaced is handled as a passthrough
|
173
|
-
assert_equal "<
|
173
|
+
assert_equal "<code>a few\n<{monospaced}> words</code>", para.apply_normal_subs(para.buffer)
|
174
174
|
end
|
175
175
|
|
176
176
|
test 'single-line unconstrained strong chars' do
|
@@ -231,17 +231,17 @@ context 'Substitutions' do
|
|
231
231
|
|
232
232
|
test 'single-line unconstrained monospaced chars' do
|
233
233
|
para = block_from_string(%q{Git++Hub++})
|
234
|
-
assert_equal 'Git<
|
234
|
+
assert_equal 'Git<code>Hub</code>', para.sub_quotes(para.buffer.join)
|
235
235
|
end
|
236
236
|
|
237
237
|
test 'escaped single-line unconstrained monospaced chars' do
|
238
238
|
para = block_from_string(%q{Git\++Hub++})
|
239
|
-
assert_equal 'Git+<
|
239
|
+
assert_equal 'Git+<code>Hub</code>+', para.sub_quotes(para.buffer.join)
|
240
240
|
end
|
241
241
|
|
242
242
|
test 'multi-line unconstrained monospaced chars' do
|
243
243
|
para = block_from_string(%Q{Git++\nH\nu\nb++})
|
244
|
-
assert_equal "Git<
|
244
|
+
assert_equal "Git<code>\nH\nu\nb</code>", para.sub_quotes(para.buffer.join)
|
245
245
|
end
|
246
246
|
|
247
247
|
test 'single-line superscript chars' do
|
@@ -255,8 +255,8 @@ context 'Substitutions' do
|
|
255
255
|
end
|
256
256
|
|
257
257
|
test 'multi-line superscript chars' do
|
258
|
-
para = block_from_string(%Q{x^(n\n
|
259
|
-
assert_equal "x<sup>(n\n
|
258
|
+
para = block_from_string(%Q{x^(n\n-\n1)^})
|
259
|
+
assert_equal "x<sup>(n\n-\n1)</sup>", para.sub_quotes(para.buffer.join)
|
260
260
|
end
|
261
261
|
|
262
262
|
test 'single-line subscript chars' do
|
@@ -286,6 +286,42 @@ context 'Substitutions' do
|
|
286
286
|
assert_equal %q{<a href="/home.html">Home</a>}, para.sub_macros(para.buffer.join)
|
287
287
|
end
|
288
288
|
|
289
|
+
test 'a mailto macro should be interpreted as a mailto link' do
|
290
|
+
para = block_from_string('mailto:doc.writer@asciidoc.org[]')
|
291
|
+
assert_equal %q{<a href="mailto:doc.writer@asciidoc.org">doc.writer@asciidoc.org</a>}, para.sub_macros(para.buffer.join)
|
292
|
+
end
|
293
|
+
|
294
|
+
test 'a mailto macro with text should be interpreted as a mailto link' do
|
295
|
+
para = block_from_string('mailto:doc.writer@asciidoc.org[Doc Writer]')
|
296
|
+
assert_equal %q{<a href="mailto:doc.writer@asciidoc.org">Doc Writer</a>}, para.sub_macros(para.buffer.join)
|
297
|
+
end
|
298
|
+
|
299
|
+
test 'a mailto macro with text and subject should be interpreted as a mailto link' do
|
300
|
+
para = block_from_string('mailto:doc.writer@asciidoc.org[Doc Writer, Pull request]', :attributes => {'linkattrs' => ''})
|
301
|
+
assert_equal %q{<a href="mailto:doc.writer@asciidoc.org?subject=Pull%20request">Doc Writer</a>}, para.sub_macros(para.buffer.join)
|
302
|
+
end
|
303
|
+
|
304
|
+
test 'a mailto macro with text, subject and body should be interpreted as a mailto link' do
|
305
|
+
para = block_from_string('mailto:doc.writer@asciidoc.org[Doc Writer, Pull request, Please accept my pull request]', :attributes => {'linkattrs' => ''})
|
306
|
+
assert_equal %q{<a href="mailto:doc.writer@asciidoc.org?subject=Pull%20request&body=Please%20accept%20my%20pull%20request">Doc Writer</a>}, para.sub_macros(para.buffer.join)
|
307
|
+
end
|
308
|
+
|
309
|
+
test 'should recognize inline email addresses' do
|
310
|
+
para = block_from_string('doc.writer@asciidoc.org')
|
311
|
+
assert_equal %q{<a href="mailto:doc.writer@asciidoc.org">doc.writer@asciidoc.org</a>}, para.sub_macros(para.buffer.join)
|
312
|
+
para = block_from_string('<doc.writer@asciidoc.org>')
|
313
|
+
assert_equal %q{<<a href="mailto:doc.writer@asciidoc.org">doc.writer@asciidoc.org</a>>}, para.apply_normal_subs(para.buffer)
|
314
|
+
para = block_from_string('author+website@4fs.no')
|
315
|
+
assert_equal %q{<a href="mailto:author+website@4fs.no">author+website@4fs.no</a>}, para.sub_macros(para.buffer.join)
|
316
|
+
para = block_from_string('john@domain.uk.co')
|
317
|
+
assert_equal %q{<a href="mailto:john@domain.uk.co">john@domain.uk.co</a>}, para.sub_macros(para.buffer.join)
|
318
|
+
end
|
319
|
+
|
320
|
+
test 'should ignore escaped inline email address' do
|
321
|
+
para = block_from_string('\doc.writer@asciidoc.org')
|
322
|
+
assert_equal %q{doc.writer@asciidoc.org}, para.sub_macros(para.buffer.join)
|
323
|
+
end
|
324
|
+
|
289
325
|
test 'a single-line raw url should be interpreted as a link' do
|
290
326
|
para = block_from_string('http://google.com')
|
291
327
|
assert_equal %q{<a href="http://google.com">http://google.com</a>}, para.sub_macros(para.buffer.join)
|
@@ -312,6 +348,11 @@ context 'Substitutions' do
|
|
312
348
|
assert_equal %q{http://google.com}, para.sub_macros(para.buffer.join)
|
313
349
|
end
|
314
350
|
|
351
|
+
test 'a comma separated list of links should not include commas in links' do
|
352
|
+
para = block_from_string('http://foo.com, http://bar.com, http://example.org')
|
353
|
+
assert_equal %q{<a href="http://foo.com">http://foo.com</a>, <a href="http://bar.com">http://bar.com</a>, <a href="http://example.org">http://example.org</a>}, para.sub_macros(para.buffer.join)
|
354
|
+
end
|
355
|
+
|
315
356
|
test 'a single-line image macro should be interpreted as an image' do
|
316
357
|
para = block_from_string('image:tiger.png[]')
|
317
358
|
assert_equal %{<span class="image"><img src="tiger.png" alt="tiger"></span>}, para.sub_macros(para.buffer.join).gsub(/>\s+</, '><')
|
@@ -322,6 +363,11 @@ context 'Substitutions' do
|
|
322
363
|
assert_equal %{<span class="image"><img src="tiger.png" alt="Tiger"></span>}, para.sub_macros(para.buffer.join).gsub(/>\s+</, '><')
|
323
364
|
end
|
324
365
|
|
366
|
+
test 'a single-line image macro with text containing escaped square bracket should be interpreted as an image with alt text' do
|
367
|
+
para = block_from_string('image:tiger.png[[Another\] Tiger]')
|
368
|
+
assert_equal %{<span class="image"><img src="tiger.png" alt="[Another] Tiger"></span>}, para.sub_macros(para.buffer.join).gsub(/>\s+</, '><')
|
369
|
+
end
|
370
|
+
|
325
371
|
test 'a single-line image macro with text and dimensions should be interpreted as an image with alt text and dimensions' do
|
326
372
|
para = block_from_string('image:tiger.png[Tiger, 200, 100]')
|
327
373
|
assert_equal %{<span class="image"><img src="tiger.png" alt="Tiger" width="200" height="100"></span>},
|
@@ -334,6 +380,19 @@ context 'Substitutions' do
|
|
334
380
|
para.sub_macros(para.buffer.join).gsub(/>\s+</, '><')
|
335
381
|
end
|
336
382
|
|
383
|
+
test 'a multi-line image macro with text and dimensions should be interpreted as an image with alt text and dimensions' do
|
384
|
+
para = block_from_string(%(image:tiger.png[Another\nAwesome\nTiger, 200,\n100]))
|
385
|
+
assert_equal %{<span class="image"><img src="tiger.png" alt="Another Awesome Tiger" width="200" height="100"></span>},
|
386
|
+
para.sub_macros(para.buffer.join).gsub(/>\s+</, '><')
|
387
|
+
end
|
388
|
+
|
389
|
+
test 'a block image macro should not be detected within paragraph text' do
|
390
|
+
para = block_from_string(%(Not an inline image macro image::tiger.png[].))
|
391
|
+
result = para.sub_macros(para.buffer.join)
|
392
|
+
assert !result.include?('<img ')
|
393
|
+
assert result.include?('image::tiger.png[]')
|
394
|
+
end
|
395
|
+
|
337
396
|
test 'a single-line footnote macro should be registered and rendered as a footnote' do
|
338
397
|
para = block_from_string('Sentence text footnote:[An example footnote.].')
|
339
398
|
assert_equal %(Sentence text <span class="footnote">[<a id="_footnoteref_1" class="footnote" href="#_footnote_1" title="View footnote.">1</a>]</span>.), para.sub_macros(para.buffer.join)
|
@@ -621,12 +680,64 @@ context 'Substitutions' do
|
|
621
680
|
end
|
622
681
|
|
623
682
|
# NOTE placeholder is surrounded by text to prevent reader from stripping trailing boundary char (unique to test scenario)
|
624
|
-
# TODO add two entries to ensure index lookup is working correctly (0 indx could be ambiguous)
|
625
683
|
test 'restore inline passthroughs with subs' do
|
626
|
-
para = block_from_string("some \x0" + '0' + "\x0 to study")
|
684
|
+
para = block_from_string("some \x0" + '0' + "\x0 to study in the \x0" + '1' + "\x0 programming language")
|
627
685
|
para.passthroughs << {:text => '<code>{code}</code>', :subs => [:specialcharacters]}
|
686
|
+
para.passthroughs << {:text => '{language}', :subs => [:specialcharacters]}
|
628
687
|
result = para.restore_passthroughs(para.buffer.join)
|
629
|
-
assert_equal 'some <code>{code}</code> to study', result
|
688
|
+
assert_equal 'some <code>{code}</code> to study in the {language} programming language', result
|
689
|
+
end
|
690
|
+
|
691
|
+
test 'complex inline passthrough macro' do
|
692
|
+
text_to_escape = %q{[(] <'basic form'> <'logical operator'> <'basic form'> [)]}
|
693
|
+
para = block_from_string %($$#{text_to_escape}$$)
|
694
|
+
result = para.extract_passthroughs(para.buffer.join)
|
695
|
+
assert_equal 1, para.passthroughs.size
|
696
|
+
assert_equal text_to_escape, para.passthroughs[0][:text]
|
697
|
+
|
698
|
+
text_to_escape_escaped = %q{[(\] <'basic form'> <'logical operator'> <'basic form'> [)\]}
|
699
|
+
para = block_from_string %(pass:specialcharacters[#{text_to_escape_escaped}])
|
700
|
+
result = para.extract_passthroughs(para.buffer.join)
|
701
|
+
assert_equal 1, para.passthroughs.size
|
702
|
+
assert_equal text_to_escape, para.passthroughs[0][:text]
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
context 'Replacements' do
|
707
|
+
test 'unescapes XML entities' do
|
708
|
+
para = block_from_string '< " " " >'
|
709
|
+
assert_equal '< " " " >', para.apply_normal_subs(para.buffer)
|
710
|
+
end
|
711
|
+
|
712
|
+
test 'replaces arrows' do
|
713
|
+
para = block_from_string '<- -> <= => \<- \-> \<= \=>'
|
714
|
+
assert_equal '← → ⇐ ⇒ <- -> <= =>', para.apply_normal_subs(para.buffer.join)
|
715
|
+
end
|
716
|
+
|
717
|
+
test 'replaces dashes' do
|
718
|
+
para = block_from_string %(-- foo foo--bar foo\\--bar foo -- bar foo \\-- bar
|
719
|
+
stuff in between
|
720
|
+
-- foo
|
721
|
+
stuff in between
|
722
|
+
foo --
|
723
|
+
stuff in between
|
724
|
+
foo --)
|
725
|
+
expected = %( — foo foo—bar foo--bar foo — bar foo -- bar
|
726
|
+
stuff in between — foo
|
727
|
+
stuff in between
|
728
|
+
foo — stuff in between
|
729
|
+
foo — )
|
730
|
+
assert_equal expected, para.sub_replacements(para.buffer.join)
|
731
|
+
end
|
732
|
+
|
733
|
+
test 'replaces marks' do
|
734
|
+
para = block_from_string '(C) (R) (TM) \(C) \(R) \(TM)'
|
735
|
+
assert_equal '© ® ™ (C) (R) (TM)', para.sub_replacements(para.buffer.join)
|
736
|
+
end
|
737
|
+
|
738
|
+
test 'replaces punctuation' do
|
739
|
+
para = block_from_string %(John's Hideout... foo\\'bar)
|
740
|
+
assert_equal "John’s Hideout… foo'bar", para.sub_replacements(para.buffer.join)
|
630
741
|
end
|
631
742
|
end
|
632
743
|
|
data/test/tables_test.rb
CHANGED
@@ -14,8 +14,8 @@ context 'Tables' do
|
|
14
14
|
cells = [%w(A B C), %w(a b c), %w(1 2 3)]
|
15
15
|
output = render_embedded_string input
|
16
16
|
assert_css 'table', output, 1
|
17
|
-
assert_css 'table.tableblock.frame-all.grid-all[style*="width:
|
18
|
-
assert_css 'table > colgroup > col[style*="width:
|
17
|
+
assert_css 'table.tableblock.frame-all.grid-all[style*="width:100%"]', output, 1
|
18
|
+
assert_css 'table > colgroup > col[style*="width:33%"]', output, 3
|
19
19
|
assert_css 'table tr', output, 3
|
20
20
|
assert_css 'table > tbody > tr', output, 3
|
21
21
|
assert_css 'table td', output, 9
|
@@ -43,6 +43,46 @@ context 'Tables' do
|
|
43
43
|
assert_xpath '/table/caption/following-sibling::colgroup', output, 1
|
44
44
|
end
|
45
45
|
|
46
|
+
test 'only increments table counter for tables that have a title' do
|
47
|
+
input = <<-EOS
|
48
|
+
.First numbered table
|
49
|
+
|=======
|
50
|
+
|1 |2 |3
|
51
|
+
|=======
|
52
|
+
|
53
|
+
|=======
|
54
|
+
|4 |5 |6
|
55
|
+
|=======
|
56
|
+
|
57
|
+
.Second numbered table
|
58
|
+
|=======
|
59
|
+
|7 |8 |9
|
60
|
+
|=======
|
61
|
+
EOS
|
62
|
+
output = render_embedded_string input
|
63
|
+
assert_css 'table:root', output, 3
|
64
|
+
assert_xpath '(/table)[1]/caption', output, 1
|
65
|
+
assert_xpath '(/table)[1]/caption[text()="Table 1. First numbered table"]', output, 1
|
66
|
+
assert_xpath '(/table)[2]/caption', output, 0
|
67
|
+
assert_xpath '(/table)[3]/caption', output, 1
|
68
|
+
assert_xpath '(/table)[3]/caption[text()="Table 2. Second numbered table"]', output, 1
|
69
|
+
end
|
70
|
+
|
71
|
+
test 'renders explicit caption on simple psv table' do
|
72
|
+
input = <<-EOS
|
73
|
+
[caption="All the Data. "]
|
74
|
+
.Simple psv table
|
75
|
+
|=======
|
76
|
+
|A |B |C
|
77
|
+
|a |b |c
|
78
|
+
|1 |2 |3
|
79
|
+
|=======
|
80
|
+
EOS
|
81
|
+
output = render_embedded_string input
|
82
|
+
assert_xpath '/table/caption[@class="title"][text()="All the Data. Simple psv table"]', output, 1
|
83
|
+
assert_xpath '/table/caption/following-sibling::colgroup', output, 1
|
84
|
+
end
|
85
|
+
|
46
86
|
test 'ignores escaped separators' do
|
47
87
|
input = <<-EOS
|
48
88
|
|===
|
@@ -233,13 +273,13 @@ I am getting in shape!
|
|
233
273
|
EOS
|
234
274
|
output = render_embedded_string input
|
235
275
|
assert_css 'table', output, 1
|
236
|
-
assert_css 'table[style*="width:
|
276
|
+
assert_css 'table[style*="width:80%"]', output, 1
|
237
277
|
assert_xpath '/table/caption[@class="title"][text()="Table 1. Horizontal and vertical source data"]', output, 1
|
238
278
|
assert_css 'table > colgroup > col', output, 4
|
239
|
-
assert_css 'table > colgroup > col:nth-child(1)[@style*="width:
|
240
|
-
assert_css 'table > colgroup > col:nth-child(2)[@style*="width:
|
241
|
-
assert_css 'table > colgroup > col:nth-child(3)[@style*="width:
|
242
|
-
assert_css 'table > colgroup > col:nth-child(4)[@style*="width:
|
279
|
+
assert_css 'table > colgroup > col:nth-child(1)[@style*="width:17%"]', output, 1
|
280
|
+
assert_css 'table > colgroup > col:nth-child(2)[@style*="width:11%"]', output, 1
|
281
|
+
assert_css 'table > colgroup > col:nth-child(3)[@style*="width:11%"]', output, 1
|
282
|
+
assert_css 'table > colgroup > col:nth-child(4)[@style*="width:58%"]', output, 1
|
243
283
|
assert_css 'table > thead', output, 1
|
244
284
|
assert_css 'table > thead > tr', output, 1
|
245
285
|
assert_css 'table > thead > tr > th', output, 4
|
@@ -264,7 +304,7 @@ d|9 2+>|10
|
|
264
304
|
EOS
|
265
305
|
output = render_embedded_string input
|
266
306
|
assert_css 'table', output, 1
|
267
|
-
assert_css 'table > colgroup > col[style*="width:
|
307
|
+
assert_css 'table > colgroup > col[style*="width:25%"]', output, 4
|
268
308
|
assert_css 'table > tbody > tr', output, 4
|
269
309
|
assert_css 'table > tbody > tr > td', output, 10
|
270
310
|
assert_css 'table > tbody > tr:nth-child(1) > td', output, 4
|
@@ -279,14 +319,14 @@ d|9 2+>|10
|
|
279
319
|
assert_css 'table tr:nth-child(1) > td:nth-child(4).halign-right.valign-top p strong', output, 1
|
280
320
|
|
281
321
|
assert_css 'table tr:nth-child(2) > td:nth-child(1).halign-center.valign-top p em', output, 1
|
282
|
-
assert_css 'table tr:nth-child(2) > td:nth-child(2).halign-center.valign-middle[colspan="2"][rowspan="2"] p
|
283
|
-
assert_css 'table tr:nth-child(2) > td:nth-child(3).halign-left.valign-bottom[rowspan="3"] p
|
322
|
+
assert_css 'table tr:nth-child(2) > td:nth-child(2).halign-center.valign-middle[colspan="2"][rowspan="2"] p code', output, 1
|
323
|
+
assert_css 'table tr:nth-child(2) > td:nth-child(3).halign-left.valign-bottom[rowspan="3"] p code', output, 1
|
284
324
|
|
285
325
|
assert_css 'table tr:nth-child(3) > td:nth-child(1).halign-center.valign-top p em', output, 1
|
286
326
|
|
287
327
|
assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p', output, 1
|
288
328
|
assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p em', output, 0
|
289
|
-
assert_css 'table tr:nth-child(4) > td:nth-child(2).halign-right.valign-top[colspan="2"] p
|
329
|
+
assert_css 'table tr:nth-child(4) > td:nth-child(2).halign-right.valign-top[colspan="2"] p code', output, 1
|
290
330
|
end
|
291
331
|
|
292
332
|
test 'supports repeating cells' do
|
@@ -452,7 +492,7 @@ nobody:x:99:99:Nobody:/:/sbin/nologin
|
|
452
492
|
EOS
|
453
493
|
output = render_embedded_string input
|
454
494
|
assert_css 'table', output, 1
|
455
|
-
assert_css 'table > colgroup > col[style*="width:
|
495
|
+
assert_css 'table > colgroup > col[style*="width:14%"]', output, 7
|
456
496
|
assert_css 'table > tbody > tr', output, 6
|
457
497
|
assert_xpath '//tr[4]/td[5]/p/text()', output, 0
|
458
498
|
assert_xpath '//tr[3]/td[5]/p[text()="MySQL:Server"]', output, 1
|
@@ -475,7 +515,7 @@ air, moon roof, loaded",4799.00
|
|
475
515
|
EOS
|
476
516
|
output = render_embedded_string input
|
477
517
|
assert_css 'table', output, 1
|
478
|
-
assert_css 'table > colgroup > col[style*="width:
|
518
|
+
assert_css 'table > colgroup > col[style*="width:20%"]', output, 5
|
479
519
|
assert_css 'table > thead > tr', output, 1
|
480
520
|
assert_css 'table > tbody > tr', output, 4
|
481
521
|
assert_xpath '((//tbody/tr)[1]/td)[4]/p[text()="ac, abs, moon"]', output, 1
|
data/test/test_helper.rb
CHANGED
@@ -67,8 +67,8 @@ class Test::Unit::TestCase
|
|
67
67
|
xmlnodes_at_path(:css, css, content)
|
68
68
|
end
|
69
69
|
|
70
|
-
def xmlnodes_at_xpath(
|
71
|
-
xmlnodes_at_path(:xpath,
|
70
|
+
def xmlnodes_at_xpath(xpath, content, count = nil)
|
71
|
+
xmlnodes_at_path(:xpath, xpath, content)
|
72
72
|
end
|
73
73
|
|
74
74
|
def xmlnodes_at_path(type, path, content, count = nil)
|
data/test/text_test.rb
CHANGED
@@ -89,7 +89,7 @@ context "Text" do
|
|
89
89
|
end
|
90
90
|
|
91
91
|
test "backtick-escaped text followed by single-quoted text" do
|
92
|
-
assert_match(/<
|
92
|
+
assert_match(/<code>foo<\/code>/, render_string(%Q(run `foo` 'dog')))
|
93
93
|
end
|
94
94
|
|
95
95
|
context "basic styling" do
|
@@ -106,7 +106,7 @@ context "Text" do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
test "monospaced" do
|
109
|
-
assert_xpath "//
|
109
|
+
assert_xpath "//code", @rendered
|
110
110
|
end
|
111
111
|
|
112
112
|
test "superscript" do
|
@@ -118,21 +118,21 @@ context "Text" do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
test "backticks" do
|
121
|
-
assert_xpath "//
|
121
|
+
assert_xpath "//code", render_string("This is `totally cool`.")
|
122
122
|
end
|
123
123
|
|
124
124
|
test "nested styles" do
|
125
125
|
rendered = render_string("Winning *big _time_* in the +city *boyeeee*+.")
|
126
126
|
|
127
127
|
assert_xpath "//strong/em", rendered
|
128
|
-
assert_xpath "//
|
128
|
+
assert_xpath "//code/strong", rendered
|
129
129
|
end
|
130
130
|
|
131
131
|
test "unconstrained quotes" do
|
132
132
|
rendered_chars = render_string("**B**__I__++M++")
|
133
133
|
assert_xpath "//strong", rendered_chars
|
134
134
|
assert_xpath "//em", rendered_chars
|
135
|
-
assert_xpath "//
|
135
|
+
assert_xpath "//code", rendered_chars
|
136
136
|
end
|
137
137
|
end
|
138
138
|
end
|
metadata
CHANGED
@@ -1,134 +1,119 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ryan Waldron
|
9
8
|
- Dan Allen
|
10
9
|
- Jeremy McAnally
|
10
|
+
- Jason Porter
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-04-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: coderay
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
19
|
requirements:
|
21
|
-
- -
|
20
|
+
- - '>='
|
22
21
|
- !ruby/object:Gem::Version
|
23
22
|
version: '0'
|
24
23
|
type: :development
|
25
24
|
prerelease: false
|
26
25
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
26
|
requirements:
|
29
|
-
- -
|
27
|
+
- - '>='
|
30
28
|
- !ruby/object:Gem::Version
|
31
29
|
version: '0'
|
32
30
|
- !ruby/object:Gem::Dependency
|
33
31
|
name: erubis
|
34
32
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
33
|
requirements:
|
37
|
-
- -
|
34
|
+
- - '>='
|
38
35
|
- !ruby/object:Gem::Version
|
39
36
|
version: '0'
|
40
37
|
type: :development
|
41
38
|
prerelease: false
|
42
39
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
40
|
requirements:
|
45
|
-
- -
|
41
|
+
- - '>='
|
46
42
|
- !ruby/object:Gem::Version
|
47
43
|
version: '0'
|
48
44
|
- !ruby/object:Gem::Dependency
|
49
45
|
name: htmlentities
|
50
46
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
47
|
requirements:
|
53
|
-
- -
|
48
|
+
- - '>='
|
54
49
|
- !ruby/object:Gem::Version
|
55
50
|
version: '0'
|
56
51
|
type: :development
|
57
52
|
prerelease: false
|
58
53
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
54
|
requirements:
|
61
|
-
- -
|
55
|
+
- - '>='
|
62
56
|
- !ruby/object:Gem::Version
|
63
57
|
version: '0'
|
64
58
|
- !ruby/object:Gem::Dependency
|
65
59
|
name: mocha
|
66
60
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
61
|
requirements:
|
69
|
-
- -
|
62
|
+
- - '>='
|
70
63
|
- !ruby/object:Gem::Version
|
71
64
|
version: '0'
|
72
65
|
type: :development
|
73
66
|
prerelease: false
|
74
67
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
68
|
requirements:
|
77
|
-
- -
|
69
|
+
- - '>='
|
78
70
|
- !ruby/object:Gem::Version
|
79
71
|
version: '0'
|
80
72
|
- !ruby/object:Gem::Dependency
|
81
73
|
name: nokogiri
|
82
74
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
75
|
requirements:
|
85
|
-
- -
|
76
|
+
- - '>='
|
86
77
|
- !ruby/object:Gem::Version
|
87
78
|
version: '0'
|
88
79
|
type: :development
|
89
80
|
prerelease: false
|
90
81
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
82
|
requirements:
|
93
|
-
- -
|
83
|
+
- - '>='
|
94
84
|
- !ruby/object:Gem::Version
|
95
85
|
version: '0'
|
96
86
|
- !ruby/object:Gem::Dependency
|
97
87
|
name: pending
|
98
88
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
89
|
requirements:
|
101
|
-
- -
|
90
|
+
- - '>='
|
102
91
|
- !ruby/object:Gem::Version
|
103
92
|
version: '0'
|
104
93
|
type: :development
|
105
94
|
prerelease: false
|
106
95
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
96
|
requirements:
|
109
|
-
- -
|
97
|
+
- - '>='
|
110
98
|
- !ruby/object:Gem::Version
|
111
99
|
version: '0'
|
112
100
|
- !ruby/object:Gem::Dependency
|
113
101
|
name: rake
|
114
102
|
requirement: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
103
|
requirements:
|
117
|
-
- -
|
104
|
+
- - '>='
|
118
105
|
- !ruby/object:Gem::Version
|
119
106
|
version: '0'
|
120
107
|
type: :development
|
121
108
|
prerelease: false
|
122
109
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
110
|
requirements:
|
125
|
-
- -
|
111
|
+
- - '>='
|
126
112
|
- !ruby/object:Gem::Version
|
127
113
|
version: '0'
|
128
114
|
- !ruby/object:Gem::Dependency
|
129
115
|
name: rdoc
|
130
116
|
requirement: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
117
|
requirements:
|
133
118
|
- - ~>
|
134
119
|
- !ruby/object:Gem::Version
|
@@ -136,7 +121,6 @@ dependencies:
|
|
136
121
|
type: :development
|
137
122
|
prerelease: false
|
138
123
|
version_requirements: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
124
|
requirements:
|
141
125
|
- - ~>
|
142
126
|
- !ruby/object:Gem::Version
|
@@ -144,35 +128,38 @@ dependencies:
|
|
144
128
|
- !ruby/object:Gem::Dependency
|
145
129
|
name: tilt
|
146
130
|
requirement: !ruby/object:Gem::Requirement
|
147
|
-
none: false
|
148
131
|
requirements:
|
149
|
-
- -
|
132
|
+
- - '>='
|
150
133
|
- !ruby/object:Gem::Version
|
151
134
|
version: '0'
|
152
135
|
type: :development
|
153
136
|
prerelease: false
|
154
137
|
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
138
|
requirements:
|
157
|
-
- -
|
139
|
+
- - '>='
|
158
140
|
- !ruby/object:Gem::Version
|
159
141
|
version: '0'
|
160
|
-
description:
|
161
|
-
|
162
|
-
|
142
|
+
description: "An open source text processor and publishing toolchain, written entirely
|
143
|
+
in Ruby, for converting AsciiDoc markup into HTML 5, DocBook 4.5 and other formats.
|
144
|
+
\n"
|
145
|
+
email:
|
146
|
+
- rew@erebor.com
|
147
|
+
- dan.j.allen@gmail.com
|
163
148
|
executables:
|
164
149
|
- asciidoctor
|
150
|
+
- asciidoctor-safe
|
165
151
|
extensions: []
|
166
152
|
extra_rdoc_files:
|
167
153
|
- LICENSE
|
168
154
|
files:
|
169
155
|
- Gemfile
|
170
156
|
- LICENSE
|
171
|
-
- README.
|
157
|
+
- README.adoc
|
172
158
|
- Rakefile
|
173
159
|
- asciidoctor.gemspec
|
174
160
|
- bin/asciidoctor
|
175
161
|
- bin/asciidoctor-safe
|
162
|
+
- compat/asciidoc.conf
|
176
163
|
- lib/asciidoctor.rb
|
177
164
|
- lib/asciidoctor/abstract_block.rb
|
178
165
|
- lib/asciidoctor/abstract_node.rb
|
@@ -186,11 +173,11 @@ files:
|
|
186
173
|
- lib/asciidoctor/cli/options.rb
|
187
174
|
- lib/asciidoctor/debug.rb
|
188
175
|
- lib/asciidoctor/document.rb
|
189
|
-
- lib/asciidoctor/errors.rb
|
190
176
|
- lib/asciidoctor/helpers.rb
|
191
177
|
- lib/asciidoctor/inline.rb
|
192
178
|
- lib/asciidoctor/lexer.rb
|
193
179
|
- lib/asciidoctor/list_item.rb
|
180
|
+
- lib/asciidoctor/path_resolver.rb
|
194
181
|
- lib/asciidoctor/reader.rb
|
195
182
|
- lib/asciidoctor/renderer.rb
|
196
183
|
- lib/asciidoctor/section.rb
|
@@ -199,17 +186,24 @@ files:
|
|
199
186
|
- lib/asciidoctor/version.rb
|
200
187
|
- man/asciidoctor.1
|
201
188
|
- man/asciidoctor.ad
|
189
|
+
- stylesheets/asciidoctor.css
|
202
190
|
- test/attributes_test.rb
|
203
191
|
- test/blocks_test.rb
|
204
192
|
- test/document_test.rb
|
205
193
|
- test/fixtures/asciidoc.txt
|
206
194
|
- test/fixtures/asciidoc_index.txt
|
207
195
|
- test/fixtures/ascshort.txt
|
196
|
+
- test/fixtures/basic-docinfo.html
|
197
|
+
- test/fixtures/basic-docinfo.xml
|
198
|
+
- test/fixtures/basic.asciidoc
|
199
|
+
- test/fixtures/docinfo.html
|
200
|
+
- test/fixtures/docinfo.xml
|
208
201
|
- test/fixtures/dot.gif
|
209
202
|
- test/fixtures/encoding.asciidoc
|
210
203
|
- test/fixtures/include-file.asciidoc
|
211
204
|
- test/fixtures/list_elements.asciidoc
|
212
205
|
- test/fixtures/sample.asciidoc
|
206
|
+
- test/fixtures/stylesheets/custom.css
|
213
207
|
- test/fixtures/tip.gif
|
214
208
|
- test/invoker_test.rb
|
215
209
|
- test/lexer_test.rb
|
@@ -217,6 +211,7 @@ files:
|
|
217
211
|
- test/lists_test.rb
|
218
212
|
- test/options_test.rb
|
219
213
|
- test/paragraphs_test.rb
|
214
|
+
- test/paths_test.rb
|
220
215
|
- test/preamble_test.rb
|
221
216
|
- test/reader_test.rb
|
222
217
|
- test/renderer_test.rb
|
@@ -225,31 +220,31 @@ files:
|
|
225
220
|
- test/tables_test.rb
|
226
221
|
- test/test_helper.rb
|
227
222
|
- test/text_test.rb
|
228
|
-
homepage: http://
|
229
|
-
licenses:
|
223
|
+
homepage: http://asciidoctor.org
|
224
|
+
licenses:
|
225
|
+
- MIT
|
226
|
+
metadata: {}
|
230
227
|
post_install_message:
|
231
228
|
rdoc_options:
|
232
229
|
- --charset=UTF-8
|
233
230
|
require_paths:
|
234
231
|
- lib
|
235
232
|
required_ruby_version: !ruby/object:Gem::Requirement
|
236
|
-
none: false
|
237
233
|
requirements:
|
238
|
-
- -
|
234
|
+
- - '>='
|
239
235
|
- !ruby/object:Gem::Version
|
240
236
|
version: '0'
|
241
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
|
-
none: false
|
243
238
|
requirements:
|
244
|
-
- -
|
239
|
+
- - '>='
|
245
240
|
- !ruby/object:Gem::Version
|
246
241
|
version: '0'
|
247
242
|
requirements: []
|
248
243
|
rubyforge_project: asciidoctor
|
249
|
-
rubygems_version:
|
244
|
+
rubygems_version: 2.0.3
|
250
245
|
signing_key:
|
251
246
|
specification_version: 2
|
252
|
-
summary:
|
247
|
+
summary: A native Ruby AsciiDoc syntax processor and publishing toolchain
|
253
248
|
test_files:
|
254
249
|
- test/attributes_test.rb
|
255
250
|
- test/blocks_test.rb
|
@@ -260,6 +255,7 @@ test_files:
|
|
260
255
|
- test/lists_test.rb
|
261
256
|
- test/options_test.rb
|
262
257
|
- test/paragraphs_test.rb
|
258
|
+
- test/paths_test.rb
|
263
259
|
- test/preamble_test.rb
|
264
260
|
- test/reader_test.rb
|
265
261
|
- test/renderer_test.rb
|