lua-users home
lua-l archive

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


Hi, list!

For my in-house documentation generator tool I need to be able to
pretty-print XML and JSON data (both of which I receive as a string
with a single line, no line breaks or extra spaces).

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).

Input:

    <foo bar="bar1" baz="baz1" />
    { foo: { bar: "bar1", baz: "baz1" } }

Output:

    <foo
        bar="bar1"
        baz="baz1"
      />

    { foo: {
       bar: "bar1"
       baz: "baz1"
    } }

Another requirement is that the both modules should be installable
with LuaRocks — but I may write rockspecks myself.

Do you know a module that will do what I want?

Alexander.