diff options
author | elijah <elijah@riseup.net> | 2014-01-21 13:54:45 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2014-01-23 11:37:49 -0800 |
commit | 87383e624855def55e13d238b2f20b79c418c1d9 (patch) | |
tree | bfba7820ab8ed90b433c5e0fc56def4c7ea523fc /config/initializers | |
parent | 01941b7d930c581a6684f6b939b3ae2f62bd832e (diff) |
added default pricing, privacy policy and tos pages.
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/markdown_handler.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/config/initializers/markdown_handler.rb b/config/initializers/markdown_handler.rb new file mode 100644 index 0000000..b9e73ba --- /dev/null +++ b/config/initializers/markdown_handler.rb @@ -0,0 +1,19 @@ +# +# This adds support for markdown in views. Just name the template with ".md" +# erb expansion is supported. +# + +require 'rdiscount' + +module MarkdownHandler + def self.erb + @erb ||= ActionView::Template.registered_template_handler(:erb) + end + + def self.call(template) + compiled_source = erb.call(template) + "RDiscount.new(begin;#{compiled_source};end, :generate_toc, :smart, :autolink).to_html" + end +end + +ActionView::Template.register_template_handler :md, MarkdownHandler |