module OodAppkit::MarkdownTemplateHandler

Class used to handle markdown views in ‘ActionView::Template`

Public Class Methods

call(_, source) click to toggle source

String of ruby code to be evaluated when rendering the view @param template [ActionView::Template] the template to be rendered @return [String] string of ruby code to be evaluated

# File lib/ood_appkit/markdown_template_handler.rb, line 7
def self.call(_, source)
  "begin;#{render(source)}.html_safe;end"
end
render(text) click to toggle source

Render markdown to HTML @param text [String] markdown text @return [String] escaped version of html text surrounded by quote marks

# File lib/ood_appkit/markdown_template_handler.rb, line 14
def self.render(text)
  markdown.render(text).inspect
end

Private Class Methods

markdown() click to toggle source

Markdown renderer used

# File lib/ood_appkit/markdown_template_handler.rb, line 19
def self.markdown
  @markdown ||= OodAppkit.markdown
end