asciidoctor 1.5.5 → 1.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +216 -1
- data/CONTRIBUTING.adoc +2 -2
- data/Gemfile +20 -1
- data/LICENSE.adoc +1 -1
- data/README-fr.adoc +4 -3
- data/README-jp.adoc +11 -10
- data/README-zh_CN.adoc +4 -3
- data/README.adoc +17 -202
- data/Rakefile +41 -25
- data/asciidoctor.gemspec +9 -10
- data/data/locale/attributes.adoc +216 -34
- data/data/stylesheets/asciidoctor-default.css +23 -16
- data/features/step_definitions.rb +15 -19
- data/features/xref.feature +584 -20
- data/lib/asciidoctor.rb +292 -278
- data/lib/asciidoctor/abstract_block.rb +155 -94
- data/lib/asciidoctor/abstract_node.rb +108 -94
- data/lib/asciidoctor/attribute_list.rb +30 -22
- data/lib/asciidoctor/block.rb +7 -7
- data/lib/asciidoctor/cli/invoker.rb +47 -34
- data/lib/asciidoctor/cli/options.rb +22 -11
- data/lib/asciidoctor/converter.rb +3 -3
- data/lib/asciidoctor/converter/base.rb +2 -2
- data/lib/asciidoctor/converter/composite.rb +1 -1
- data/lib/asciidoctor/converter/docbook45.rb +2 -2
- data/lib/asciidoctor/converter/docbook5.rb +132 -87
- data/lib/asciidoctor/converter/factory.rb +0 -1
- data/lib/asciidoctor/converter/html5.rb +116 -98
- data/lib/asciidoctor/converter/manpage.rb +51 -52
- data/lib/asciidoctor/converter/template.rb +47 -36
- data/lib/asciidoctor/core_ext.rb +8 -2
- data/lib/asciidoctor/core_ext/1.8.7/hash/key.rb +4 -0
- data/lib/asciidoctor/core_ext/1.8.7/io/binread.rb +6 -0
- data/lib/asciidoctor/core_ext/1.8.7/io/write.rb +5 -0
- data/lib/asciidoctor/core_ext/1.8.7/string/chr.rb +1 -1
- data/lib/asciidoctor/core_ext/1.8.7/string/{limit.rb → limit_bytesize.rb} +7 -6
- data/lib/asciidoctor/core_ext/1.8.7/symbol/empty.rb +6 -0
- data/lib/asciidoctor/core_ext/1.8.7/symbol/length.rb +1 -1
- data/lib/asciidoctor/core_ext/nil_or_empty.rb +5 -5
- data/lib/asciidoctor/core_ext/regexp/is_match.rb +3 -0
- data/lib/asciidoctor/core_ext/string/{limit.rb → limit_bytesize.rb} +2 -2
- data/lib/asciidoctor/document.rb +216 -213
- data/lib/asciidoctor/extensions.rb +318 -185
- data/lib/asciidoctor/helpers.rb +35 -35
- data/lib/asciidoctor/inline.rb +32 -1
- data/lib/asciidoctor/list.rb +22 -6
- data/lib/asciidoctor/parser.rb +1008 -1038
- data/lib/asciidoctor/path_resolver.rb +46 -50
- data/lib/asciidoctor/reader.rb +275 -251
- data/lib/asciidoctor/section.rb +86 -58
- data/lib/asciidoctor/stylesheets.rb +6 -6
- data/lib/asciidoctor/substitutors.rb +567 -649
- data/lib/asciidoctor/table.rb +163 -108
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +18 -16
- data/man/asciidoctor.adoc +15 -13
- data/test/attributes_test.rb +138 -22
- data/test/blocks_test.rb +377 -97
- data/test/converter_test.rb +13 -0
- data/test/document_test.rb +244 -34
- data/test/extensions_test.rb +409 -42
- data/test/fixtures/asciidoc_index.txt +521 -0
- data/test/fixtures/basic-docinfo-footer.html +6 -0
- data/test/fixtures/basic-docinfo-footer.xml +8 -0
- data/test/fixtures/basic-docinfo.html +1 -0
- data/test/fixtures/basic-docinfo.xml +4 -0
- data/test/fixtures/basic.asciidoc +5 -0
- data/test/fixtures/chapter-a.adoc +3 -0
- data/test/fixtures/child-include.adoc +5 -0
- data/test/fixtures/circle.svg +9 -0
- data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +6 -0
- data/test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml +6 -0
- data/test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml +1 -0
- data/test/fixtures/custom-backends/haml/html5/block_paragraph.html.haml +3 -0
- data/test/fixtures/custom-backends/haml/html5/block_sidebar.html.haml +5 -0
- data/test/fixtures/custom-backends/slim/docbook45/block_paragraph.xml.slim +6 -0
- data/test/fixtures/custom-backends/slim/html5/block_paragraph.html.slim +3 -0
- data/test/fixtures/custom-backends/slim/html5/block_sidebar.html.slim +5 -0
- data/test/fixtures/custom-docinfodir/basic-docinfo.html +1 -0
- data/test/fixtures/custom-docinfodir/docinfo.html +1 -0
- data/test/fixtures/docinfo-footer.html +1 -0
- data/test/fixtures/docinfo-footer.xml +9 -0
- data/test/fixtures/docinfo.html +1 -0
- data/test/fixtures/docinfo.xml +3 -0
- data/test/fixtures/dot.gif +0 -0
- data/test/fixtures/encoding.asciidoc +13 -0
- data/test/fixtures/grandchild-include.adoc +3 -0
- data/test/fixtures/hello-asciidoctor.pdf +69 -0
- data/test/fixtures/include-file.asciidoc +24 -0
- data/test/fixtures/include-file.ml +3 -0
- data/test/fixtures/include-file.xml +5 -0
- data/test/fixtures/master.adoc +5 -0
- data/test/fixtures/mismatched-end-tag.adoc +7 -0
- data/test/fixtures/parent-include-restricted.adoc +5 -0
- data/test/fixtures/parent-include.adoc +5 -0
- data/test/fixtures/sample.asciidoc +26 -0
- data/test/fixtures/stylesheets/custom.css +3 -0
- data/test/fixtures/subs-docinfo.html +2 -0
- data/test/fixtures/subs.adoc +7 -0
- data/test/fixtures/tagged-class-enclosed.rb +26 -0
- data/test/fixtures/tagged-class.rb +23 -0
- data/test/fixtures/tip.gif +0 -0
- data/test/invoker_test.rb +82 -4
- data/test/links_test.rb +312 -37
- data/test/lists_test.rb +204 -25
- data/test/manpage_test.rb +191 -4
- data/test/options_test.rb +18 -1
- data/test/paragraphs_test.rb +32 -7
- data/test/parser_test.rb +150 -30
- data/test/paths_test.rb +47 -13
- data/test/preamble_test.rb +1 -1
- data/test/reader_test.rb +366 -126
- data/test/sections_test.rb +203 -56
- data/test/substitutions_test.rb +339 -131
- data/test/tables_test.rb +315 -15
- data/test/test_helper.rb +400 -0
- data/test/text_test.rb +5 -5
- metadata +110 -22
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            <script src="modernizr.js"></script>
         | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            <?xml version="1.0"?>
         | 
