diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2017-07-17 23:57:40 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-17 23:57:40 -0600 |
| commit | e6083ac0b5dfa044efb73a37297024e883dc628c (patch) | |
| tree | e1ddc006438dd9475b071159eab080fbc389ef4d | |
| parent | 3d5102902be594735bfae0c3e67a0acc33faa1fa (diff) | |
drop skipped content inside a delimited block (PR #2319)
- drop skipped content inside of creating empty paragraphs
- add missing test for scenario
| -rw-r--r-- | lib/asciidoctor/parser.rb | 9 | ||||
| -rw-r--r-- | test/blocks_test.rb | 17 |
2 files changed, 21 insertions, 5 deletions
diff --git a/lib/asciidoctor/parser.rb b/lib/asciidoctor/parser.rb index d1b9668d..7c96082a 100644 --- a/lib/asciidoctor/parser.rb +++ b/lib/asciidoctor/parser.rb @@ -444,13 +444,12 @@ class Parser if options.fetch :parse_metadata, true # read lines until there are no more metadata lines to read while parse_block_metadata_line reader, document, attributes, options + # discard the line just processed advanced = reader.advance + reader.skip_blank_lines end - if advanced && reader.empty? - # NOTE there are no cases when these attributes are used, but clear them anyway - attributes.clear - return - end + # QUESTION should we clear the attributes? no known cases when it's necessary + return if advanced && reader.empty? end if (extensions = document.extensions) diff --git a/test/blocks_test.rb b/test/blocks_test.rb index 69594c83..cb03e25a 100644 --- a/test/blocks_test.rb +++ b/test/blocks_test.rb @@ -85,6 +85,23 @@ second paragraph assert_xpath '//p', output, 2 end + test 'comment block between paragraphs offset by blank lines inside delimited block' do + input = <<-EOS +==== +first paragraph + +//// +block comment +//// + +second paragraph +==== + EOS + output = render_embedded_string input + refute_match(/block comment/, output) + assert_xpath '//p', output, 2 + end + test 'adjacent comment block between paragraphs' do input = <<-EOS first paragraph |
