lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello, I was looking at this ruby library:

http://hammer.pitr.ch/2011/05/11/HammerBuilder-introduction/

In which you can do things like:

HammerBuilder::Formated.get.go_in do
  xhtml5!
  html do
    head { title 'my_page' }
    body do
      div :id => 'content' do
        p "my page's content", :class => 'centered'
      end
    end
  end
end.to_xhtml! # =>

I started to think this could be written more succinctly in lua:

local t = {
  xhtml5,
  html {
    head { title {'my_page'} },
    body { id='content',
      p { class='centered', "my page's content"}
    }
  }
}

It does not look that bad, does it? Here is some quick and dirty code
to render that template:

http://pastie.org/1893384

I'm wondering if there is already a lua project that handles a
template like in the example above.

I think writing a web application templates in the way outlined in
that example could be a viable option. What do you think?








--------------------------------------------------------------
EmmanuelOga.com - Software Developer