Sha256: ef891189a7b1bf4eca00d5f1d0ce63c7d2fc7acb1b775405dc52e84803483860

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'nesta-contentfocus-extensions/renderer'
module Nesta
  class Page < FileModel
    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

    def intro_image
      return metadata('Intro Image') if metadata('Intro Image')
    end

    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

    def syntax_highlight_options
      {
        line_numbers: true,
        css_class: 'hll'
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nesta-contentfocus-extensions-0.0.3 lib/nesta-contentfocus-extensions/page.rb
nesta-contentfocus-extensions-0.0.2 lib/nesta-contentfocus-extensions/page.rb