You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are comments in the code, if that's what you're asking :)
No, they're not LuaDoc-compatible (don't let the --- comments fool you :P).
I haven't decided which documentation generator to use yet. LuaDoc doesn't
render the docs the way I like, and I don't know what else is out there, so
I made my own markup for now.
Testing
telescope looked nice, so I converted the mustache specs to telescope
tests. tsc is expected to be called from the test directory.
Usage
The comment on the render function should tell you the nitty-gritty, but
for the TL;DR crowd:
groucho exports a function render, which takes a template
(a string) and a context (a table), as in the example below:
localresult=groucho.render(
'lorem ipsum {{fill}} yadda yadda {{{yadda}}}{{&nonexistent}}', -- the template
{ fill='<forgot what should go here>', yadda='<random key mash>' }) -- the context
Optionally, it may take a configuration table as an extra parameter:
localresult=groucho.render(
'lorem ipsum {{fill}} yadda yadda {{{yadda}}}{{&nonexistent}}', -- the template
{ fill='<forgot what should go here>',
yadda='<random key mash>' }, -- the context
{ template_path='../',
template_extension='mustache' }) -- the configuration table
The result is the template with its variables resolved against the context.
groucho also exports the re grammar (called grammar, appropriately
enough), which has some hooks which need to be filled for the pattern to be
constructed. They are also comment-documented.
To do
Set delimiters
What to do with the documentation?
Why?
To be honest, I just wanted an excuse to fool around with re :)