asciidoctor 0.1.4 → 1.5.0
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 +209 -25
- data/{LICENSE → LICENSE.adoc} +4 -3
- data/README.adoc +392 -395
- data/Rakefile +94 -137
- data/benchmark/benchmark.rb +127 -0
- data/benchmark/sample-data/mdbasics.adoc +334 -0
- data/bin/asciidoctor +5 -8
- data/bin/asciidoctor-safe +4 -8
- data/compat/asciidoc.conf +78 -11
- data/compat/font-awesome-3-compat.css +397 -0
- data/data/stylesheets/asciidoctor-default.css +399 -0
- data/data/stylesheets/coderay-asciidoctor.css +89 -0
- data/features/open_block.feature +92 -0
- data/features/pass_block.feature +66 -0
- data/features/step_definitions.rb +42 -0
- data/features/text_formatting.feature +55 -0
- data/features/xref.feature +116 -0
- data/lib/asciidoctor.rb +1155 -605
- data/lib/asciidoctor/abstract_block.rb +157 -71
- data/lib/asciidoctor/abstract_node.rb +150 -93
- data/lib/asciidoctor/attribute_list.rb +85 -90
- data/lib/asciidoctor/block.rb +51 -24
- data/lib/asciidoctor/callouts.rb +4 -7
- data/lib/asciidoctor/cli.rb +3 -0
- data/lib/asciidoctor/cli/invoker.rb +86 -76
- data/lib/asciidoctor/cli/options.rb +111 -61
- data/lib/asciidoctor/converter.rb +232 -0
- data/lib/asciidoctor/converter/base.rb +58 -0
- data/lib/asciidoctor/converter/composite.rb +66 -0
- data/lib/asciidoctor/converter/docbook45.rb +94 -0
- data/lib/asciidoctor/converter/docbook5.rb +684 -0
- data/lib/asciidoctor/converter/factory.rb +225 -0
- data/lib/asciidoctor/converter/html5.rb +1081 -0
- data/lib/asciidoctor/converter/template.rb +296 -0
- data/lib/asciidoctor/core_ext.rb +7 -0
- data/lib/asciidoctor/core_ext/object/nil_or_empty.rb +23 -0
- data/lib/asciidoctor/core_ext/string/chr.rb +6 -0
- data/lib/asciidoctor/core_ext/symbol/length.rb +6 -0
- data/lib/asciidoctor/document.rb +590 -304
- data/lib/asciidoctor/extensions.rb +1100 -308
- data/lib/asciidoctor/helpers.rb +109 -46
- data/lib/asciidoctor/inline.rb +16 -9
- data/lib/asciidoctor/list.rb +23 -15
- data/lib/asciidoctor/opal_ext.rb +4 -0
- data/lib/asciidoctor/opal_ext/comparable.rb +38 -0
- data/lib/asciidoctor/opal_ext/dir.rb +13 -0
- data/lib/asciidoctor/opal_ext/error.rb +2 -0
- data/lib/asciidoctor/opal_ext/file.rb +125 -0
- data/lib/asciidoctor/{lexer.rb → parser.rb} +646 -455
- data/lib/asciidoctor/path_resolver.rb +141 -77
- data/lib/asciidoctor/reader.rb +257 -187
- data/lib/asciidoctor/section.rb +12 -16
- data/lib/asciidoctor/stylesheets.rb +91 -0
- data/lib/asciidoctor/substitutors.rb +1548 -0
- data/lib/asciidoctor/table.rb +73 -57
- data/lib/asciidoctor/timings.rb +39 -0
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +22 -14
- data/man/asciidoctor.adoc +18 -10
- data/test/attributes_test.rb +314 -14
- data/test/blocks_test.rb +763 -118
- data/test/converter_test.rb +352 -0
- data/test/document_test.rb +518 -199
- data/test/extensions_test.rb +273 -103
- data/test/fixtures/asciidoc_index.txt +27 -13
- data/test/fixtures/basic-docinfo.xml +1 -1
- data/test/fixtures/chapter-a.adoc +3 -0
- data/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb +6 -0
- data/test/fixtures/docinfo.xml +1 -1
- data/test/fixtures/include-file.asciidoc +2 -0
- data/test/fixtures/master.adoc +5 -0
- data/test/invoker_test.rb +173 -61
- data/test/links_test.rb +97 -21
- data/test/lists_test.rb +181 -22
- data/test/options_test.rb +86 -2
- data/test/paragraphs_test.rb +47 -5
- data/test/{lexer_test.rb → parser_test.rb} +128 -57
- data/test/paths_test.rb +36 -1
- data/test/preamble_test.rb +25 -17
- data/test/reader_test.rb +404 -249
- data/test/sections_test.rb +623 -58
- data/test/substitutions_test.rb +609 -132
- data/test/tables_test.rb +198 -24
- data/test/test_helper.rb +101 -31
- data/test/text_test.rb +88 -31
- metadata +160 -64
- data/Gemfile +0 -12
- data/Guardfile +0 -18
- data/asciidoctor.gemspec +0 -143
- data/lib/asciidoctor/backends/_stylesheets.rb +0 -466
- data/lib/asciidoctor/backends/base_template.rb +0 -114
- data/lib/asciidoctor/backends/docbook45.rb +0 -774
- data/lib/asciidoctor/backends/docbook5.rb +0 -103
- data/lib/asciidoctor/backends/html5.rb +0 -1214
- data/lib/asciidoctor/renderer.rb +0 -259
- data/lib/asciidoctor/substituters.rb +0 -1083
- data/test/fixtures/asciidoc.txt +0 -105
- data/test/fixtures/ascshort.txt +0 -32
- data/test/fixtures/list_elements.asciidoc +0 -10
- data/test/renderer_test.rb +0 -162
    
        data/test/options_test.rb
    CHANGED
    
    | @@ -1,4 +1,8 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # encoding: UTF-8
         | 
| 2 | 
            +
            unless defined? ASCIIDOCTOR_PROJECT_DIR
         | 
| 3 | 
            +
              $: << File.dirname(__FILE__); $:.uniq!
         | 
| 4 | 
            +
              require 'test_helper'
         | 
| 5 | 
            +
            end
         | 
| 2 6 | 
             
            require 'asciidoctor/cli/options'
         | 
| 3 7 |  | 
| 4 8 | 
             
            context 'Options' do
         | 
