Custom filter to enable smart quotes in RDiscount

This commit is contained in:
Wesley Moore 2010-03-12 17:45:42 +11:00
parent 12fe3312a0
commit 9632830e5c
2 changed files with 15 additions and 2 deletions

4
Rules
View file

@ -16,7 +16,7 @@ compile %r{/(?:technical|personal|)articles/(page/|)} do
end
compile %r(/\d{4}/*) do
filter :rdiscount
filter :smart_rdiscount
layout 'article'
layout 'default'
end
@ -30,7 +30,7 @@ compile %r{(?:/robots/|/sitemap)} do
end
compile '*' do
filter :rdiscount
filter :smart_rdiscount
layout 'default'
end

13
lib/smart_rdiscount.rb Normal file
View file

@ -0,0 +1,13 @@
module WezM::Filters
class SmartRDiscount < Nanoc3::Filter
def run(content, params={})
require 'rdiscount'
markdown = ::RDiscount.new(content)
markdown.smart = true
markdown.to_html
end
end
end
Nanoc3::Filter.register '::WezM::Filters::SmartRDiscount', :smart_rdiscount