Skip to content

Commit

Permalink
add support for custom rule functions in RedCloth
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Oct 30, 2011
1 parent 76b0854 commit 05aba4b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/awestruct/textilable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ module Textilable
def render(context)
rendered = ''
begin
rendered = RedCloth.new( context.interpolate_string( raw_page_content ) ).to_html
# a module of rule functions is included in RedCloth using RedCloth.send(:include, MyRules)
# rule functions on that module are activated by setting the property site.textile_rules
# ex. site.textile_rules = ['emoticons']
rules = context.site.textile_rules ? context.site.textile_rules.map { |r| r.to_sym } : []
rendered = RedCloth.new( context.interpolate_string( raw_page_content ) ).to_html(*rules)
rescue => e
puts e
puts e.backtrace
Expand Down

0 comments on commit 05aba4b

Please sign in to comment.