| @@ -45,7 +49,7 @@ context 'Options' do | |
| 45 49 | 
             
              test 'basic argument assignment' do
         | 
| 46 50 | 
             
                options = Asciidoctor::Cli::Options.parse!(%w(-v -s -d book test/fixtures/sample.asciidoc))
         | 
| 47 51 |  | 
| 48 | 
            -
                assert_equal  | 
| 52 | 
            +
                assert_equal 2, options[:verbose]
         | 
| 49 53 | 
             
                assert_equal false, options[:header_footer]
         | 
| 50 54 | 
             
                assert_equal 'book', options[:attributes]['doctype']
         | 
| 51 55 | 
             
                assert_equal 1, options[:input_files].size
         | 
| @@ -108,4 +112,84 @@ context 'Options' do | |
| 108 112 | 
             
                assert_equal ['custom-backend', 'custom-backend-hacks'], options[:template_dirs]
         | 
| 109 113 | 
             
              end
         | 
| 110 114 |  | 
| 115 | 
            +
              test 'multiple -r flags requires specified libraries' do
         | 
| 116 | 
            +
                options = Asciidoctor::Cli::Options.new
         | 
| 117 | 
            +
                redirect_streams do |stdout, stderr|
         | 
| 118 | 
            +
                  exitval = options.parse! %w(-r foobar -r foobaz test/fixtures/sample.asciidoc)
         | 
| 119 | 
            +
                  assert_match(%(asciidoctor: FAILED: 'foobar' could not be loaded), stderr.string)
         | 
| 120 | 
            +
                  assert_equal 1, exitval
         | 
| 121 | 
            +
                  assert_equal ['foobar', 'foobaz'], options[:requires]
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
              end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
              test '-r flag with multiple values requires specified libraries' do
         | 
| 126 | 
            +
                options = Asciidoctor::Cli::Options.new
         | 
| 127 | 
            +
                redirect_streams do |stdout, stderr|
         | 
| 128 | 
            +
                  exitval = options.parse! %w(-r foobar,foobaz test/fixtures/sample.asciidoc)
         | 
| 129 | 
            +
                  assert_match(%(asciidoctor: FAILED: 'foobar' could not be loaded), stderr.string)
         | 
| 130 | 
            +
                  assert_equal 1, exitval
         | 
| 131 | 
            +
                  assert_equal ['foobar', 'foobaz'], options[:requires]
         | 
| 132 | 
            +
                end
         | 
| 133 | 
            +
              end
         | 
| 134 | 
            +
             | 
| 135 | 
            +
              test '-I option appends paths to $LOAD_PATH' do
         | 
| 136 | 
            +
                options = Asciidoctor::Cli::Options.new
         | 
| 137 | 
            +
                old_load_path = $LOAD_PATH.dup
         | 
| 138 | 
            +
                begin
         | 
| 139 | 
            +
                  exitval = options.parse! %w(-I foobar -I foobaz test/fixtures/sample.asciidoc)
         | 
| 140 | 
            +
                  refute_equal 1, exitval
         | 
| 141 | 
            +
                  assert_equal old_load_path.size + 2, $LOAD_PATH.size
         | 
| 142 | 
            +
                  assert_equal File.expand_path('foobar'), $LOAD_PATH[0]
         | 
| 143 | 
            +
                  assert_equal File.expand_path('foobaz'), $LOAD_PATH[1]
         | 
| 144 | 
            +
                  assert_equal ['foobar', 'foobaz'], options[:load_paths]
         | 
| 145 | 
            +
                ensure
         | 
| 146 | 
            +
                  ($LOAD_PATH.size - old_load_path.size).times { $LOAD_PATH.shift }
         | 
| 147 | 
            +
                end
         | 
| 148 | 
            +
              end
         | 
| 149 | 
            +
             | 
| 150 | 
            +
              test '-I option appends multiple paths to $LOAD_PATH' do
         | 
| 151 | 
            +
                options = Asciidoctor::Cli::Options.new
         | 
| 152 | 
            +
                old_load_path = $LOAD_PATH.dup
         | 
| 153 | 
            +
                begin
         | 
