public
Description: Haml for Lua
Homepage:
Clone URL: git://github.com/norman/lua-haml.git
norman (author)
Wed Nov 18 13:33:43 -0800 2009
commit  6ab0d5b39c85b425465315010067b5dea9c1abf9
tree    b24a5597ccbb769a36cb09df41bea0bc827d9e0f
parent  e418b822e0a51e2ee3db687d0a01b5151f91a011
name age message
file .gitignore Fri Sep 11 12:21:51 -0700 2009 Added escaped filter and refactored filter api. [norman]
file .gitmodules Thu Sep 17 07:31:57 -0700 2009 Added halm-spec submodule. [norman]
file README.md Wed Nov 18 04:43:16 -0800 2009 Updated README, including new Luarocks installa... [norman]
directory bin/ Thu Sep 17 13:03:42 -0700 2009 Got Ruby renderer mostly working with a reasona... [norman]
file haml.lua Thu Sep 17 12:26:39 -0700 2009 Added support for Ruby-style attributes. Added ... [norman]
directory haml/ Wed Nov 18 13:33:43 -0800 2009 Improved environment handling in renderer. [norman]
file luahaml-scm-1.rockspec Wed Nov 18 13:32:43 -0800 2009 Added explicit dependency on LPeg. [norman]
directory sample_apps/ Mon Sep 07 20:46:22 -0700 2009 Fixed sample app. [norman]
directory spec/ Thu Sep 17 13:03:42 -0700 2009 Got Ruby renderer mostly working with a reasona... [norman]
README.md

Lua Haml

About

Lua Haml is an implementation of the Haml markup language for Lua. Though it is implemented in Lua, its design makes it easily adaptable to almost any language, and it includes an experimental renderer for Haml for Ruby. Lua Haml is "just Haml," with no extending of the original language.

A Haml language reference can be found here.

Lua Haml currently supports the main features of Ruby's Haml, and can be used for real work. However, many of the finer details of the language, some of them important, are still being implemented.

Working features

The following features of Ruby's Haml are working in Lua Haml:

  • Options: format, autoclose, encoding
  • Plain text
  • Escapes
  • HTML elements
  • Ruby-style attributes
  • HTML-style attributes
  • Classes and id's (. and #)
  • Implicit div elements
  • Self-closing tags
  • Doctypes and XML prologs
  • Haml comments
  • Code evaluation
  • Ruby-style string interpolation ("#{var}")
  • Running Lua
  • Lua blocks
  • Whitespace preservation (via filter)
  • Filters: plain, javascript, preserve, escaped, lua, markdown, custom
  • Partial templates. Lua Haml provides a simple default partial implementation, which can be overridden by frameworks as they see fit.
  • HTML comments
  • Conditional comments

To do

The following features of Ruby's Haml are not yet working in Lua Haml:

  • Options: escape_html, suppress_eval, attr_wrapper, preserve
  • Attribute methods
  • Boolean attributes
  • Whitespace removal
  • Whitespace preservation (implicit)
  • Escaping HTML
  • Unescaping HTML
  • Multiline content
  • Helpers

The following features will likely not be implemented in Lua Haml:

  • Object reference

To see an example of what you can do with the currently supported features, view the "currently supported language" template in the spec directory.

I probably won't implement Sass for a while yet, possibly never. However if I do implement it, it will definitely be as a separate project.

Getting it

Install using LuaRocks:

luarocks install luahaml --from=http://luarocks.org/repositories/rocks-cvs/

Don't be put off by the "CVS" in the URL, this will install the latest Lua Haml from the stable branch on Github.

Hacking it

The Github repository is located at:

git://github.com/norman/lua-haml.git

To run the specs, you should also install Telescope:

luarocks install telescope --from=http://luarocks.org/repositories/rocks-cvs/

You can then run them using the ./bin/spec script in the repository.

Bug reports

Please report them on the Github issue tracker.

Author

Norman Clarke

Attributions

Some of the sample files in test/samples were taken from Ruby's Haml.

Thanks

To Hampton Caitlin and Nathan Weizenbaum for their work on the original Haml.

License

The MIT License

Copyright (c) 2009 Norman Clarke

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.