# -*- encoding: utf-8 -*- require 'test/unit' require 'helper' require 'webgen/node' require 'webgen/tree' require 'webgen/contentprocessor' class TestContentProcessorKramdown < Test::Unit::TestCase include Test::WebsiteHelper def test_call obj = Webgen::ContentProcessor::Kramdown.new node = Webgen::Node.new(Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/'), 'test', 'test') hello = Webgen::Node.new(node.tree.root, 'hello.en.html', 'hello.html') # test normal invocation context = Webgen::Context.new(:content => '# header', :chain => [node]) assert_equal("
Link test
\n", obj.call(context).content) context.content = 'Link ![test](hello.html)' assert_equal("Link
\n", obj.call(context).content) @website.config['contentprocessor.kramdown.handle_links'] = false context.content = 'Link [test](hello.html)' assert_equal("Link test
\n", obj.call(context).content) context.content = 'Link ![test](hello.html)' assert_equal("Link
\n", obj.call(context).content) # test setting options in the context object context.content = "# Header\n\n[test](hello.html)" context.options['contentprocessor.kramdown.options'] = {:auto_id_prefix => 'hallo', :auto_ids => true} context.options['contentprocessor.kramdown.handle_links'] = true assert_equal("