In Files
Parent
Information
Class Index
![show/hide quicksearch [+]](../../assets/icon/find.png)
- Malt
- Malt::Engine
- Malt::Engine::Abstract
- Malt::Engine::BlueCloth
- Malt::Engine::Builder
- Malt::Engine::Erb
- Malt::Engine::Erector
- Malt::Engine::Erubis
- Malt::Engine::Haml
- Malt::Engine::Kramdown
- Malt::Engine::Less
- Malt::Engine::Liquid
- Malt::Engine::Markaby
- Malt::Engine::Mustache
- Malt::Engine::RDiscount
- Malt::Engine::RDoc
- Malt::Engine::Radius
- Malt::Engine::Radius::context;
- Malt::Engine::RagTag
- Malt::Engine::RedCloth
- Malt::Engine::Ruby
- Malt::Engine::Sass
- Malt::Engine::Tenjin
- Malt::Format
- Malt::Format::Abstract
- Malt::Format::AbstractTemplate
- Malt::Format::Builder
- Malt::Format::CSS
- Malt::Format::Erb
- Malt::Format::Erector
- Malt::Format::HTML
- Malt::Format::Haml
- Malt::Format::LESS
- Malt::Format::Latex
- Malt::Format::Liquid
- Malt::Format::Markaby
- Malt::Format::Markdown
- Malt::Format::Mustache
- Malt::Format::PDF
- Malt::Format::RBHTML
- Malt::Format::RDoc
- Malt::Format::RHTML
- Malt::Format::Radius
- Malt::Format::RagTag
- Malt::Format::Ruby
- Malt::Format::SCSS
- Malt::Format::Sass
- Malt::Format::Tenjin
- Malt::Format::Text
- Malt::Format::Textile
- Malt::Format::UnsupportedConversion
- Malt::Format::XML
- Malt::Format::YAML
- Malt::Kernel
- Malt::Machine
- Malt::Markup
- Malt::NoEngineError
- Malt::Template
- Hash
- OpenStruct
Public Instance Methods
render(params, &yld)
click to toggle source
# File lib/malt/engines/builder.rb, line 18
18: def render(params, &yld)
19: into = params[:to]
20: case into
21: when :html, nil
22: render_html(params, &yld)
23: else
24: super(params, &yld)
25: end
26: end
render_html(params={}, &yld)
click to toggle source
TODO: Do we need a make_ivar(data, &yld) method to make data into instance variables for some templates like this one?
# File lib/malt/engines/builder.rb, line 30
30: def render_html(params={}, &yld)
31: text = params[:text]
32: file = params[:file]
33: data = params[:data]
34:
35: data = make_hash(data, &yld)
36: builder = ::Builder::XmlMarkup.new(engine_options(params))
37: data.each{ |k,v| builder.instance_eval("@#{k} = v") }
38: builder.instance_eval(text, file)
39: end
Private Instance Methods
engine_options(params)
click to toggle source
:target=>target_object: Object receiving the markup. target_object must respond to the <<(a_string) operator and return itself. The default target is a plain string target.
:indent=>indentation: Number of spaces used for indentation. The default is no indentation and no line breaks.
:margin=>initial_indentation_level: Amount of initial indentation (specified in levels, not spaces).
# File lib/malt/engines/builder.rb, line 58
58: def engine_options(params)
59: target = params[:target] || settings[:target]
60: indent = params[:indent] || settings[:indent]
61: margin = params[:margin] || settings[:margin]
62: opts = {}
63: opts[:target] = target if target
64: opts[:indent] = indent if indent
65: opts[:margin] = margin if margin
66: opts
67: end
initialize_engine()
click to toggle source
Load Erector library if not already loaded.
# File lib/malt/engines/builder.rb, line 44
44: def initialize_engine
45: return if defined? ::Builder
46: require_library 'builder'
47: end
Disabled; run with --debug to generate this.