summaryrefslogtreecommitdiff
path: root/test/reader_test.rb
diff options
context:
space:
mode:
authorAbhinav Gupta <mail@abhinavg.net>2022-07-05 01:04:49 -0700
committerGitHub <noreply@github.com>2022-07-05 02:04:49 -0600
commitb81c8fec88b5a995b1771e3dfb3c7a5a8c33ae51 (patch)
tree6b5b6cac4c790ca23610e42c46cb140f50445886 /test/reader_test.rb
parent7822fbe9223ca81e9895f6132b2274e89f26c623 (diff)
resolves #4300 add support for TOML front matter to skip-front-matter attribute (PR #4301)
Diffstat (limited to 'test/reader_test.rb')
-rw-r--r--test/reader_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/reader_test.rb b/test/reader_test.rb
index edd0aaa6..deb0cdbd 100644
--- a/test/reader_test.rb
+++ b/test/reader_test.rb
@@ -556,6 +556,31 @@ class ReaderTest < Minitest::Test
assert_equal front_matter, doc.attributes['front-matter']
assert_equal 7, reader.lineno
end
+
+ test 'should skip TOML front matter if specified by skip-front-matter attribute' do
+ front_matter = <<~'EOS'.chop
+ layout = 'post'
+ title = 'Document Title'
+ author = 'username'
+ tags = ['first', 'second']
+ EOS
+
+ input = <<~EOS
+ +++
+ #{front_matter}
+ +++
+ = Document Title
+ Author Name
+
+ preamble
+ EOS
+
+ doc = Asciidoctor::Document.new input, attributes: { 'skip-front-matter' => '' }
+ reader = doc.reader
+ assert_equal '= Document Title', reader.peek_line
+ assert_equal front_matter, doc.attributes['front-matter']
+ assert_equal 7, reader.lineno
+ end
end
context 'Include Stack' do