| 2 | 
            +
            <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
         | 
| 3 | 
            +
            <!-- An SVG of a black circle -->
         | 
| 4 | 
            +
            <svg
         | 
| 5 | 
            +
            viewBox="0 0 120 120" version="1.1"
         | 
| 6 | 
            +
            xmlns="http://www.w3.org/2000/svg" style="width:500px;height:500px"
         | 
| 7 | 
            +
            width="500px" height="500px">
         | 
| 8 | 
            +
              <circle cx="60" cy="60" r="50"/>
         | 
| 9 | 
            +
            </svg>
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            %p=content
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            <script src="bootstrap.js"></script>
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            <meta name="robots" content="index,follow">
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            <a id="top" href="#">Back to top</a>
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            <meta http-equiv="imagetoolbar" content="false">
         | 
| Binary file | 
| @@ -0,0 +1,13 @@ | |
| 1 | 
            +
            Gregory Romé has written an AsciiDoc plugin for the Redmine project management application.
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            https://github.com/foo-users/foo
         | 
| 4 | 
            +
            へと `vicmd` キーマップを足してみている試み、
         | 
| 5 | 
            +
            アニメーションgifです。
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            tag::romé[]
         | 
| 8 | 
            +
            Gregory Romé has written an AsciiDoc plugin for the Redmine project management application.
         | 
