lua-haml

lua-haml update base on https://github.com/norman/lua-haml

Stars
5

Lua Haml

About

Lua Haml is an implementation of the Haml markup language for Lua.

A Haml language reference can be found here.

A basic haml tutorial can be found here

This repository is modified version of here

Lua Haml implements almost 100% of Ruby Haml, and attempts to be as compatible as possible with it, with the following exceptions:

  • Your script blocks are in Lua rather than Ruby, obviously.
  • A few Ruby-specific filters are not implemented,
    namely :maruku, :ruby and :sass.
  • No attribute methods. This feature would have to be added to Ruby-style
    attributes, which are discouraged in Lua-Haml, or the creation of a
    Lua-specific attribute format, which I don't want to add.
  • No object reference. This feature is idiomatic to the Rails framework and
    doesn't really apply to Lua.
  • No ugly mode. Because of how Lua Haml is designed, there's no performance
    penalty for outputting indented code, so there's no reason to implement this
    option.

Here's a Haml template that uses most of Lua Haml's features.

TODO

Lua Haml is now feature complete, but is still considered beta quality. That said, I am using it for a production website, and will work quickly to fix any bugs that are reported. So please feel free to use it for serious work, just not the Space Shuttle, ok? And very welcome any patch.

Hacking it

Before run the specification test, you need to install lpeg module and json modules

To run test, do this:

lua test.lua

To convert haml to html, do this:

lua bin/luahaml sample.haml > sample.html

To run bench, do this:

lua bench.lua sample.haml 10000

Bug reports

Please report them on the Issues Tracker.

Author

Norman Clarke

George Zhao

Thanks

To Hampton Caitlin, Nathan Weizenbaum and Chris Eppstein for their work on the original Haml. Thanks also to Daniele Alessandri for being LuaHaml's earliest "real" user, and a source of constant encouragement.

License

The MIT License

Copyright (c) 2009-2010 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.