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
    
        data/test/tables_test.rb
    CHANGED
    
    | @@ -152,7 +152,7 @@ context 'Tables' do | |
| 152 152 | 
             
            A | here| a | there
         | 
| 153 153 | 
             
            |===
         | 
| 154 154 | 
             
                  EOS
         | 
| 155 | 
            -
                  output = render_embedded_string input
         | 
| 155 | 
            +
                  output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
         | 
| 156 156 | 
             
                  assert_css 'table', output, 1
         | 
| 157 157 | 
             
                  assert_css 'table > colgroup > col', output, 4
         | 
| 158 158 | 
             
                  assert_css 'table > tbody > tr', output, 1
         | 
| @@ -161,6 +161,7 @@ A | here| a | there | |
| 161 161 | 
             
                  assert_xpath '/table/tbody/tr/td[2]/p[text()="here"]', output, 1
         | 
| 162 162 | 
             
                  assert_xpath '/table/tbody/tr/td[3]/p[text()="a"]', output, 1
         | 
| 163 163 | 
             
                  assert_xpath '/table/tbody/tr/td[4]/p[text()="there"]', output, 1
         | 
| 164 | 
            +
                  assert_includes warnings, 'table missing leading separator'
         | 
| 164 165 | 
             
                end
         | 
| 165 166 |  | 
| 166 167 | 
             
                test 'performs normal substitutions on cell content' do
         | 
| @@ -172,7 +173,55 @@ A | here| a | there | |
| 172 173 | 
             
                  EOS
         | 
| 173 174 | 
             
                  output = render_embedded_string input
         | 
| 174 175 | 
             
                  assert_xpath '//tbody/tr/td[1]/p[text()="Cool new show"]', output, 1
         | 
