summaryrefslogtreecommitdiff
path: root/test/converter_test.rb
diff options
context:
space:
mode:
authorNik Everett <nik9000@gmail.com>2019-11-28 23:46:05 -0500
committerDan Allen <dan.j.allen@gmail.com>2019-11-28 21:46:05 -0700
commitf4eaf65195e19caf99cabf386bd52fd2e2307977 (patch)
tree35418664d66fef47cb12b6f7ee030532119eb1b4 /test/converter_test.rb
parent4155916105b3276e5971349b1730b9d095d29db3 (diff)
resolves #3491 allow template to override outline (PR #3493)
Allows plugging a template in to the html5 converter's outline node by replacing all direct calls to `convert_outline` with calls to the to the conversion named `outline`.
Diffstat (limited to 'test/converter_test.rb')
-rw-r--r--test/converter_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/converter_test.rb b/test/converter_test.rb
index 70a99802..b79f4614 100644
--- a/test/converter_test.rb
+++ b/test/converter_test.rb
@@ -316,6 +316,24 @@ context 'Converter' do
assert_xpath '//aside/header/h1[text()="Related"]', output, 1
assert_xpath '//aside/header/following-sibling::p[text()="Sidebar content"]', output, 1
end
+
+ test 'should be able to override the outline using a custom template' do
+ input = <<~'EOS'
+ :toc:
+ = Document Title
+
+ == Section One
+
+ == Section Two
+
+ == Section Three
+ EOS
+
+ output = document_from_string(input, template_dir: (fixture_path 'custom-backends/slim/html5-custom-outline'), template_cache: false).convert
+ assert_xpath '//*[@id="toc"]/ul', output, 1
+ assert_xpath '//*[@id="toc"]/ul[1]/li', output, 3
+ assert_xpath '//*[@id="toc"]/ul[1]/li[1][text()="Section One"]', output, 1
+ end
end
context 'Custom converters' do