Sha256: 4056238914d153cad2ccefb6c4d305fb8c6c987af8ba1efe1829b71173655152

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

# encoding: utf-8

class Nanoc::Filters::PandocTest < Nanoc::TestCase
  def test_filter
    if_have 'pandoc-ruby' do
      skip_unless_have_command 'pandoc'

      # Create filter
      filter = ::Nanoc::Filters::Pandoc.new

      # Run filter
      result = filter.setup_and_run("# Heading\n")
      assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
    end
  end

  def test_params_old
    if_have 'pandoc-ruby' do
      skip_unless_have_command 'pandoc'

      # Create filter
      filter = ::Nanoc::Filters::Pandoc.new

      # Run filter
      args = { f: :markdown, to: :html }
      result = filter.setup_and_run("# Heading\n", args)
      assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
    end
  end

  def test_params_new
    if_have 'pandoc-ruby' do
      skip_unless_have_command 'pandoc'

      # Create filter
      filter = ::Nanoc::Filters::Pandoc.new

      # Run filter
      args = [:s, { f: :markdown, to: :html }, 'no-wrap', :toc]
      result = filter.setup_and_run("# Heading\n", args: args)
      assert_match '<div id="TOC">', result
      assert_match(%r{<h1 id=\"heading\">Heading</h1>\s*}, result)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nanoc-4.0.0b2 test/filters/test_pandoc.rb
nanoc-4.0.0b1 test/filters/test_pandoc.rb
nanoc-4.0.0a2 test/filters/test_pandoc.rb
nanoc-4.0.0a1 test/filters/test_pandoc.rb
nanoc-3.8.0 test/filters/test_pandoc.rb