| 9 | 
            +
            end::romé[]
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            == Überschrift
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            * Codierungen sind verrückt auf älteren Versionen von Ruby
         | 
| @@ -0,0 +1,69 @@ | |
| 1 | 
            +
            %PDF-1.3
         | 
| 2 | 
            +
            %����
         | 
| 3 | 
            +
            1 0 obj
         | 
| 4 | 
            +
            << /Creator <feff0050007200610077006e>
         | 
| 5 | 
            +
            /Producer <feff0050007200610077006e>
         | 
| 6 | 
            +
            >>
         | 
| 7 | 
            +
            endobj
         | 
| 8 | 
            +
            2 0 obj
         | 
| 9 | 
            +
            << /Type /Catalog
         | 
| 10 | 
            +
            /Pages 3 0 R
         | 
| 11 | 
            +
            >>
         | 
| 12 | 
            +
            endobj
         | 
| 13 | 
            +
            3 0 obj
         | 
| 14 | 
            +
            << /Type /Pages
         | 
| 15 | 
            +
            /Count 1
         | 
| 16 | 
            +
            /Kids [5 0 R]
         | 
| 17 | 
            +
            >>
         | 
| 18 | 
            +
            endobj
         | 
| 19 | 
            +
            4 0 obj
         | 
| 20 | 
            +
            << /Length 92
         | 
| 21 | 
            +
            >>
         | 
| 22 | 
            +
            stream
         | 
| 23 | 
            +
            q
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            BT
         | 
| 26 | 
            +
            36.0 747.384 Td
         | 
| 27 | 
            +
            /F1.0 12 Tf
         | 
| 28 | 
            +
            [<48656c6c6f> 40 <2c204173636969646f63746f7221>] TJ
         | 
| 29 | 
            +
            ET
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            Q
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            endstream
         | 
| 34 | 
            +
            endobj
         | 
| 35 | 
            +
            5 0 obj
         | 
| 36 | 
            +
            << /Type /Page
         | 
| 37 | 
            +
            /Parent 3 0 R
         | 
| 38 | 
            +
            /MediaBox [0 0 612.0 792.0]
         | 
| 39 | 
            +
            /Contents 4 0 R
         | 
| 40 | 
            +
            /Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
         | 
| 41 | 
            +
            /Font << /F1.0 6 0 R
         | 
| 42 | 
            +
            >>
         | 
| 43 | 
            +
            >>
         | 
| 44 | 
            +
            >>
         | 
| 45 | 
            +
            endobj
         | 
| 46 | 
            +
            6 0 obj
         | 
| 47 | 
            +
            << /Type /Font
         | 
| 48 | 
            +
            /Subtype /Type1
         | 
| 49 | 
            +
            /BaseFont /Helvetica
         | 
| 50 | 
            +
            /Encoding /WinAnsiEncoding
         | 
| 51 | 
            +
            >>
         | 
| 52 | 
            +
            endobj
         | 
| 53 | 
            +
            xref
         | 
| 54 | 
            +
            0 7
         | 
| 55 | 
            +
            0000000000 65535 f 
         | 
| 56 | 
            +
            0000000015 00000 n 
         | 
| 57 | 
            +
            0000000109 00000 n 
         | 
| 58 | 
            +
            0000000158 00000 n 
         | 
| 59 | 
            +
            0000000215 00000 n 
         | 
| 60 | 
            +
            0000000357 00000 n 
         | 
| 61 | 
            +
            0000000535 00000 n 
         | 
| 62 | 
            +
            trailer
         | 
| 63 | 
            +
            << /Size 7
         | 
| 64 | 
            +
            /Root 2 0 R
         | 
| 65 | 
            +
            /Info 1 0 R
         | 
| 66 | 
            +
            >>
         | 
