Class: Markdown::Converter

Inherits:
Object
  • Object
show all
Includes:
Engine
Defined in:
lib/markdown/wrapper.rb

Overview

todo: use Converter inside Wrapper to avoid duplication

Instance Method Summary collapse

Methods included from Engine

#bluecloth_to_html, #bluecloth_version, #kramdown_to_html, #kramdown_version, #maruku_to_html, #maruku_version, #pandoc_ruby_to_html, #pandoc_ruby_to_html_incremental, #pandoc_ruby_to_s5, #pandoc_ruby_to_s5_incremental, #rdiscount_to_html, #rdiscount_version, #redcarpet_to_html, #redcarpet_version, #rpeg_markdown_to_html

Constructor Details

#initialize(lib, mn_to_html, mn_version) ⇒ Converter

Returns a new instance of Converter.



8
9
10
11
12
# File 'lib/markdown/wrapper.rb', line 8

def initialize( lib, mn_to_html, mn_version )
  @lib         = lib
  @mn_to_html  = mn_to_html
  @mn_version  = mn_version
end

Instance Method Details

#convert(text, options = {}) ⇒ Object



14
15
16
17
18
# File 'lib/markdown/wrapper.rb', line 14

def convert( text, options={} )
  # call markdown filter; turn markdown lib name into method_name (mn)
  # eg. rpeg-markdown =>  rpeg_markdown_to_html
  send( @mn_to_html, text, options )  # call 1st configured markdown engine e.g. kramdown_to_html( content )
end

#versionObject



20
21
22
# File 'lib/markdown/wrapper.rb', line 20

def version
  send( @mn_version )  # call 1st configured markdown engine e.g. kramdown_version
end