Class: Malt::Engine::WikiCloth

Inherits:
Abstract show all
Defined in:
lib/malt/engines/wikicloth.rb

Overview

WikiCloth is a MediaWiki format for Ruby. Unlike Creole, WikiCloth also supports variable interpolation.

Instance Attribute Summary

Attributes inherited from Abstract

#settings

Instance Method Summary collapse

Methods inherited from Abstract

#cache?, default, #initialize, #prepare_engine, register, type

Constructor Details

This class inherits a constructor from Malt::Engine::Abstract

Instance Method Details

#create_engine(params = {}) ⇒ Object


29
30
31
32
33
34
35
# File 'lib/malt/engines/wikicloth.rb', line 29

def create_engine(params={})
  text = parameters(params, :text)

  cached(text) do
    ::WikiCloth::WikiCloth.new(:data => text)
  end
end

#render(params = {}, &content) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/malt/engines/wikicloth.rb', line 15

def render(params={}, &content)
  scope, locals = parameters(params, :scope, :locals)

  data = make_hash(scope, locals, &content)

  case params[:to]
  when :html, nil
    prepare_engine(params).to_html(:params => data)
  else
    super(params)
  end
end