| 67 | 
            +
            startxref
         | 
| 68 | 
            +
            632
         | 
| 69 | 
            +
            %%EOF
         | 
| @@ -0,0 +1,24 @@ | |
| 1 | 
            +
            first line of included content
         | 
| 2 | 
            +
            second line of included content
         | 
| 3 | 
            +
            third line of included content
         | 
| 4 | 
            +
            fourth line of included content
         | 
| 5 | 
            +
            fifth line of included content
         | 
| 6 | 
            +
            sixth line of included content
         | 
| 7 | 
            +
            seventh line of included content
         | 
| 8 | 
            +
            eighth line of included content
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            // tag::snippet[]
         | 
| 11 | 
            +
            // tag::snippetA[]
         | 
| 12 | 
            +
            snippetA content
         | 
| 13 | 
            +
            // end::snippetA[]
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            non-tagged content
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            // tag::snippetB[]
         | 
| 18 | 
            +
            snippetB content
         | 
| 19 | 
            +
            // end::snippetB[]
         | 
| 20 | 
            +
            // end::snippet[]
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            more non-tagged content
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            last line of included content
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            Document Title
         | 
| 2 | 
            +
            ==============
         | 
| 3 | 
            +
            Doc Writer <thedoc@asciidoctor.org>
         | 
| 4 | 
            +
            :idprefix: id_
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Preamble paragraph.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            NOTE: This is test, only a test.
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            == Section A
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            *Section A* paragraph.
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            === Section A Subsection
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            *Section A* 'subsection' paragraph.
         | 
| 17 | 
            +
             | 
| 18 | 
            +
            == Section B
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            *Section B* paragraph.
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            .Section B list
         | 
| 23 | 
            +
            * Item 1
         | 
| 24 | 
            +
            * Item 2
         | 
| 25 | 
            +
            * Item 3
         | 
| 26 | 
            +
             | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            #tag::all[]
         | 
| 2 | 
            +
            class Dog
         | 
| 3 | 
            +
              #tag::init[]
         | 
| 4 | 
            +
              def initialize breed
         | 
| 5 | 
            +
                @breed = breed
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
              #end::init[]
         | 
| 8 | 
            +
              #tag::bark[]
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              def bark
         | 
| 11 | 
            +
                #tag::bark-beagle[]
         | 
| 12 | 
            +
                if @breed == 'beagle'
         | 
| 13 | 
            +
                  'woof woof woof woof woof'
         | 
| 14 | 
            +
                #end::bark-beagle[]
         | 
| 15 | 
            +
                #tag::bark-other[]
         | 
| 16 | 
            +
                else
         | 
| 17 | 
            +
                  'woof woof'
         | 
| 18 | 
            +
                #end::bark-other[]
         | 
| 19 | 
            +
                #tag::bark-all[]
         | 
| 20 | 
            +
                #tag::bark-all[]
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
                #end::bark-all[]
         | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
              #end::bark[]
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
            #end::all[]
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            class Dog
         | 
| 2 | 
            +
              #tag::init[]
         | 
| 3 | 
            +
              def initialize breed
         | 
| 4 | 
            +
                @breed = breed
         | 
| 5 | 
            +
              end
         | 
| 6 | 
            +
              #end::init[]
         | 
| 7 | 
            +
              #tag::bark[]
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              def bark
         | 
| 10 | 
            +
                #tag::bark-beagle[]
         | 
| 11 | 
            +
                if @breed == 'beagle'
         | 
| 12 | 
            +
                  'woof woof woof woof woof'
         | 
| 13 | 
            +
                #end::bark-beagle[]
         | 
| 14 | 
            +
                #tag::bark-other[]
         | 
| 15 | 
            +
                else
         | 
| 16 | 
            +
                  'woof woof'
         | 
| 17 | 
            +
                #end::bark-other[]
         | 
| 18 | 
            +
                #tag::bark-all[]
         | 
| 19 | 
            +
                end
         | 
| 20 | 
            +
                #end::bark-all[]
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
              #end::bark[]
         | 
| 23 | 
            +
            end
         | 
