class Nesta::Page

Public Instance Methods

convert_to_html(format, scope, text) click to toggle source
# File lib/nesta-contentfocus-extensions/page.rb, line 4
def convert_to_html(format, scope, text)
  text = add_p_tags_to_haml(text) if @format == :haml
  template = Tilt[format].new(nil, 1, markdown_options) { text }
  template.render(scope)
end
intro_image() click to toggle source
# File lib/nesta-contentfocus-extensions/page.rb, line 10
def intro_image
  return metadata('Intro Image') if metadata('Intro Image')
end
markdown_options() click to toggle source
# File lib/nesta-contentfocus-extensions/page.rb, line 14
def markdown_options
  {
    auto_id_stripping: true,
    auto_ids: true,
    syntax_highlighter: :rouge,
    syntax_highlighter_opts: syntax_highlight_options
  }
  #{
  #  autolink: true,
  #  disable_indented_code_blocks: true,
  #  fenced_code_blocks: true,
  #  footnotes: true,
  #  highlight: true,
  #  no_intra_emphasis: true,
  #  quote: true,
  #  strikethrough: true,
  #  syntax_highlighter: :rouge,
  #  superscript: true,
  #  tables: true }
end
syntax_highlight_options() click to toggle source
# File lib/nesta-contentfocus-extensions/page.rb, line 35
def syntax_highlight_options
  {
    line_numbers: true,
    css_class: 'hll'
  }
end