Sha256: eb78be09e1fa194d9785b5df0374a6f352e06c6f22ada310ddde1dd3158c1314

Contents?: true

Size: 1.17 KB

Versions: 17

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'helper'

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

17 entries across 17 versions & 1 rubygems

Version Path
nanoc-4.8.11 test/filters/test_pandoc.rb
nanoc-4.8.10 test/filters/test_pandoc.rb
nanoc-4.8.9 test/filters/test_pandoc.rb
nanoc-4.8.8 test/filters/test_pandoc.rb
nanoc-4.8.7 test/filters/test_pandoc.rb
nanoc-4.8.6 test/filters/test_pandoc.rb
nanoc-4.8.5 test/filters/test_pandoc.rb
nanoc-4.8.4 test/filters/test_pandoc.rb
nanoc-4.8.3 test/filters/test_pandoc.rb
nanoc-4.8.2 test/filters/test_pandoc.rb
nanoc-4.8.1 test/filters/test_pandoc.rb
nanoc-4.8.0 test/filters/test_pandoc.rb
nanoc-4.7.14 test/filters/test_pandoc.rb
nanoc-4.7.13 test/filters/test_pandoc.rb
nanoc-4.7.12 test/filters/test_pandoc.rb
nanoc-4.7.11 test/filters/test_pandoc.rb
nanoc-4.7.10 test/filters/test_pandoc.rb