| Binary file | 
    
        data/test/invoker_test.rb
    CHANGED
    
    | @@ -41,6 +41,7 @@ context 'Invoker' do | |
| 41 41 | 
             
                assert_equal sample_filepath, doc.attr('docfile')
         | 
| 42 42 | 
             
                assert_equal sample_filedir, doc.attr('docdir')
         | 
| 43 43 | 
             
                assert doc.attr?('docdate')
         | 
| 44 | 
            +
                assert doc.attr?('docyear')
         | 
| 44 45 | 
             
                assert doc.attr?('doctime')
         | 
| 45 46 | 
             
                assert doc.attr?('docdatetime')
         | 
| 46 47 | 
             
                assert invoker.read_output.empty?
         | 
| @@ -51,6 +52,7 @@ context 'Invoker' do | |
| 51 52 | 
             
                invoker = invoke_cli_to_buffer %w(-o /dev/null -a docdate=2015-01-01 -a doctime=10:00:00-07:00), sample_filepath
         | 
| 52 53 | 
             
                doc = invoker.document
         | 
| 53 54 | 
             
                assert doc.attr?('docdate', '2015-01-01')
         | 
| 55 | 
            +
                assert doc.attr?('docyear', '2015')
         | 
| 54 56 | 
             
                assert doc.attr?('doctime', '10:00:00-07:00')
         | 
| 55 57 | 
             
                assert doc.attr?('docdatetime', '2015-01-01 10:00:00-07:00')
         | 
| 56 58 | 
             
              end
         | 
| @@ -62,6 +64,7 @@ context 'Invoker' do | |
| 62 64 | 
             
                assert !doc.attr?('docfile')
         | 
| 63 65 | 
             
                assert_equal Dir.pwd, doc.attr('docdir')
         | 
| 64 66 | 
             
                assert_equal doc.attr('docdate'), doc.attr('localdate')
         | 
| 67 | 
            +
                assert_equal doc.attr('docyear'), doc.attr('localyear')
         | 
| 65 68 | 
             
                assert_equal doc.attr('doctime'), doc.attr('localtime')
         | 
| 66 69 | 
             
                assert_equal doc.attr('docdatetime'), doc.attr('localdatetime')
         | 
| 67 70 | 
             
                assert !doc.attr?('outfile')
         | 
| @@ -91,6 +94,7 @@ context 'Invoker' do | |
| 91 94 | 
             
                  assert !doc.attr?('docfile')
         | 
| 92 95 | 
             
                  assert_equal Dir.pwd, doc.attr('docdir')
         | 
| 93 96 | 
             
                  assert_equal doc.attr('docdate'), doc.attr('localdate')
         | 
| 97 | 
            +
                  assert_equal doc.attr('docyear'), doc.attr('localyear')
         | 
| 94 98 | 
             
                  assert_equal doc.attr('doctime'), doc.attr('localtime')
         | 
| 95 99 | 
             
                  assert_equal doc.attr('docdatetime'), doc.attr('localdatetime')
         | 
| 96 100 | 
             
                  assert doc.attr?('outfile')
         | 
| @@ -101,6 +105,33 @@ context 'Invoker' do | |
| 101 105 | 
             
                end
         | 
| 102 106 | 
             
              end
         | 
| 103 107 |  | 
| 108 | 
            +
              test 'should fail if input file matches resolved output file' do
         | 
| 109 | 
            +
                invoker = invoke_cli_to_buffer %W(-a outfilesuffix=.asciidoc), 'sample.asciidoc'
         | 
| 110 | 
            +
                assert_match(/input file and output file cannot be the same/, invoker.read_error)
         | 
| 111 | 
            +
              end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
              test 'should fail if input file matches specified output file' do
         | 
| 114 | 
            +
                sample_outpath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'sample.asciidoc'))
         | 
| 115 | 
            +
                invoker = invoke_cli_to_buffer %W(-o #{sample_outpath}), 'sample.asciidoc'
         | 
| 116 | 
            +
                assert_match(/input file and output file cannot be the same/, invoker.read_error)
         | 
| 117 | 
            +
              end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
              test 'should accept input from named pipe and output to stdout' do
         | 
| 120 | 
            +
                sample_inpath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'sample-pipe.adoc'))
         | 
