# encoding: utf-8 require 'test_helper' require 'tilt' begin require 'tilt/pandoc' class PandocTemplateTest < Minitest::Test test "preparing and evaluating templates on #render" do template = Tilt::PandocTemplate.new { |t| "# Hello World!" } assert_equal "
OKAY – ‘Smarty Pants’
", template.render end test "stripping HTML when :escape_html is set" do template = Tilt::PandocTemplate.new(:escape_html => true) { |t| "HELLO " } assert_equal "HELLO <blink>WORLD</blink>
", template.render end # Pandoc has tons of additional markdown features (see http://pandoc.org/README.html#pandocs-markdown). # The test for footnotes should be seen as a general representation for all of them. # use markdown_strict => true to disable additional markdown features describe "passing in Pandoc options" do test "generates footnotes" do template = Tilt::PandocTemplate.new { |t| "Here is an inline note.^[Inlines notes are cool!]" } assert_equal "Here is an inline note.1
\nInlines notes are cool!↩
Here is an inline note.^[Inlines notes are cool!]
", template.render end test "doesn't generate footnotes with commonmark option" do template = Tilt::PandocTemplate.new(:commonmark => true) { |t| "Here is an inline note.^[Inlines notes are cool!]" } assert_equal "Here is an inline note.^[Inlines notes are cool!]
", template.render end test "accepts arguments with values (e.g. :id_prefix => 'xyz')" do # Table of contents isn't on by default template = Tilt::PandocTemplate.new { |t| "# This is a heading" } assert_equal "