class Tilt::CommonMarkerTemplate

Constants

EXTENSIONS
OPTION_ALIAS
PARSE_OPTIONS
RENDER_OPTIONS

Public Instance Methods

allows_script?() click to toggle source
# File lib/tilt/commonmarker.rb, line 84
def allows_script?
  false
end
evaluate(scope, locals, &block) click to toggle source
# File lib/tilt/commonmarker.rb, line 79
def evaluate(scope, locals, &block)
  doc = CommonMarker.render_doc(data, parse_options, extensions)
  doc.to_html(render_options, extensions)
end
extensions() click to toggle source
# File lib/tilt/commonmarker.rb, line 39
def extensions
  EXTENSIONS.select do |extension|
    options[extension]
  end
end
parse_options() click to toggle source
# File lib/tilt/commonmarker.rb, line 45
def parse_options
  raw_options = PARSE_OPTIONS.select do |option|
    options[option]
  end
  actual_options = raw_options.map do |option|
    OPTION_ALIAS[option] || option
  end

  if actual_options.any?
    actual_options
  else
    :DEFAULT
  end
end
prepare() click to toggle source
# File lib/tilt/commonmarker.rb, line 74
def prepare
  @engine = nil
  @output = nil
end
render_options() click to toggle source
# File lib/tilt/commonmarker.rb, line 60
def render_options
  raw_options = RENDER_OPTIONS.select do |option|
    options[option]
  end
  actual_options = raw_options.map do |option|
    OPTION_ALIAS[option] || option
  end
  if actual_options.any?
    actual_options
  else
    :DEFAULT
  end
end