summaryrefslogtreecommitdiff
path: root/test/preamble_test.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2012-12-17 03:20:30 -0700
committerDan Allen <dan.j.allen@gmail.com>2012-12-17 03:20:30 -0700
commit34e6ad2a2da41b759ccaa26c4b73d0ffecbdce42 (patch)
treee5143f46d76813387403ff0aa0d6614753cb649c /test/preamble_test.rb
parente4102d5b8244e2c2573065701adabc9d196af3ed (diff)
support book doctype, streamline doc title accessors
- add doctype accessor to Document - support the book doctype (multiple level-0 headings) - polish and document logic for retrieving the document and header titles - subtitute attributes in section titles - tests for everything mentioned above
Diffstat (limited to 'test/preamble_test.rb')
-rw-r--r--test/preamble_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/preamble_test.rb b/test/preamble_test.rb
index 1b3b4fc6..5ae997c8 100644
--- a/test/preamble_test.rb
+++ b/test/preamble_test.rb
@@ -85,4 +85,28 @@ Section paragraph 1.
assert_xpath '//h2[@id="_first_section"]/preceding::p', result, 1
end
+ test 'preamble in book doctype' do
+ input = <<-EOS
+Book
+====
+:doctype: book
+
+Back then...
+
+= Chapter One
+
+It was a dark and stormy night...
+
+= Chapter Two
+
+They couldn't believe their eyes when...
+ EOS
+
+ d = document_from_string(input)
+ assert_equal 'book', d.doctype
+ output = d.render
+ assert_xpath '//h1', output, 3
+ assert_xpath '//*[@id="preamble"]//p[text() = "Back then..."]', output, 1
+ end
+
end