Skip to content

Commit

Permalink
added support for :xhtml syntax to colorize_syntax filter
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Nov 21, 2010
1 parent d5452f1 commit 6231a99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/nanoc3/filters/colorize_syntax.rb
Expand Up @@ -62,7 +62,7 @@ def run(content, params={})
case syntax
when :html
klass = Nokogiri::HTML
when :xml
when :xml, :xhtml
klass = Nokogiri::XML
else
raise RuntimeError, "unknown syntax: #{syntax.inspect} (expected :html or :xml)"
Expand Down
15 changes: 15 additions & 0 deletions test/filters/test_colorize_syntax.rb
Expand Up @@ -97,4 +97,19 @@ def test_colorize_syntax_with_xml
end
end

def test_colorize_syntax_with_xhtml
if_have 'coderay' do
# Create filter
filter = ::Nanoc3::Filters::ColorizeSyntax.new

# Get input and expected output
input = '<p>foo<br/>bar</p>'
expected_output = '<p>foo<br />bar</p>'

# Run filter
actual_output = filter.run(input, :syntax => :xhtml)
assert_equal(expected_output, actual_output)
end
end

end

0 comments on commit 6231a99

Please sign in to comment.