forked from wezm/wezm.net
Custom filter to enable smart quotes in RDiscount
This commit is contained in:
parent
12fe3312a0
commit
9632830e5c
2 changed files with 15 additions and 2 deletions
4
Rules
4
Rules
|
@ -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
13
lib/smart_rdiscount.rb
Normal 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
|
Loading…
Reference in a new issue