| 121 | 
            +
                begin
         | 
| 122 | 
            +
                  %x(mkfifo #{sample_inpath})
         | 
| 123 | 
            +
                  write_thread = Thread.new do
         | 
| 124 | 
            +
                    IO.write sample_inpath, 'pipe content'
         | 
| 125 | 
            +
                  end
         | 
| 126 | 
            +
                  invoker = invoke_cli_to_buffer %w(-a stylesheet!), sample_inpath
         | 
| 127 | 
            +
                  result = invoker.read_output
         | 
| 128 | 
            +
                  assert_match(/pipe content/, result)
         | 
| 129 | 
            +
                  write_thread.join
         | 
| 130 | 
            +
                ensure
         | 
| 131 | 
            +
                  FileUtils.rm_f sample_inpath
         | 
| 132 | 
            +
                end
         | 
| 133 | 
            +
              end if RUBY_MIN_VERSION_1_9 && !windows?
         | 
| 134 | 
            +
             | 
| 104 135 | 
             
              test 'should allow docdir to be specified when input is a string' do
         | 
| 105 136 | 
             
                expected_docdir = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
         | 
| 106 137 | 
             
                invoker = invoke_cli_to_buffer(%w(-s --base-dir test/fixtures -o /dev/null), '-') { 'content' }
         | 
| @@ -178,7 +209,7 @@ context 'Invoker' do | |
| 178 209 | 
             
                  doc = invoker.document
         | 
| 179 210 | 
             
                  assert_equal sample_outpath, doc.attr('outfile')
         | 
| 180 211 | 
             
                  assert File.exist?(sample_outpath)
         | 
| 181 | 
            -
                  output =  | 
| 212 | 
            +
                  output = IO.read(sample_outpath)
         | 
| 182 213 | 
             
                  assert !output.empty?
         | 
| 183 214 | 
             
                  assert_xpath '/html', output, 1
         | 
| 184 215 | 
             
                  assert_xpath '/html/head', output, 1
         | 
| @@ -342,9 +373,9 @@ context 'Invoker' do | |
| 342 373 |  | 
| 343 374 | 
             
              test 'should render all files that matches an absolute path glob expression' do
         | 
| 344 375 | 
             
                basic_outpath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'basic.html'))
         | 
| 345 | 
            -
                glob = File.join(File.dirname(__FILE__), 'fixtures', 'ba*.asciidoc')
         | 
| 376 | 
            +
                glob = File.join(File.expand_path(File.dirname(__FILE__)), 'fixtures', 'ba*.asciidoc')
         | 
| 346 377 | 
             
                # test Windows using backslash-style pathname
         | 
| 347 | 
            -
                if  | 
| 378 | 
            +
                if File::ALT_SEPARATOR == '\\'
         | 
| 348 379 | 
             
                  glob = glob.tr '/', '\\'
         | 
| 349 380 | 
             
                end
         | 
| 350 381 |  | 
| @@ -409,6 +440,32 @@ context 'Invoker' do | |
| 409 440 | 
             
                assert_xpath '/html/body[@class="book"]', output, 1
         | 
| 410 441 | 
             
              end
         | 
| 411 442 |  | 
| 443 | 
            +
              test 'should warn if doctype is inline and the first block is not a candidate for inline conversion' do
         | 
| 444 | 
            +
                ['== Section Title', 'image::tiger.png[]'].each do |input|
         | 
| 445 | 
            +
                  warnings = redirect_streams do |out, err|
         | 
| 446 | 
            +
                    invoke_cli_to_buffer(%w(-d inline), '-') { input }
         | 
| 447 | 
            +
                    err.string
         | 
| 448 | 
            +
                  end
         | 
| 449 | 
            +
                  assert_match(/WARNING: no inline candidate/, warnings)
         | 
| 450 | 
            +
                end
         | 
| 451 | 
            +
              end
         | 
| 452 | 
            +
             | 
| 453 | 
            +
              test 'should not warn if doctype is inline and the document has no blocks' do
         | 
| 454 | 
            +
                warnings = redirect_streams do |out, err|
         | 
