Class: Malt::Format::Markdown

Inherits:
Abstract show all
Defined in:
lib/malt/formats/markdown.rb

Overview

If using the Kramdown engine, then Latex is also a supported output format.

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Abstract

#default, #engine, engine, extensions, #extensions, #file, file_extension, #file_read, #file_type, #parse_type_from_data, #refile, register, #render, #render_into, #rendering_parameters, #scope_vs_data, #subtype, #text, #to, #to_default, #to_s, #type, #with, #with!

Instance Method Details

#html(*data, &context) ⇒ Object


32
33
34
35
# File 'lib/malt/formats/markdown.rb', line 32

def html(*data, &context)
  #engine.render(:text=>text, :file=>file, :format=>:html)
  render_into(:html, *data, &context)
end

#latex(*data, &content) ⇒ Object


44
45
46
47
# File 'lib/malt/formats/markdown.rb', line 44

def latex(*data, &content)
  render_into(:latex, *data, &content)
  #render_engine.render(:text=>text, :file=>file, :format=>:latex)
end

#markdownObject Also known as: md


18
19
20
# File 'lib/malt/formats/markdown.rb', line 18

def markdown(*)
  text
end

#to_htmlObject

Convert to HTML.


38
39
40
41
# File 'lib/malt/formats/markdown.rb', line 38

def to_html(*)
  opts = options.merge(:text=>html, :file=>refile(:html), :type=>:html)
  HTML.new(opts)
end

#to_latexObject

Latex is only supported by the Kramdown engine.


50
51
52
53
# File 'lib/malt/formats/markdown.rb', line 50

def to_latex(*)
  opts = options.merge(:text=>html, :file=>refile(:latex), :type=>:latex)
  Latex.new(opts)
end

#to_markdownObject Also known as: to_md


25
26
27
# File 'lib/malt/formats/markdown.rb', line 25

def to_markdown(*)
  self
end