lua-users home
lua-l archive

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


On Tue, Jul 3, 2012 at 8:25 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> The other way would be nice too.  XML is so verbose …
> I could not find anything either on the wiki or by googling.
>    macro {name="author-short",
>      names{variable="author",'name form="short"'} }

Something like that is possible with pl.xml, with the following declarations:

local xml = require 'pl.xml'

local macro, names = xml.tags 'macro,names'

It's originally inspired by Orbit's 'htmlification', but doesn't use
fancy function-environment tricks, which have the disadvantage of not
checking the spelling of tags.  It's easier to debug Lua than XML, so
the tag constructors need to be declared here.

steve d.


[1] http://stevedonovan.github.com/Penlight/api/topics/06-data.md.html#XML