(Still being actively developed)
Simple Example:
alml = Alml::Engine.new template_text alml.render { |script_name, script_index| "I return the rendered content of #{script_name}<br/>\n" }
Advanced Example, handling the :auto script keyword:
alml = Alml::Engine.new template_text script_order_map = alml.script_map(unordered_app_array) { |app, script_name| app.name == script_param } alml.render do |script_name, script_index| script_order_map[script_index].collect { |app| "I return the rendered content of #{app.name}<br/>\n" }.join('\n') end
! - Single Line Comment # - Div with id . - Div with class name @ - Dynamic content to be rendered by block (sends following command as block parameter)
! Start Header #header.foo.bar .ring .outer .inside .lining @header-and-logo ! Start Nav #navigation .container .inside @navigation ! Start Content #content .inside #liquid .lining @:auto ! Start Footer #footer .outside .inside @footer-navigation @footer-logo
To enable the library your Rails 2.1 (or greater) project, use the gem configuration method in “config/environment.rb
”
Rails::Initializer.run do |config| config.gem 'thrivesmart-alml_engine', :lib => 'alml_engine', :source => 'http://gems.github.com' end
The :lib
is important, because rails gets confused when the name of the gem is different from the library.
And of course, run
rake gems:install
To get them installed on your system.
Optionally, to unpack it into your application, just run:
rake gems:unpack GEM=thrivesmart-alml_engine
Copyright © 2008 ThriveSmart, LLC, released under the MIT license