lapis
lapis copied to clipboard
Layouts and widgets documentation for Lua is missing
At http://leafo.net/lapis/reference/html_generation.html#layouts there's only the Moonscript part.
I don't understand how to build a widget in plain Lua, or where does content_for()
look for content. I've tried adding .lua
and .etlua
files into the views directory with no success.
(Also, is there a mail list or some kind of place for Q/A? Using GitHub issues feels wrong, and I tried #moonscript at FreeNode, but there are not many users in there...)
content_for has the dual purpose of creating content and printing out content.
in your main layout you have something like
content_for "outer"
and in your sublayouts, you have something like (but in Lua, not in moon)
@content_for "outer", ->
h1 "hello world"
No idea what to do with etlua, but I imagine you'd just put it in a <% %>
. I don't use etlua.
Widgets are unrelated to content_for
. In the content of html generation you can use:
follow_user = require "widgets.follow_user"
widget(follow_user)
to render the the follow_user
widget.
Sorry if the examples weren't very helpful - I only use MoonScript with lapis.
(leafo has mentioned that for now #moonscript is the only place to get help. it is pretty quiet but you'll get an answer in ~12 hours. afaik, iirc, he has no plans for a forum style thing. indeed GitHub issues for support are counter-intuitive and break the system.)
I just use return {render = true, layout = false}
with etlua template like this:
<% render'views.header' %> --with HTML and HEAD tags
<% render'views.footer' %>
I`m not sure if using html builder with lua make sense.