| 154 | 
            +
                  exitval = options.parse! %W(-I foobar#{File::PATH_SEPARATOR}foobaz test/fixtures/sample.asciidoc)
         | 
| 155 | 
            +
                  refute_equal 1, exitval
         | 
| 156 | 
            +
                  assert_equal old_load_path.size + 2, $LOAD_PATH.size
         | 
| 157 | 
            +
                  assert_equal File.expand_path('foobar'), $LOAD_PATH[0]
         | 
| 158 | 
            +
                  assert_equal File.expand_path('foobaz'), $LOAD_PATH[1]
         | 
| 159 | 
            +
                  assert_equal ['foobar', 'foobaz'], options[:load_paths]
         | 
| 160 | 
            +
                ensure
         | 
| 161 | 
            +
                  ($LOAD_PATH.size - old_load_path.size).times { $LOAD_PATH.shift }
         | 
| 162 | 
            +
                end
         | 
| 163 | 
            +
              end
         | 
| 164 | 
            +
             | 
| 165 | 
            +
              test 'should set verbose to 2 when -v flag is specified' do
         | 
| 166 | 
            +
                options = Asciidoctor::Cli::Options.parse!(%w(-v test/fixtures/sample.asciidoc))
         | 
| 167 | 
            +
                assert_equal 2, options[:verbose]
         | 
| 168 | 
            +
              end
         | 
| 169 | 
            +
             | 
| 170 | 
            +
              test 'should set verbose to 0 when -q flag is specified' do
         | 
| 171 | 
            +
                options = Asciidoctor::Cli::Options.parse!(%w(-q test/fixtures/sample.asciidoc))
         | 
| 172 | 
            +
                assert_equal 0, options[:verbose]
         | 
| 173 | 
            +
              end
         | 
| 174 | 
            +
             | 
| 175 | 
            +
              test 'should set verbose to 2 when -v flag is specified after -q flag' do
         | 
| 176 | 
            +
                options = Asciidoctor::Cli::Options.parse!(%w(-q -v test/fixtures/sample.asciidoc))
         | 
| 177 | 
            +
                assert_equal 2, options[:verbose]
         | 
| 178 | 
            +
              end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
              test 'should set verbose to 0 when -q flag is specified after -v flag' do
         | 
| 181 | 
            +
                options = Asciidoctor::Cli::Options.parse!(%w(-v -q test/fixtures/sample.asciidoc))
         | 
| 182 | 
            +
                assert_equal 0, options[:verbose]
         | 
| 183 | 
            +
              end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
              test 'should enable timings when -t flag is specified' do
         | 
| 186 | 
            +
                options = Asciidoctor::Cli::Options.parse!(%w(-t test/fixtures/sample.asciidoc))
         | 
| 187 | 
            +
                assert_equal true, options[:timings]
         | 
| 188 | 
            +
              end
         | 
| 189 | 
            +
             | 
| 190 | 
            +
              test 'timings option is disable by default' do
         | 
| 191 | 
            +
                options = Asciidoctor::Cli::Options.parse!(%w(test/fixtures/sample.asciidoc))
         | 
| 192 | 
            +
                assert_equal false, options[:timings]
         | 
| 193 | 
            +
              end
         | 
| 194 | 
            +
             | 
| 111 195 | 
             
            end
         | 
    
        data/test/paragraphs_test.rb
    CHANGED
    
    | @@ -1,4 +1,8 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # encoding: UTF-8
         | 
| 2 | 
            +
            unless defined? ASCIIDOCTOR_PROJECT_DIR
         | 
| 3 | 
            +
              $: << File.dirname(__FILE__); $:.uniq!
         | 
| 4 | 
            +
              require 'test_helper'
         | 
| 5 | 
            +
            end
         | 
| 2 6 |  | 
| 3 7 | 
             
            context 'Paragraphs' do
         | 
| 4 8 | 
             
              context 'Normal' do
         | 
| @@ -186,11 +190,35 @@ Note that multi-entry terms generate separate index entries. | |
| 186 190 | 
             
                test 'normal paragraph should honor explicit subs list' do
         | 
| 187 191 | 
             
                  input = <<-EOS
         | 
| 188 192 | 
             
            [subs="specialcharacters"]
         | 
| 189 | 
            -
             | 
| 193 | 
            +
            *<Hey Jude>*
         | 
| 190 194 | 
             
                  EOS
         | 
| 191 195 |  | 
| 192 196 | 
             
                  output = render_embedded_string input
         | 
| 193 | 
            -
                  assert output.include?(' | 
| 197 | 
            +
                  assert output.include?('*<Hey Jude>*')
         | 
| 198 | 
            +
                end
         | 
| 199 | 
            +
             | 
| 200 | 
            +
                test 'normal paragraph should honor specialchars shorthand' do
         | 
| 201 | 
            +
                  input = <<-EOS
         | 
| 202 | 
            +
            [subs="specialchars"]
         | 
| 203 | 
            +
            *<Hey Jude>*
         | 
| 204 | 
            +
                  EOS
         | 
| 205 | 
            +
             | 
| 206 | 
            +
                  output = render_embedded_string input
         | 
| 207 | 
            +
                  assert output.include?('*<Hey Jude>*')
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                test 'should add a hardbreak at end of each line when hardbreaks option is set' do
         | 
| 211 | 
            +
                  input = <<-EOS
         | 
| 212 | 
            +
            [%hardbreaks]
         | 
| 213 | 
            +
            read
         | 
| 214 | 
            +
            my
         | 
| 215 | 
            +
            lips
         | 
| 216 | 
            +
                  EOS
         | 
| 217 | 
            +
             | 
| 218 | 
            +
                  output = render_embedded_string input
         | 
| 219 | 
            +
                  assert_css 'br', output, 2
         | 
| 220 | 
            +
                  assert_xpath '//p', output, 1
         | 
| 221 | 
            +
                  assert output.include?("<p>read<br>\nmy<br>\nlips</p>")
         | 
| 194 222 | 
             
                end
         | 
| 195 223 | 
             
              end
         | 
| 196 224 |  | 
| @@ -265,7 +293,7 @@ use the source, luke! | |
| 265 293 | 
             
            die 'zomg perl sucks';
         | 
| 266 294 | 
             
                  EOS
         | 
| 267 295 | 
             
                  output = render_embedded_string input
         | 
| 268 | 
            -
                  assert_xpath %(/*[@class="listingblock"]//pre[@class="highlight"]/code[@class=" | 
| 296 | 
            +
                  assert_xpath %(/*[@class="listingblock"]//pre[@class="highlight"]/code[@class="language-perl"][@data-lang="perl"][text()="die 'zomg perl sucks';"]), output, 1
         | 
| 269 297 | 
             
                end
         | 
| 270 298 |  | 
| 271 299 | 
             
                test 'literal paragraph terminates at block attribute list' do
         | 
| @@ -336,6 +364,16 @@ A famouse quote. | |
| 336 364 | 
             
                  assert_xpath '//*[@class = "verseblock"]/pre[normalize-space(text()) = "Famous verse."]', output, 1
         | 
| 337 365 | 
             
                end
         | 
| 338 366 |  | 
| 367 | 
            +
                test 'should perform normal subs on a verse paragraph' do
         | 
| 368 | 
            +
                  input = <<-EOS
         | 
| 369 | 
            +
            [verse]
         | 
| 370 | 
            +
            _GET /groups/link:#group-id[\{group-id\}]_
         | 
| 371 | 
            +
                  EOS
         | 
| 372 | 
            +
             | 
| 373 | 
            +
                  output = render_embedded_string input
         | 
| 374 | 
            +
                  assert output.include?('<pre class="content"><em>GET /groups/<a href="#group-id">{group-id}</a></em></pre>')
         | 
| 375 | 
            +
                end
         | 
| 376 | 
            +
             | 
| 339 377 | 
             
                test 'quote paragraph should honor explicit subs list' do
         | 
| 340 378 | 
             
                  input = <<-EOS
         | 
| 341 379 | 
             
            [subs="specialcharacters"]
         | 
| @@ -397,6 +435,8 @@ An abstract for the book. | |
| 397 435 | 
             
            [partintro]
         | 
| 398 436 | 
             
            An intro to this part.
         | 
| 399 437 |  | 
| 438 | 
            +
            == Chapter 1
         | 
| 439 | 
            +
             | 
| 400 440 | 
             
            [sidebar]
         | 
| 401 441 | 
             
            Just a side note.
         | 
| 402 442 |  | 
| @@ -433,6 +473,8 @@ An abstract for the book. | |
| 433 473 | 
             
            .Part intro title
         | 
| 434 474 | 
             
            An intro to this part.
         | 
| 435 475 |  | 
| 476 | 
            +
            == Chapter 1
         | 
| 477 | 
            +
             | 
| 436 478 | 
             
            [sidebar]
         | 
| 437 479 | 
             
            .Sidebar title
         | 
| 438 480 | 
             
            Just a side note.
         | 
| @@ -469,7 +511,7 @@ Wise words from a wise person. | |
| 469 511 | 
             
                  test 'should only format and output text in first paragraph when doctype is inline' do
         | 
| 470 512 | 
             
                    input = "http://asciidoc.org[AsciiDoc] is a _lightweight_ markup language...\n\nignored"
         | 
| 471 513 | 
             
                    output = render_string input, :doctype => 'inline'
         | 
| 472 | 
            -
                    assert_equal '<a href="http://asciidoc.org">AsciiDoc</a> is a <em>lightweight</em> markup language…', output
         | 
| 514 | 
            +
                    assert_equal '<a href="http://asciidoc.org">AsciiDoc</a> is a <em>lightweight</em> markup language…​', output
         | 
| 473 515 | 
             
                  end
         | 
| 474 516 |  | 
| 475 517 | 
             
                  test 'should output empty string if first block is not a paragraph' do
         | 
| @@ -1,16 +1,20 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            # encoding: UTF-8
         | 
| 2 | 
            +
            unless defined? ASCIIDOCTOR_PROJECT_DIR
         | 
| 3 | 
            +
              $: << File.dirname(__FILE__); $:.uniq!
         | 
| 4 | 
            +
              require 'test_helper'
         | 
| 5 | 
            +
            end
         | 
| 2 6 |  | 
| 3 | 
            -
            context " | 
| 7 | 
            +
            context "Parser" do
         | 
| 4 8 |  | 
| 5 9 | 
             
              test "is_section_title?" do
         | 
| 6 | 
            -
                assert Asciidoctor:: | 
| 7 | 
            -
                assert Asciidoctor:: | 
| 10 | 
            +
                assert Asciidoctor::Parser.is_section_title?('AsciiDoc Home Page', '==================')
         | 
| 11 | 
            +
                assert Asciidoctor::Parser.is_section_title?('=== AsciiDoc Home Page')
         | 
| 8 12 | 
             
              end
         | 
| 9 13 |  | 
| 10 14 | 
             
              test 'sanitize attribute name' do
         | 
| 11 | 
            -
                assert_equal 'foobar', Asciidoctor:: | 
| 12 | 
            -
                assert_equal 'foo', Asciidoctor:: | 
| 13 | 
            -
                assert_equal 'foo3-bar', Asciidoctor:: | 
| 15 | 
            +
                assert_equal 'foobar', Asciidoctor::Parser.sanitize_attribute_name("Foo Bar")
         | 
| 16 | 
            +
                assert_equal 'foo', Asciidoctor::Parser.sanitize_attribute_name("foo")
         | 
| 17 | 
            +
                assert_equal 'foo3-bar', Asciidoctor::Parser.sanitize_attribute_name("Foo 3^ # - Bar[")
         | 
| 14 18 | 
             
              end
         | 
| 15 19 |  | 
| 16 20 | 
             
              test "collect unnamed attribute" do
         | 
| @@ -198,7 +202,7 @@ context "Lexer" do | |
| 198 202 |  | 
| 199 203 | 
             
              test 'parse style attribute with id and role' do
         | 
| 200 204 | 
             
                attributes = {1 => 'style#id.role'}
         | 
| 201 | 
            -
                style, original_style = Asciidoctor:: | 
| 205 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 202 206 | 
             
                assert_equal 'style', style
         | 
| 203 207 | 
             
                assert_nil original_style
         | 
| 204 208 | 
             
                assert_equal 'style', attributes['style']
         | 
| @@ -209,7 +213,7 @@ context "Lexer" do | |
| 209 213 |  | 
| 210 214 | 
             
              test 'parse style attribute with style, role, id and option' do
         | 
| 211 215 | 
             
                attributes = {1 => 'style.role#id%fragment'}
         | 
| 212 | 
            -
                style, original_style = Asciidoctor:: | 
| 216 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 213 217 | 
             
                assert_equal 'style', style
         | 
| 214 218 | 
             
                assert_nil original_style
         | 
| 215 219 | 
             
                assert_equal 'style', attributes['style']
         | 
| @@ -222,7 +226,7 @@ context "Lexer" do | |
| 222 226 |  | 
| 223 227 | 
             
              test 'parse style attribute with style, id and multiple roles' do
         | 
| 224 228 | 
             
                attributes = {1 => 'style#id.role1.role2'}
         | 
| 225 | 
            -
                style, original_style = Asciidoctor:: | 
| 229 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 226 230 | 
             
                assert_equal 'style', style
         | 
| 227 231 | 
             
                assert_nil original_style
         | 
| 228 232 | 
             
                assert_equal 'style', attributes['style']
         | 
| @@ -233,7 +237,7 @@ context "Lexer" do | |
| 233 237 |  | 
| 234 238 | 
             
              test 'parse style attribute with style, multiple roles and id' do
         | 
| 235 239 | 
             
                attributes = {1 => 'style.role1.role2#id'}
         | 
| 236 | 
            -
                style, original_style = Asciidoctor:: | 
| 240 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 237 241 | 
             
                assert_equal 'style', style
         | 
| 238 242 | 
             
                assert_nil original_style
         | 
| 239 243 | 
             
                assert_equal 'style', attributes['style']
         | 
| @@ -244,7 +248,7 @@ context "Lexer" do | |
| 244 248 |  | 
| 245 249 | 
             
              test 'parse style attribute with positional and original style' do
         | 
| 246 250 | 
             
                attributes = {1 => 'new_style', 'style' => 'original_style'}
         | 
| 247 | 
            -
                style, original_style = Asciidoctor:: | 
| 251 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 248 252 | 
             
                assert_equal 'new_style', style
         | 
| 249 253 | 
             
                assert_equal 'original_style', original_style
         | 
| 250 254 | 
             
                assert_equal 'new_style', attributes['style']
         | 
| @@ -253,7 +257,7 @@ context "Lexer" do | |
| 253 257 |  | 
| 254 258 | 
             
              test 'parse style attribute with id and role only' do
         | 
| 255 259 | 
             
                attributes = {1 => '#id.role'}
         | 
| 256 | 
            -
                style, original_style = Asciidoctor:: | 
| 260 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 257 261 | 
             
                assert_nil style
         | 
| 258 262 | 
             
                assert_nil original_style
         | 
| 259 263 | 
             
                assert_equal 'id', attributes['id']
         | 
| @@ -263,7 +267,7 @@ context "Lexer" do | |
| 263 267 |  | 
| 264 268 | 
             
              test 'parse empty style attribute' do
         | 
| 265 269 | 
             
                attributes = {1 => nil}
         | 
| 266 | 
            -
                style, original_style = Asciidoctor:: | 
| 270 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 267 271 | 
             
                assert_nil style
         | 
| 268 272 | 
             
                assert_nil original_style
         | 
| 269 273 | 
             
                assert_nil attributes['id']
         | 
| @@ -273,7 +277,7 @@ context "Lexer" do | |
| 273 277 |  | 
| 274 278 | 
             
              test 'parse style attribute with option should preserve existing options' do
         | 
| 275 279 | 
             
                attributes = {1 => '%header', 'options' => 'footer', 'footer-option' => ''}
         | 
| 276 | 
            -
                style, original_style = Asciidoctor:: | 
| 280 | 
            +
                style, original_style = Asciidoctor::Parser.parse_style_attribute(attributes)
         | 
| 277 281 | 
             
                assert_nil style
         | 
| 278 282 | 
             
                assert_nil original_style
         | 
| 279 283 | 
             
                assert_equal 'header,footer', attributes['options']
         | 
| @@ -282,7 +286,7 @@ context "Lexer" do | |
| 282 286 | 
             
              end
         | 
| 283 287 |  | 
| 284 288 | 
             
              test "parse author first" do
         | 
| 285 | 
            -
                metadata, = parse_header_metadata 'Stuart'
         | 
| 289 | 
            +
                metadata, _ = parse_header_metadata 'Stuart'
         | 
| 286 290 | 
             
                assert_equal 5, metadata.size
         | 
| 287 291 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 288 292 | 
             
                assert_equal metadata['author'], metadata['authors']
         | 
| @@ -291,7 +295,7 @@ context "Lexer" do | |
| 291 295 | 
             
              end
         | 
| 292 296 |  | 
| 293 297 | 
             
              test "parse author first last" do
         | 
| 294 | 
            -
                metadata, = parse_header_metadata 'Yukihiro Matsumoto'
         | 
| 298 | 
            +
                metadata, _ = parse_header_metadata 'Yukihiro Matsumoto'
         | 
| 295 299 | 
             
                assert_equal 6, metadata.size
         | 
| 296 300 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 297 301 | 
             
                assert_equal 'Yukihiro Matsumoto', metadata['author']
         | 
| @@ -302,7 +306,7 @@ context "Lexer" do | |
| 302 306 | 
             
              end
         | 
| 303 307 |  | 
| 304 308 | 
             
              test "parse author first middle last" do
         | 
| 305 | 
            -
                metadata, = parse_header_metadata 'David Heinemeier Hansson'
         | 
| 309 | 
            +
                metadata, _ = parse_header_metadata 'David Heinemeier Hansson'
         | 
| 306 310 | 
             
                assert_equal 7, metadata.size
         | 
| 307 311 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 308 312 | 
             
                assert_equal 'David Heinemeier Hansson', metadata['author']
         | 
| @@ -314,7 +318,7 @@ context "Lexer" do | |
| 314 318 | 
             
              end
         | 
| 315 319 |  | 
| 316 320 | 
             
              test "parse author first middle last email" do
         | 
| 317 | 
            -
                metadata, = parse_header_metadata 'David Heinemeier Hansson <rails@ruby-lang.org>'
         | 
| 321 | 
            +
                metadata, _ = parse_header_metadata 'David Heinemeier Hansson <rails@ruby-lang.org>'
         | 
| 318 322 | 
             
                assert_equal 8, metadata.size
         | 
| 319 323 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 320 324 | 
             
                assert_equal 'David Heinemeier Hansson', metadata['author']
         | 
| @@ -327,7 +331,7 @@ context "Lexer" do | |
| 327 331 | 
             
              end
         | 
| 328 332 |  | 
| 329 333 | 
             
              test "parse author first email" do
         | 
| 330 | 
            -
                metadata, = parse_header_metadata 'Stuart <founder@asciidoc.org>'
         | 
| 334 | 
            +
                metadata, _ = parse_header_metadata 'Stuart <founder@asciidoc.org>'
         | 
| 331 335 | 
             
                assert_equal 6, metadata.size
         | 
| 332 336 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 333 337 | 
             
                assert_equal 'Stuart', metadata['author']
         | 
| @@ -338,7 +342,7 @@ context "Lexer" do | |
| 338 342 | 
             
              end
         | 
| 339 343 |  | 
| 340 344 | 
             
              test "parse author first last email" do
         | 
| 341 | 
            -
                metadata, = parse_header_metadata 'Stuart Rackham <founder@asciidoc.org>'
         | 
| 345 | 
            +
                metadata, _ = parse_header_metadata 'Stuart Rackham <founder@asciidoc.org>'
         | 
| 342 346 | 
             
                assert_equal 7, metadata.size
         | 
| 343 347 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 344 348 | 
             
                assert_equal 'Stuart Rackham', metadata['author']
         | 
| @@ -350,7 +354,7 @@ context "Lexer" do | |
| 350 354 | 
             
              end
         | 
| 351 355 |  | 
| 352 356 | 
             
              test "parse author with hyphen" do
         | 
| 353 | 
            -
                metadata, = parse_header_metadata 'Tim Berners-Lee <founder@www.org>'
         | 
| 357 | 
            +
                metadata, _ = parse_header_metadata 'Tim Berners-Lee <founder@www.org>'
         | 
| 354 358 | 
             
                assert_equal 7, metadata.size
         | 
| 355 359 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 356 360 | 
             
                assert_equal 'Tim Berners-Lee', metadata['author']
         | 
| @@ -362,7 +366,7 @@ context "Lexer" do | |
| 362 366 | 
             
              end
         | 
| 363 367 |  | 
| 364 368 | 
             
              test "parse author with single quote" do
         | 
| 365 | 
            -
                metadata, = parse_header_metadata 'Stephen O\'Grady <founder@redmonk.com>'
         | 
| 369 | 
            +
                metadata, _ = parse_header_metadata 'Stephen O\'Grady <founder@redmonk.com>'
         | 
| 366 370 | 
             
                assert_equal 7, metadata.size
         | 
| 367 371 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 368 372 | 
             
                assert_equal 'Stephen O\'Grady', metadata['author']
         | 
| @@ -374,7 +378,7 @@ context "Lexer" do | |
| 374 378 | 
             
              end
         | 
| 375 379 |  | 
| 376 380 | 
             
              test "parse author with dotted initial" do
         | 
| 377 | 
            -
                metadata, = parse_header_metadata 'Heiko W. Rupp <hwr@example.de>'
         | 
| 381 | 
            +
                metadata, _ = parse_header_metadata 'Heiko W. Rupp <hwr@example.de>'
         | 
| 378 382 | 
             
                assert_equal 8, metadata.size
         | 
| 379 383 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 380 384 | 
             
                assert_equal 'Heiko W. Rupp', metadata['author']
         | 
| @@ -387,7 +391,7 @@ context "Lexer" do | |
| 387 391 | 
             
              end
         | 
| 388 392 |  | 
| 389 393 | 
             
              test "parse author with underscore" do
         | 
| 390 | 
            -
                metadata, = parse_header_metadata 'Tim_E Fella'
         | 
| 394 | 
            +
                metadata, _ = parse_header_metadata 'Tim_E Fella'
         | 
| 391 395 | 
             
                assert_equal 6, metadata.size
         | 
| 392 396 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 393 397 | 
             
                assert_equal 'Tim E Fella', metadata['author']
         | 
| @@ -397,8 +401,31 @@ context "Lexer" do | |
| 397 401 | 
             
                assert_equal 'TF', metadata['authorinitials']
         | 
| 398 402 | 
             
              end
         | 
| 399 403 |  | 
| 404 | 
            +
              test 'parse author name with letters outside basic latin' do
         | 
| 405 | 
            +
                metadata, _ = parse_header_metadata 'Stéphane Brontë'
         | 
| 406 | 
            +
                assert_equal 6, metadata.size
         | 
| 407 | 
            +
                assert_equal 1, metadata['authorcount']
         | 
| 408 | 
            +
                assert_equal 'Stéphane Brontë', metadata['author']
         | 
| 409 | 
            +
                assert_equal metadata['author'], metadata['authors']
         | 
| 410 | 
            +
                assert_equal 'Stéphane', metadata['firstname']
         | 
| 411 | 
            +
                assert_equal 'Brontë', metadata['lastname']
         | 
| 412 | 
            +
                assert_equal 'SB', metadata['authorinitials']
         | 
| 413 | 
            +
              end if ::RUBY_MIN_VERSION_1_9
         | 
| 414 | 
            +
             | 
| 415 | 
            +
              test 'parse ideographic author names' do
         | 
| 416 | 
            +
                metadata, _ = parse_header_metadata '李 四 <si.li@example.com>'
         | 
| 417 | 
            +
                assert_equal 7, metadata.size
         | 
| 418 | 
            +
                assert_equal 1, metadata['authorcount']
         | 
| 419 | 
            +
                assert_equal '李 四', metadata['author']
         | 
| 420 | 
            +
                assert_equal metadata['author'], metadata['authors']
         | 
| 421 | 
            +
                assert_equal '李', metadata['firstname']
         | 
| 422 | 
            +
                assert_equal '四', metadata['lastname']
         | 
| 423 | 
            +
                assert_equal 'si.li@example.com', metadata['email']
         | 
| 424 | 
            +
                assert_equal '李四', metadata['authorinitials']
         | 
| 425 | 
            +
              end if ::RUBY_MIN_VERSION_1_9
         | 
| 426 | 
            +
             | 
| 400 427 | 
             
              test "parse author condenses whitespace" do
         | 
| 401 | 
            -
                metadata, = parse_header_metadata '   Stuart       Rackham     <founder@asciidoc.org>'
         | 
| 428 | 
            +
                metadata, _ = parse_header_metadata '   Stuart       Rackham     <founder@asciidoc.org>'
         | 
| 402 429 | 
             
                assert_equal 7, metadata.size
         | 
| 403 430 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 404 431 | 
             
                assert_equal 'Stuart Rackham', metadata['author']
         | 
| @@ -410,7 +437,7 @@ context "Lexer" do | |
| 410 437 | 
             
              end
         | 
| 411 438 |  | 
| 412 439 | 
             
              test "parse invalid author line becomes author" do
         | 
| 413 | 
            -
                metadata, = parse_header_metadata '   Stuart       Rackham, founder of AsciiDoc   <founder@asciidoc.org>'
         | 
| 440 | 
            +
                metadata, _ = parse_header_metadata '   Stuart       Rackham, founder of AsciiDoc   <founder@asciidoc.org>'
         | 
| 414 441 | 
             
                assert_equal 5, metadata.size
         | 
| 415 442 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 416 443 | 
             
                assert_equal 'Stuart Rackham, founder of AsciiDoc <founder@asciidoc.org>', metadata['author']
         | 
| @@ -420,7 +447,7 @@ context "Lexer" do | |
| 420 447 | 
             
              end
         | 
| 421 448 |  | 
| 422 449 | 
             
              test 'parse multiple authors' do
         | 
| 423 | 
            -
                metadata, = parse_header_metadata 'Doc Writer <doc.writer@asciidoc.org>; John Smith <john.smith@asciidoc.org>'
         | 
| 450 | 
            +
                metadata, _ = parse_header_metadata 'Doc Writer <doc.writer@asciidoc.org>; John Smith <john.smith@asciidoc.org>'
         | 
| 424 451 | 
             
                assert_equal 2, metadata['authorcount']
         | 
| 425 452 | 
             
                assert_equal 'Doc Writer, John Smith', metadata['authors']
         | 
| 426 453 | 
             
                assert_equal 'Doc Writer', metadata['author']
         | 
| @@ -429,7 +456,11 @@ context "Lexer" do | |
| 429 456 | 
             
              end
         | 
| 430 457 |  | 
| 431 458 | 
             
              test "parse rev number date remark" do
         | 
| 432 | 
            -
                 | 
| 459 | 
            +
                input = <<-EOS
         | 
| 460 | 
            +
            Ryan Waldron
         | 
| 461 | 
            +
            v0.0.7, 2013-12-18: The first release you can stand on
         | 
| 462 | 
            +
                EOS
         | 
| 463 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 433 464 | 
             
                assert_equal 9, metadata.size
         | 
| 434 465 | 
             
                assert_equal '0.0.7', metadata['revnumber']
         | 
| 435 466 | 
             
                assert_equal '2013-12-18', metadata['revdate']
         | 
| @@ -437,39 +468,64 @@ context "Lexer" do | |
| 437 468 | 
             
              end
         | 
| 438 469 |  | 
| 439 470 | 
             
              test "parse rev date" do
         | 
| 440 | 
            -
                 | 
| 471 | 
            +
                input = <<-EOS
         | 
| 472 | 
            +
            Ryan Waldron
         | 
| 473 | 
            +
            2013-12-18
         | 
| 474 | 
            +
                EOS
         | 
| 475 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 441 476 | 
             
                assert_equal 7, metadata.size
         | 
| 442 477 | 
             
                assert_equal '2013-12-18', metadata['revdate']
         | 
| 443 478 | 
             
              end
         | 
| 444 479 |  | 
| 445 480 | 
             
              # while compliant w/ AsciiDoc, this is just sloppy parsing
         | 
| 446 481 | 
             
              test "treats arbitrary text on rev line as revdate" do
         | 
| 447 | 
            -
                 | 
| 482 | 
            +
                input = <<-EOS
         | 
| 483 | 
            +
            Ryan Waldron
         | 
| 484 | 
            +
            foobar
         | 
| 485 | 
            +
                EOS
         | 
| 486 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 448 487 | 
             
                assert_equal 7, metadata.size
         | 
| 449 488 | 
             
                assert_equal 'foobar', metadata['revdate']
         | 
| 450 489 | 
             
              end
         | 
| 451 490 |  | 
| 452 491 | 
             
              test "parse rev date remark" do
         | 
| 453 | 
            -
                 | 
| 492 | 
            +
                input = <<-EOS
         | 
| 493 | 
            +
            Ryan Waldron
         | 
| 494 | 
            +
            2013-12-18:  The first release you can stand on
         | 
| 495 | 
            +
                EOS
         | 
| 496 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 454 497 | 
             
                assert_equal 8, metadata.size
         | 
| 455 498 | 
             
                assert_equal '2013-12-18', metadata['revdate']
         | 
| 456 499 | 
             
                assert_equal 'The first release you can stand on', metadata['revremark']
         | 
| 457 500 | 
             
              end
         | 
| 458 501 |  | 
| 459 502 | 
             
              test "should not mistake attribute entry as rev remark" do
         | 
| 460 | 
            -
                 | 
| 461 | 
            -
             | 
| 503 | 
            +
                input = <<-EOS
         | 
| 504 | 
            +
            Joe Cool
         | 
| 505 | 
            +
            :page-layout: post
         | 
| 506 | 
            +
                EOS
         | 
| 507 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 508 | 
            +
                refute_equal 'page-layout: post', metadata['revremark']
         | 
| 462 509 | 
             
                assert !metadata.has_key?('revdate')
         | 
| 463 510 | 
             
              end
         | 
| 464 511 |  | 
| 465 512 | 
             
              test "parse rev remark only" do
         | 
| 466 | 
            -
                 | 
| 467 | 
            -
             | 
| 513 | 
            +
                input = <<-EOS
         | 
| 514 | 
            +
            Joe Cool
         | 
| 515 | 
            +
             :Must start revremark-only line with space
         | 
| 516 | 
            +
                EOS
         | 
| 517 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 518 | 
            +
                assert_equal 'Must start revremark-only line with space', metadata['revremark']
         | 
| 468 519 | 
             
                assert_equal '', metadata['revdate']
         | 
| 469 520 | 
             
              end
         | 
| 470 521 |  | 
| 471 522 | 
             
              test "skip line comments before author" do
         | 
| 472 | 
            -
                 | 
| 523 | 
            +
                input = <<-EOS
         | 
| 524 | 
            +
            // Asciidoctor
         | 
| 525 | 
            +
            // release artist
         | 
| 526 | 
            +
            Ryan Waldron
         | 
| 527 | 
            +
                EOS
         | 
| 528 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 473 529 | 
             
                assert_equal 6, metadata.size
         | 
| 474 530 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 475 531 | 
             
                assert_equal 'Ryan Waldron', metadata['author']
         | 
| @@ -479,7 +535,14 @@ context "Lexer" do | |
| 479 535 | 
             
              end
         | 
| 480 536 |  | 
| 481 537 | 
             
              test "skip block comment before author" do
         | 
| 482 | 
            -
                 | 
| 538 | 
            +
                input = <<-EOS
         | 
| 539 | 
            +
            ////
         | 
| 540 | 
            +
            Asciidoctor
         | 
| 541 | 
            +
            release artist
         | 
| 542 | 
            +
            ////
         | 
| 543 | 
            +
            Ryan Waldron
         | 
| 544 | 
            +
                EOS
         | 
| 545 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 483 546 | 
             
                assert_equal 6, metadata.size
         | 
| 484 547 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 485 548 | 
             
                assert_equal 'Ryan Waldron', metadata['author']
         | 
| @@ -489,7 +552,15 @@ context "Lexer" do | |
| 489 552 | 
             
              end
         | 
| 490 553 |  | 
| 491 554 | 
             
              test "skip block comment before rev" do
         | 
| 492 | 
            -
                 | 
| 555 | 
            +
                input = <<-EOS
         | 
| 556 | 
            +
            Ryan Waldron
         | 
| 557 | 
            +
            ////
         | 
| 558 | 
            +
            Asciidoctor
         | 
| 559 | 
            +
            release info
         | 
| 560 | 
            +
            ////
         | 
| 561 | 
            +
            v0.0.7, 2013-12-18
         | 
| 562 | 
            +
                EOS
         | 
| 563 | 
            +
                metadata, _ = parse_header_metadata input
         | 
| 493 564 | 
             
                assert_equal 8, metadata.size
         | 
| 494 565 | 
             
                assert_equal 1, metadata['authorcount']
         | 
| 495 566 | 
             
                assert_equal 'Ryan Waldron', metadata['author']
         | 
| @@ -500,13 +571,13 @@ context "Lexer" do | |
| 500 571 | 
             
              test "attribute entry overrides generated author initials" do
         | 
| 501 572 | 
             
                blankdoc = Asciidoctor::Document.new
         | 
| 502 573 | 
             
                reader = Asciidoctor::Reader.new "Stuart Rackham <founder@asciidoc.org>\n:Author Initials: SJR".lines.entries
         | 
| 503 | 
            -
                metadata = Asciidoctor:: | 
| 574 | 
            +
                metadata = Asciidoctor::Parser.parse_header_metadata(reader, blankdoc)
         | 
| 504 575 | 
             
                assert_equal 'SR', metadata['authorinitials']
         | 
| 505 576 | 
             
                assert_equal 'SJR', blankdoc.attributes['authorinitials']
         | 
| 506 577 | 
             
              end
         | 
| 507 578 |  | 
| 508 579 | 
             
              test 'reset block indent to 0' do
         | 
| 509 | 
            -
                input = <<-EOS
         | 
| 580 | 
            +
                input = <<-EOS.chomp
         | 
| 510 581 | 
             
                def names
         | 
| 511 582 |  | 
| 512 583 | 
             
                  @name.split ' '
         | 
| @@ -514,7 +585,7 @@ context "Lexer" do | |
| 514 585 | 
             
                end
         | 
| 515 586 | 
             
                EOS
         | 
| 516 587 |  | 
| 517 | 
            -
                expected = <<-EOS
         | 
| 588 | 
            +
                expected = <<-EOS.chomp
         | 
| 518 589 | 
             
            def names
         | 
| 519 590 |  | 
| 520 591 | 
             
              @name.split ' '
         | 
| @@ -522,13 +593,13 @@ def names | |
| 522 593 | 
             
            end
         | 
| 523 594 | 
             
                EOS
         | 
| 524 595 |  | 
| 525 | 
            -
                lines = input. | 
| 526 | 
            -
                Asciidoctor:: | 
| 527 | 
            -
                assert_equal expected, lines | 
| 596 | 
            +
                lines = input.split("\n")
         | 
| 597 | 
            +
                Asciidoctor::Parser.reset_block_indent! lines
         | 
| 598 | 
            +
                assert_equal expected, (lines * "\n")
         | 
| 528 599 | 
             
              end
         | 
| 529 600 |  | 
| 530 601 | 
             
              test 'reset block indent mixed with tabs and spaces to 0' do
         | 
| 531 | 
            -
                input = <<-EOS
         | 
| 602 | 
            +
                input = <<-EOS.chomp
         | 
| 532 603 | 
             
                def names
         | 
| 533 604 |  | 
| 534 605 | 
             
            \t  @name.split ' '
         | 
| @@ -536,7 +607,7 @@ end | |
| 536 607 | 
             
                end
         | 
| 537 608 | 
             
                EOS
         | 
| 538 609 |  | 
| 539 | 
            -
                expected = <<-EOS
         | 
| 610 | 
            +
                expected = <<-EOS.chomp
         | 
| 540 611 | 
             
            def names
         | 
| 541 612 |  | 
| 542 613 | 
             
              @name.split ' '
         | 
| @@ -544,13 +615,13 @@ def names | |
| 544 615 | 
             
            end
         | 
| 545 616 | 
             
                EOS
         | 
| 546 617 |  | 
| 547 | 
            -
                lines = input. | 
| 548 | 
            -
                Asciidoctor:: | 
| 549 | 
            -
                assert_equal expected, lines | 
| 618 | 
            +
                lines = input.split("\n")
         | 
| 619 | 
            +
                Asciidoctor::Parser.reset_block_indent! lines
         | 
| 620 | 
            +
                assert_equal expected, (lines * "\n")
         | 
| 550 621 | 
             
              end
         | 
| 551 622 |  | 
| 552 623 | 
             
              test 'reset block indent to non-zero' do
         | 
| 553 | 
            -
                input = <<-EOS
         | 
| 624 | 
            +
                input = <<-EOS.chomp
         | 
| 554 625 | 
             
                def names
         | 
| 555 626 |  | 
| 556 627 | 
             
                  @name.split ' '
         | 
| @@ -558,7 +629,7 @@ end | |
| 558 629 | 
             
                end
         | 
| 559 630 | 
             
                EOS
         | 
| 560 631 |  | 
| 561 | 
            -
                expected = <<-EOS
         | 
| 632 | 
            +
                expected = <<-EOS.chomp
         | 
| 562 633 | 
             
              def names
         | 
| 563 634 |  | 
| 564 635 | 
             
                @name.split ' '
         | 
| @@ -566,9 +637,9 @@ end | |
| 566 637 | 
             
              end
         | 
| 567 638 | 
             
                EOS
         | 
| 568 639 |  | 
| 569 | 
            -
                lines = input. | 
| 570 | 
            -
                Asciidoctor:: | 
| 571 | 
            -
                assert_equal expected, lines | 
| 640 | 
            +
                lines = input.split("\n")
         | 
| 641 | 
            +
                Asciidoctor::Parser.reset_block_indent! lines, 2
         | 
| 642 | 
            +
                assert_equal expected, (lines * "\n")
         | 
| 572 643 | 
             
              end
         | 
| 573 644 |  | 
| 574 645 | 
             
              test 'preserve block indent' do
         | 
| @@ -583,7 +654,7 @@ end | |
| 583 654 | 
             
                expected = input
         | 
| 584 655 |  | 
| 585 656 | 
             
                lines = input.lines.entries
         | 
| 586 | 
            -
                Asciidoctor:: | 
| 657 | 
            +
                Asciidoctor::Parser.reset_block_indent! lines, nil
         | 
| 587 658 | 
             
                assert_equal expected, lines.join
         | 
| 588 659 | 
             
              end
         | 
| 589 660 |  | 
| @@ -592,7 +663,7 @@ end | |
| 592 663 | 
             
                expected = input
         | 
| 593 664 |  | 
| 594 665 | 
             
                lines = input.dup
         | 
| 595 | 
            -
                Asciidoctor:: | 
| 666 | 
            +
                Asciidoctor::Parser.reset_block_indent! lines
         | 
| 596 667 | 
             
                assert_equal expected, lines
         | 
| 597 668 | 
             
              end
         | 
| 598 669 |  |