lua-users home
lua-l archive

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


On 30 August 2010 08:34, steve donovan <steve.j.donovan@gmail.com> wrote:
> On Sun, Aug 29, 2010 at 8:31 AM, Alexander Gladysh <agladysh@gmail.com> wrote:
>> It is important that each parameter in the resulting string will be on
>> a separate line. This is a surprisingly rare feature for command-line
>> XML pretty-printers I've tried (note that, anyway, I need a Lua
>> module, not a command-line tool).
>
> It doesn't sound like a difficult thing to put together on a rainy
> afternoon (which is how many Lua modules get started ;)) but I'm sure
> it would not make everyone happy, since the desired presentation for a
> piece of XML depends on how you want to view its structure. (E.g.
> compare your desired presentation with XHTML.)   Maybe a
> template-driven approach, or at least heavily customizable.
>
> On a somewhat OT note, it would be cool if luaexpat had a module to
> convert LOM format into string XML output - there would then be the
> same problem of customizing the presentation.
>

We don't use LOM, but something quite like it. We have a serializer
that we've optimised to death, it wouldn't be hard to adapt it for
LOM, or insert linebreaks after attributes. The code starts here:
http://hg.prosody.im/trunk/file/4621c92d2368/util/stanza.lua#l178 and
runs until line 218.

The rest of that module is about creating and manipulating snippets of
XML, some documentation at
http://prosody.im/doc/developers/util/stanza .

Regards,
Matthew