| 175 | 
            -
                  assert_xpath %(//tbody/tr/td[2]/p[text()='Coming soon#{ | 
| 176 | 
            +
                  assert_xpath %(//tbody/tr/td[2]/p[text()='Coming soon#{decode_char 8230}#{decode_char 8203}']), output, 1
         | 
| 177 | 
            +
                end
         | 
| 178 | 
            +
             | 
| 179 | 
            +
                test 'should only substitute specialchars for literal table cells' do
         | 
| 180 | 
            +
                  input = <<-EOS
         | 
| 181 | 
            +
            |===
         | 
| 182 | 
            +
            l|one
         | 
| 183 | 
            +
            *two*
         | 
| 184 | 
            +
            three
         | 
| 185 | 
            +
            <four>
         | 
| 186 | 
            +
            |===
         | 
| 187 | 
            +
                  EOS
         | 
| 188 | 
            +
                  output = render_embedded_string input
         | 
| 189 | 
            +
                  result = xmlnodes_at_xpath('/table//pre', output, 1)
         | 
| 190 | 
            +
                  assert_equal %(<pre>one\n*two*\nthree\n<four></pre>), result.to_s
         | 
| 191 | 
            +
                end
         | 
| 192 | 
            +
             | 
| 193 | 
            +
                test 'should preserving leading spaces but not leading endlines or trailing spaces in literal table cells' do
         | 
| 194 | 
            +
                  input = <<-EOS
         | 
| 195 | 
            +
            [cols=2*]
         | 
| 196 | 
            +
            |===
         | 
| 197 | 
            +
            l|
         | 
| 198 | 
            +
              one
         | 
| 199 | 
            +
              two
         | 
| 200 | 
            +
            three
         | 
| 201 | 
            +
             | 
| 202 | 
            +
              | normal
         | 
| 203 | 
            +
            |===
         | 
| 204 | 
            +
                  EOS
         | 
| 205 | 
            +
                  output = render_embedded_string input
         | 
| 206 | 
            +
                  result = xmlnodes_at_xpath('/table//pre', output, 1)
         | 
| 207 | 
            +
                  assert_equal %(<pre>  one\n  two\nthree</pre>), result.to_s
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                test 'should preserving leading spaces but not leading endlines or trailing spaces in verse table cells' do
         | 
| 211 | 
            +
                  input = <<-EOS
         | 
| 212 | 
            +
            [cols=2*]
         | 
| 213 | 
            +
            |===
         | 
| 214 | 
            +
            v|
         | 
| 215 | 
            +
              one
         | 
| 216 | 
            +
              two
         | 
| 217 | 
            +
            three
         | 
| 218 | 
            +
             | 
| 219 | 
            +
              | normal
         | 
| 220 | 
            +
            |===
         | 
| 221 | 
            +
                  EOS
         | 
| 222 | 
            +
                  output = render_embedded_string input
         | 
| 223 | 
            +
                  result = xmlnodes_at_xpath('/table//div[@class="verse"]', output, 1)
         | 
| 224 | 
            +
                  assert_equal %(<div class="verse">  one\n  two\nthree</div>), result.to_s
         | 
| 176 225 | 
             
                end
         | 
| 177 226 |  | 
| 178 227 | 
             
                test 'table and col width not assigned when autowidth option is specified' do
         | 
| @@ -415,6 +464,22 @@ A | here| a | there | |
| 415 464 | 
             
                  assert_css 'table > tbody > tr', output, 2
         | 
| 416 465 | 
             
                end
         | 
| 417 466 |  | 
| 467 | 
            +
                test 'table with implicit header row only' do
         | 
| 468 | 
            +
                  input = <<-EOS
         | 
| 469 | 
            +
            |===
         | 
| 470 | 
            +
            |Column 1 |Column 2
         | 
| 471 | 
            +
             | 
| 472 | 
            +
            |===
         | 
| 473 | 
            +
                  EOS
         | 
| 474 | 
            +
                  output = render_embedded_string input
         | 
| 475 | 
            +
                  assert_css 'table', output, 1
         | 
| 476 | 
            +
                  assert_css 'table > colgroup > col', output, 2
         | 
| 477 | 
            +
                  assert_css 'table > thead', output, 1
         | 
| 478 | 
            +
                  assert_css 'table > thead > tr', output, 1
         | 
| 479 | 
            +
                  assert_css 'table > thead > tr > th', output, 2
         | 
| 480 | 
            +
                  assert_css 'table > tbody', output, 0
         | 
| 481 | 
            +
                end
         | 
| 482 | 
            +
             | 
| 418 483 | 
             
                test 'table with implicit header row when other options set' do
         | 
| 419 484 | 
             
                  input = <<-EOS
         | 
| 420 485 | 
             
            [%autowidth]
         | 
| @@ -455,6 +520,53 @@ A | here| a | there | |
| 455 520 | 
             
                  assert_css 'table > tbody > tr', output, 3
         | 
| 456 521 | 
             
                end
         | 
| 457 522 |  | 
| 523 | 
            +
                test 'no implicit header row if cell in first line spans multiple lines' do
         | 
| 524 | 
            +
                  input = <<-EOS
         | 
| 525 | 
            +
            [cols=2*]
         | 
| 526 | 
            +
            |===
         | 
| 527 | 
            +
            |A1
         | 
| 528 | 
            +
             | 
| 529 | 
            +
             | 
| 530 | 
            +
            A1 continued|B1
         | 
| 531 | 
            +
             | 
| 532 | 
            +
            |A2
         | 
| 533 | 
            +
            |B2
         | 
| 534 | 
            +
            |===
         | 
| 535 | 
            +
                  EOS
         | 
| 536 | 
            +
                  output = render_embedded_string input
         | 
| 537 | 
            +
                  assert_css 'table', output, 1
         | 
| 538 | 
            +
                  assert_css 'table > colgroup > col', output, 2
         | 
| 539 | 
            +
                  assert_css 'table > thead', output, 0
         | 
| 540 | 
            +
                  assert_css 'table > tbody', output, 1
         | 
| 541 | 
            +
                  assert_css 'table > tbody > tr', output, 2
         | 
| 542 | 
            +
                  assert_xpath '(//td)[1]/p', output, 2
         | 
| 543 | 
            +
                end
         | 
| 544 | 
            +
             | 
| 545 | 
            +
                test 'no implicit header row if AsciiDoc cell in first line spans multiple lines' do
         | 
| 546 | 
            +
                  input = <<-EOS
         | 
| 547 | 
            +
            [cols=2*]
         | 
| 548 | 
            +
            |===
         | 
| 549 | 
            +
            a|contains AsciiDoc content
         | 
| 550 | 
            +
             | 
| 551 | 
            +
            * a
         | 
| 552 | 
            +
            * b
         | 
| 553 | 
            +
            * c
         | 
| 554 | 
            +
            a|contains no AsciiDoc content
         | 
| 555 | 
            +
             | 
| 556 | 
            +
            just text
         | 
| 557 | 
            +
            |A2
         | 
| 558 | 
            +
            |B2
         | 
| 559 | 
            +
            |===
         | 
| 560 | 
            +
                  EOS
         | 
| 561 | 
            +
                  output = render_embedded_string input
         | 
| 562 | 
            +
                  assert_css 'table', output, 1
         | 
| 563 | 
            +
                  assert_css 'table > colgroup > col', output, 2
         | 
| 564 | 
            +
                  assert_css 'table > thead', output, 0
         | 
| 565 | 
            +
                  assert_css 'table > tbody', output, 1
         | 
| 566 | 
            +
                  assert_css 'table > tbody > tr', output, 2
         | 
| 567 | 
            +
                  assert_xpath '(//td)[1]//ul', output, 1
         | 
| 568 | 
            +
                end
         | 
| 569 | 
            +
             | 
| 458 570 | 
             
                test 'no implicit header row if first line blank' do
         | 
| 459 571 | 
             
                  input = <<-EOS
         | 
| 460 572 | 
             
            |===
         | 
| @@ -503,7 +615,7 @@ A | here| a | there | |
| 503 615 | 
             
            [cols="1h,1s,1e",options="header,footer"]
         | 
| 504 616 | 
             
            |====
         | 
| 505 617 | 
             
            |Name |Occupation| Website
         | 
| 506 | 
            -
            |Octocat |Social coding|  | 
| 618 | 
            +
            |Octocat |Social coding| https://github.com
         | 
| 507 619 | 
             
            |Name |Occupation| Website
         | 
| 508 620 | 
             
            |====
         | 
| 509 621 | 
             
                  EOS
         | 
| @@ -531,7 +643,7 @@ A | here| a | there | |
| 531 643 |  | 
| 532 644 | 
             
            |Name |Occupation| Website
         | 
| 533 645 |  | 
| 534 | 
            -
            |Octocat |Social coding|  | 
| 646 | 
            +
            |Octocat |Social coding| https://github.com
         | 
| 535 647 |  | 
| 536 648 | 
             
            |Name |Occupation| Website
         | 
| 537 649 |  | 
| @@ -756,9 +868,10 @@ a|C | |
| 756 868 | 
             
            more C
         | 
| 757 869 | 
             
            |===
         | 
| 758 870 | 
             
                  EOS
         | 
| 759 | 
            -
                  output = render_embedded_string input
         | 
| 871 | 
            +
                  output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
         | 
| 760 872 | 
             
                  assert_css 'table', output, 1
         | 
| 761 873 | 
             
                  assert_css 'table *', output, 0
         | 
| 874 | 
            +
                  assert_includes warnings, 'exceeds specified number of columns'
         | 
| 762 875 | 
             
                end
         | 
| 763 876 |  | 
| 764 877 | 
             
                test 'paragraph, verse and literal content' do
         | 
| @@ -812,6 +925,24 @@ I wouldn't have it any other way. | |
| 812 925 | 
             
                  assert_equal 26, literal.text.lines.entries.size
         | 
| 813 926 | 
             
                end
         | 
| 814 927 |  | 
| 928 | 
            +
                test 'should strip trailing endline when splitting paragraphs' do
         | 
| 929 | 
            +
                  input = <<-EOS
         | 
| 930 | 
            +
            |===
         | 
| 931 | 
            +
            |first wrapped
         | 
| 932 | 
            +
            paragraph
         | 
| 933 | 
            +
             | 
| 934 | 
            +
            second paragraph
         | 
| 935 | 
            +
             | 
| 936 | 
            +
            third paragraph
         | 
| 937 | 
            +
            |===
         | 
| 938 | 
            +
                  EOS
         | 
| 939 | 
            +
             | 
| 940 | 
            +
                  result = render_embedded_string input
         | 
| 941 | 
            +
                  assert_xpath %((//p[@class="tableblock"])[1][text()="first wrapped\nparagraph"]), result, 1
         | 
| 942 | 
            +
                  assert_xpath %((//p[@class="tableblock"])[2][text()="second paragraph"]), result, 1
         | 
| 943 | 
            +
                  assert_xpath %((//p[@class="tableblock"])[3][text()="third paragraph"]), result, 1
         | 
| 944 | 
            +
                end
         | 
| 945 | 
            +
             | 
| 815 946 | 
             
                test 'basic asciidoc cell' do
         | 
| 816 947 | 
             
                  input = <<-EOS
         | 
| 817 948 | 
             
            |===
         | 
| @@ -846,18 +977,51 @@ content | |
| 846 977 | 
             
                  assert_css 'table.tableblock .paragraph', result, 0
         | 
| 847 978 | 
             
                end
         | 
| 848 979 |  | 
| 849 | 
            -
                test ' | 
| 980 | 
            +
                test 'should reset doctype to default in AsciiDoc table cell' do
         | 
| 850 981 | 
             
                  input = <<-EOS
         | 
| 982 | 
            +
            = Book Title
         | 
| 983 | 
            +
            :doctype: book
         | 
| 984 | 
            +
             | 
| 985 | 
            +
            == Chapter 1
         | 
| 986 | 
            +
             | 
| 851 987 | 
             
            |===
         | 
| 852 988 | 
             
            a|
         | 
| 853 | 
            -
             | 
| 989 | 
            +
            = AsciiDoc Table Cell
         | 
| 854 990 |  | 
| 855 | 
            -
             | 
| 991 | 
            +
            doctype={doctype}
         | 
| 992 | 
            +
            {backend-html5-doctype-article}
         | 
| 993 | 
            +
            {backend-html5-doctype-book}
         | 
| 856 994 | 
             
            |===
         | 
| 857 995 | 
             
                  EOS
         | 
| 858 996 |  | 
| 859 | 
            -
                  result = render_embedded_string input
         | 
| 860 | 
            -
                   | 
| 997 | 
            +
                  result = render_embedded_string input, :attributes => { 'attribute-missing' => 'skip' }
         | 
| 998 | 
            +
                  assert_includes result, 'doctype=article'
         | 
| 999 | 
            +
                  refute_includes result, '{backend-html5-doctype-article}'
         | 
| 1000 | 
            +
                  assert_includes result, '{backend-html5-doctype-book}'
         | 
| 1001 | 
            +
                end
         | 
| 1002 | 
            +
             | 
| 1003 | 
            +
                test 'should update doctype-related attributes in AsciiDoc table cell when doctype is set' do
         | 
| 1004 | 
            +
                  input = <<-EOS
         | 
| 1005 | 
            +
            = Document Title
         | 
| 1006 | 
            +
            :doctype: article
         | 
| 1007 | 
            +
             | 
| 1008 | 
            +
            == Chapter 1
         | 
| 1009 | 
            +
             | 
| 1010 | 
            +
            |===
         | 
| 1011 | 
            +
            a|
         | 
| 1012 | 
            +
            = AsciiDoc Table Cell
         | 
| 1013 | 
            +
            :doctype: book
         | 
| 1014 | 
            +
             | 
| 1015 | 
            +
            doctype={doctype}
         | 
| 1016 | 
            +
            {backend-html5-doctype-book}
         | 
| 1017 | 
            +
            {backend-html5-doctype-article}
         | 
| 1018 | 
            +
            |===
         | 
| 1019 | 
            +
                  EOS
         | 
| 1020 | 
            +
             | 
| 1021 | 
            +
                  result = render_embedded_string input, :attributes => { 'attribute-missing' => 'skip' }
         | 
| 1022 | 
            +
                  assert_includes result, 'doctype=book'
         | 
| 1023 | 
            +
                  refute_includes result, '{backend-html5-doctype-book}'
         | 
| 1024 | 
            +
                  assert_includes result, '{backend-html5-doctype-article}'
         | 
| 861 1025 | 
             
                end
         | 
| 862 1026 |  | 
| 863 1027 | 
             
                test 'asciidoc content' do
         | 
| @@ -991,6 +1155,68 @@ key: value <1> | |
| 991 1155 | 
             
                  end
         | 
| 992 1156 | 
             
                end
         | 
| 993 1157 |  | 
| 1158 | 
            +
                test 'compat mode can be activated in AsciiDoc table cell' do
         | 
| 1159 | 
            +
                  input = <<-EOS
         | 
| 1160 | 
            +
            |===
         | 
| 1161 | 
            +
            a|
         | 
| 1162 | 
            +
            :compat-mode:
         | 
| 1163 | 
            +
             | 
| 1164 | 
            +
            The word 'italic' is emphasized.
         | 
| 1165 | 
            +
            |===
         | 
| 1166 | 
            +
                  EOS
         | 
| 1167 | 
            +
             | 
| 1168 | 
            +
                  result = render_embedded_string input
         | 
| 1169 | 
            +
                  assert_xpath '//em[text()="italic"]', result, 1
         | 
| 1170 | 
            +
                end
         | 
| 1171 | 
            +
             | 
| 1172 | 
            +
                test 'compat mode in AsciiDoc table cell inherits from parent document' do
         | 
| 1173 | 
            +
                  input = <<-EOS
         | 
| 1174 | 
            +
            :compat-mode:
         | 
| 1175 | 
            +
             | 
| 1176 | 
            +
            The word 'italic' is emphasized.
         | 
| 1177 | 
            +
             | 
| 1178 | 
            +
            [cols=1*]
         | 
| 1179 | 
            +
            |===
         | 
| 1180 | 
            +
            |The word 'oblique' is emphasized.
         | 
| 1181 | 
            +
            a|
         | 
| 1182 | 
            +
            The word 'slanted' is emphasized.
         | 
| 1183 | 
            +
            |===
         | 
| 1184 | 
            +
             | 
| 1185 | 
            +
            The word 'askew' is emphasized.
         | 
| 1186 | 
            +
                  EOS
         | 
| 1187 | 
            +
             | 
| 1188 | 
            +
                  result = render_embedded_string input
         | 
| 1189 | 
            +
                  assert_xpath '//em[text()="italic"]', result, 1
         | 
| 1190 | 
            +
                  assert_xpath '//em[text()="oblique"]', result, 1
         | 
| 1191 | 
            +
                  assert_xpath '//em[text()="slanted"]', result, 1
         | 
| 1192 | 
            +
                  assert_xpath '//em[text()="askew"]', result, 1
         | 
| 1193 | 
            +
                end
         | 
| 1194 | 
            +
             | 
| 1195 | 
            +
                test 'compat mode in AsciiDoc table cell can be unset if set in parent document' do
         | 
| 1196 | 
            +
                  input = <<-EOS
         | 
| 1197 | 
            +
            :compat-mode:
         | 
| 1198 | 
            +
             | 
| 1199 | 
            +
            The word 'italic' is emphasized.
         | 
| 1200 | 
            +
             | 
| 1201 | 
            +
            [cols=1*]
         | 
| 1202 | 
            +
            |===
         | 
| 1203 | 
            +
            |The word 'oblique' is emphasized.
         | 
| 1204 | 
            +
            a|
         | 
| 1205 | 
            +
            :!compat-mode:
         | 
| 1206 | 
            +
             | 
| 1207 | 
            +
            The word 'slanted' is not emphasized.
         | 
| 1208 | 
            +
            |===
         | 
| 1209 | 
            +
             | 
| 1210 | 
            +
            The word 'askew' is emphasized.
         | 
| 1211 | 
            +
                  EOS
         | 
| 1212 | 
            +
             | 
| 1213 | 
            +
                  result = render_embedded_string input
         | 
| 1214 | 
            +
                  assert_xpath '//em[text()="italic"]', result, 1
         | 
| 1215 | 
            +
                  assert_xpath '//em[text()="oblique"]', result, 1
         | 
| 1216 | 
            +
                  assert_xpath '//em[text()="slanted"]', result, 0
         | 
| 1217 | 
            +
                  assert_xpath '//em[text()="askew"]', result, 1
         | 
| 1218 | 
            +
                end
         | 
| 1219 | 
            +
             | 
| 994 1220 | 
             
                test 'nested table' do
         | 
| 995 1221 | 
             
                  input = <<-EOS
         | 
| 996 1222 | 
             
            [cols="1,2a"]
         | 
| @@ -1006,11 +1232,30 @@ key: value <1> | |
| 1006 1232 | 
             
                  output = render_embedded_string input
         | 
| 1007 1233 | 
             
                  assert_css 'table', output, 2
         | 
| 1008 1234 | 
             
                  assert_css 'table table', output, 1
         | 
| 1009 | 
            -
                  assert_css 'table table', output, 1
         | 
| 1010 1235 | 
             
                  assert_css 'table > tbody > tr > td:nth-child(2) table', output, 1
         | 
| 1011 1236 | 
             
                  assert_css 'table > tbody > tr > td:nth-child(2) table > tbody > tr > td', output, 2
         | 
| 1012 1237 | 
             
                end
         | 
| 1013 1238 |  | 
| 1239 | 
            +
                test 'can set format of nested table to psv' do
         | 
| 1240 | 
            +
                  input = <<-EOS
         | 
| 1241 | 
            +
            [cols="2*"]
         | 
| 1242 | 
            +
            |===
         | 
| 1243 | 
            +
            |normal cell
         | 
| 1244 | 
            +
            a|
         | 
| 1245 | 
            +
            [format=psv]
         | 
| 1246 | 
            +
            !===
         | 
| 1247 | 
            +
            !nested cell
         | 
| 1248 | 
            +
            !===
         | 
| 1249 | 
            +
            |===
         | 
| 1250 | 
            +
                  EOS
         | 
| 1251 | 
            +
             | 
| 1252 | 
            +
                  output = render_embedded_string input
         | 
| 1253 | 
            +
                  assert_css 'table', output, 2
         | 
| 1254 | 
            +
                  assert_css 'table table', output, 1
         | 
| 1255 | 
            +
                  assert_css 'table > tbody > tr > td:nth-child(2) table', output, 1
         | 
| 1256 | 
            +
                  assert_css 'table > tbody > tr > td:nth-child(2) table > tbody > tr > td', output, 1
         | 
| 1257 | 
            +
                end
         | 
| 1258 | 
            +
             | 
| 1014 1259 | 
             
                test 'toc from parent document should not be included in an AsciiDoc table cell' do
         | 
| 1015 1260 | 
             
                  input = <<-EOS
         | 
| 1016 1261 | 
             
            = Document Title
         | 
| @@ -1207,7 +1452,7 @@ C1,C2 | |
| 1207 1452 | 
             
                  assert_xpath '/table/tbody/tr[2]/td[1]/p[text()="B1"]', output, 1
         | 
| 1208 1453 | 
             
                end
         | 
| 1209 1454 |  | 
| 1210 | 
            -
                test 'mixed unquoted records and quoted records with escaped quotes, commas and wrapped lines' do
         | 
| 1455 | 
            +
                test 'mixed unquoted records and quoted records with escaped quotes, commas, and wrapped lines' do
         | 
| 1211 1456 | 
             
                  input = <<-EOS
         | 
| 1212 1457 | 
             
            [format="csv",options="header"]
         | 
| 1213 1458 | 
             
            |===
         | 
| @@ -1217,16 +1462,20 @@ Year,Make,Model,Description,Price | |
| 1217 1462 | 
             
            1999,Chevy,"Venture ""Extended Edition, Very Large""",,5000.00
         | 
| 1218 1463 | 
             
            1996,Jeep,Grand Cherokee,"MUST SELL!
         | 
| 1219 1464 | 
             
            air, moon roof, loaded",4799.00
         | 
| 1465 | 
            +
            2000,Toyota,Tundra,"""This one's gonna to blow you're socks off,"" per the sticker",10000.00
         | 
| 1466 | 
            +
            2000,Toyota,Tundra,"Check it, ""this one's gonna to blow you're socks off"", per the sticker",10000.00
         | 
| 1220 1467 | 
             
            |===
         | 
| 1221 1468 | 
             
                  EOS
         | 
| 1222 1469 | 
             
                  output = render_embedded_string input
         | 
| 1223 1470 | 
             
                  assert_css 'table', output, 1
         | 
| 1224 1471 | 
             
                  assert_css 'table > colgroup > col[style*="width: 20%"]', output, 5
         | 
| 1225 1472 | 
             
                  assert_css 'table > thead > tr', output, 1
         | 
| 1226 | 
            -
                  assert_css 'table > tbody > tr', output,  | 
| 1473 | 
            +
                  assert_css 'table > tbody > tr', output, 6
         | 
| 1227 1474 | 
             
                  assert_xpath '((//tbody/tr)[1]/td)[4]/p[text()="ac, abs, moon"]', output, 1
         | 
| 1228 1475 | 
             
                  assert_xpath %(((//tbody/tr)[2]/td)[3]/p[text()='Venture "Extended Edition"']), output, 1
         | 
| 1229 1476 | 
             
                  assert_xpath '((//tbody/tr)[4]/td)[4]/p[text()="MUST SELL! air, moon roof, loaded"]', output, 1
         | 
| 1477 | 
            +
                  assert_xpath %(((//tbody/tr)[5]/td)[4]/p[text()='"This one#{decode_char 8217}s gonna to blow you#{decode_char 8217}re socks off," per the sticker']), output, 1
         | 
| 1478 | 
            +
                  assert_xpath %(((//tbody/tr)[6]/td)[4]/p[text()='Check it, "this one#{decode_char 8217}s gonna to blow you#{decode_char 8217}re socks off", per the sticker']), output, 1
         | 
| 1230 1479 | 
             
                end
         | 
| 1231 1480 |  | 
| 1232 1481 | 
             
                test 'csv format shorthand' do
         | 
| @@ -1244,9 +1493,25 @@ a,b,c | |
| 1244 1493 | 
             
                  assert_css 'table > tbody > tr:nth-child(2) > td', output, 3
         | 
| 1245 1494 | 
             
                end
         | 
| 1246 1495 |  | 
| 1247 | 
            -
                test ' | 
| 1496 | 
            +
                test 'tsv as format' do
         | 
| 1248 1497 | 
             
                  input = <<-EOS
         | 
| 1249 | 
            -
            [format= | 
| 1498 | 
            +
            [format=tsv]
         | 
| 1499 | 
            +
            ,===
         | 
| 1500 | 
            +
            a\tb\tc
         | 
| 1501 | 
            +
            1\t2\t3
         | 
| 1502 | 
            +
            ,===
         | 
| 1503 | 
            +
                  EOS
         | 
| 1504 | 
            +
                  output = render_embedded_string input
         | 
| 1505 | 
            +
                  assert_css 'table', output, 1
         | 
| 1506 | 
            +
                  assert_css 'table > colgroup > col', output, 3
         | 
| 1507 | 
            +
                  assert_css 'table > tbody > tr', output, 2
         | 
| 1508 | 
            +
                  assert_css 'table > tbody > tr:nth-child(1) > td', output, 3
         | 
| 1509 | 
            +
                  assert_css 'table > tbody > tr:nth-child(2) > td', output, 3
         | 
| 1510 | 
            +
                end
         | 
| 1511 | 
            +
             | 
| 1512 | 
            +
                test 'custom csv separator' do
         | 
| 1513 | 
            +
                  input = <<-EOS
         | 
| 1514 | 
            +
            [format=csv,separator=;]
         | 
| 1250 1515 | 
             
            |===
         | 
| 1251 1516 | 
             
            a;b;c
         | 
| 1252 1517 | 
             
            1;2;3
         | 
| @@ -1260,6 +1525,22 @@ a;b;c | |
| 1260 1525 | 
             
                  assert_css 'table > tbody > tr:nth-child(2) > td', output, 3
         | 
| 1261 1526 | 
             
                end
         | 
| 1262 1527 |  | 
| 1528 | 
            +
                test 'tab as separator' do
         | 
| 1529 | 
            +
                  input = <<-EOS
         | 
| 1530 | 
            +
            [separator=\\t]
         | 
| 1531 | 
            +
            ,===
         | 
| 1532 | 
            +
            a\tb\tc
         | 
| 1533 | 
            +
            1\t2\t3
         | 
| 1534 | 
            +
            ,===
         | 
| 1535 | 
            +
                  EOS
         | 
| 1536 | 
            +
                  output = render_embedded_string input
         | 
| 1537 | 
            +
                  assert_css 'table', output, 1
         | 
| 1538 | 
            +
                  assert_css 'table > colgroup > col', output, 3
         | 
| 1539 | 
            +
                  assert_css 'table > tbody > tr', output, 2
         | 
| 1540 | 
            +
                  assert_css 'table > tbody > tr:nth-child(1) > td', output, 3
         | 
| 1541 | 
            +
                  assert_css 'table > tbody > tr:nth-child(2) > td', output, 3
         | 
| 1542 | 
            +
                end
         | 
| 1543 | 
            +
             | 
| 1263 1544 | 
             
                test 'custom separator for an AsciiDoc table cell' do
         | 
| 1264 1545 | 
             
                  input = <<-EOS
         | 
| 1265 1546 | 
             
            [cols=2,separator=!]
         | 
| @@ -1342,5 +1623,24 @@ single cell | |
| 1342 1623 | 
             
                  output = render_embedded_string input, :backend => 'docbook45'
         | 
| 1343 1624 | 
             
                  assert output.include?('<?dbfo keep-together="always"?>')
         | 
| 1344 1625 | 
             
                end
         | 
| 1626 | 
            +
             | 
| 1627 | 
            +
                test 'no implicit header row if cell in first line is quoted and spans multiple lines' do
         | 
| 1628 | 
            +
                  input = <<-EOS
         | 
| 1629 | 
            +
            [cols=2*]
         | 
| 1630 | 
            +
            ,===
         | 
| 1631 | 
            +
            "A1
         | 
| 1632 | 
            +
             | 
| 1633 | 
            +
            A1 continued",B1
         | 
| 1634 | 
            +
            A2,B2
         | 
| 1635 | 
            +
            ,===
         | 
| 1636 | 
            +
                  EOS
         | 
| 1637 | 
            +
                  output = render_embedded_string input
         | 
| 1638 | 
            +
                  assert_css 'table', output, 1
         | 
| 1639 | 
            +
                  assert_css 'table > colgroup > col', output, 2
         | 
| 1640 | 
            +
                  assert_css 'table > thead', output, 0
         | 
| 1641 | 
            +
                  assert_css 'table > tbody', output, 1
         | 
| 1642 | 
            +
                  assert_css 'table > tbody > tr', output, 2
         | 
| 1643 | 
            +
                  assert_xpath '(//td)[1]/p[text()="A1 A1 continued"]', output, 1
         | 
| 1644 | 
            +
                end
         | 
| 1345 1645 | 
             
              end
         | 
| 1346 1646 | 
             
            end
         |