Class: Jekyll::ConvertifyBlock

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll-convertify/tags.rb

Constant Summary collapse

@@pattern =
/\A\s*from\s*(\S+)\s*(?:to\s*(\S+)\s*\Z)?/

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ ConvertifyBlock

Returns a new instance of ConvertifyBlock.

Raises:

  • (Liquid::Error)


13
14
15
16
17
18
19
# File 'lib/jekyll-convertify/tags.rb', line 13

def initialize(tag_name, markup, tokens)
  super
  match_data = @@pattern.match(markup)
  raise Liquid::Error, "Expected {% #{tag_name} from .<SRC> [to .<DEST>] %}" unless match_data
  @src_ext = match_data.captures[0]
  @dst_ext = match_data.captures[1]
end

Instance Method Details

#render(context) ⇒ Object



21
22
23
# File 'lib/jekyll-convertify/tags.rb', line 21

def render(context)
  Convertify.convert(context, lambda { super }, @src_ext, @dst_ext)
end