| 455 | 
            +
                  invoke_cli_to_buffer(%w(-d inline), '-') { '// comment' }
         | 
| 456 | 
            +
                  err.string
         | 
| 457 | 
            +
                end
         | 
| 458 | 
            +
                refute_match(/WARNING/, warnings)
         | 
| 459 | 
            +
              end
         | 
| 460 | 
            +
             | 
| 461 | 
            +
              test 'should not warn if doctype is inline and the document contains multiple blocks' do
         | 
| 462 | 
            +
                warnings = redirect_streams do |out, err|
         | 
| 463 | 
            +
                  invoke_cli_to_buffer(%w(-d inline), '-') { %(paragraph one\n\nparagraph two\n\nparagraph three) }
         | 
| 464 | 
            +
                  err.string
         | 
| 465 | 
            +
                end
         | 
| 466 | 
            +
                refute_match(/WARNING/, warnings)
         | 
| 467 | 
            +
              end
         | 
| 468 | 
            +
             | 
| 412 469 | 
             
              test 'should locate custom templates based on template dir, template engine and backend' do
         | 
| 413 470 | 
             
                custom_backend_root = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'custom-backends'))
         | 
| 414 471 | 
             
                invoker = invoke_cli_to_buffer %W(-E haml -T #{custom_backend_root} -o -)
         | 
| @@ -558,11 +615,32 @@ context 'Invoker' do | |
| 558 615 | 
             
                  invoker = invoke_cli_to_buffer %w(-o /dev/null), sample_filepath
         | 
| 559 616 | 
             
                  doc = invoker.document
         | 
| 560 617 | 
             
                  assert_equal '2009-02-08', (doc.attr 'docdate')
         | 
| 618 | 
            +
                  assert_equal '2009', (doc.attr 'docyear')
         | 
| 561 619 | 
             
                  assert_match(/2009-02-08 20:03:32 (GMT|UTC)/, (doc.attr 'docdatetime'))
         | 
| 562 620 | 
             
                  assert_equal '2009-02-08', (doc.attr 'localdate')
         | 
| 621 | 
            +
                  assert_equal '2009', (doc.attr 'localyear')
         | 
| 563 622 | 
             
                  assert_match(/2009-02-08 20:03:32 (GMT|UTC)/, (doc.attr 'localdatetime'))
         | 
| 564 623 | 
             
                ensure
         | 
| 565 | 
            -
                   | 
| 624 | 
            +
                  if old_source_date_epoch
         | 
| 625 | 
            +
                    ENV['SOURCE_DATE_EPOCH'] = old_source_date_epoch
         | 
| 626 | 
            +
                  else
         | 
| 627 | 
            +
                    ENV.delete 'SOURCE_DATE_EPOCH'
         | 
| 628 | 
            +
                  end
         | 
| 629 | 
            +
                end
         | 
| 630 | 
            +
              end
         | 
| 631 | 
            +
             | 
| 632 | 
            +
              test 'should fail if SOURCE_DATE_EPOCH is malformed' do
         | 
| 633 | 
            +
                old_source_date_epoch = ENV.delete 'SOURCE_DATE_EPOCH'
         | 
| 634 | 
            +
                begin
         | 
| 635 | 
            +
                  ENV['SOURCE_DATE_EPOCH'] = 'aaaaaaaa'
         | 
| 636 | 
            +
                  sample_filepath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'sample.asciidoc'))
         | 
| 637 | 
            +
                  assert_equal 1, (invoke_cli_to_buffer %w(-o /dev/null), sample_filepath).code
         | 
| 638 | 
            +
                ensure
         | 
| 639 | 
            +
                  if old_source_date_epoch
         | 
| 640 | 
            +
                    ENV['SOURCE_DATE_EPOCH'] = old_source_date_epoch
         | 
| 641 | 
            +
                  else
         | 
| 642 | 
            +
                    ENV.delete 'SOURCE_DATE_EPOCH'
         | 
| 643 | 
            +
                  end
         | 
| 566 644 | 
             
                end
         | 
| 567 645 | 
             
              end
         | 
| 568 646 | 
             
            end
         |