astxml2wiki: improve application syntax formatting

This patch improves application formatting to better handle optional
parameters, their separators, and argument parsing. Due to the "quirky"
schema our documentation uses, and the silly ordering of our mandatory
and non-mandatory parameters, this has gotten quite complex.

That aside, the parsing should now be able to handle:

required,[optional,[optional]]

[optional,[optional,]]required

required(argument:[argument[...]]),[optional]

And other silly things.

There are probably still applications that cannot be formatted correctly
even with this patch. Asterisk has had ridiculously loose guidelines about
required/optional parameter ordering, arguments, and other such nicities.
Because the same content and schema is used to format both the syntax of
the command as well as its full documentation, templating cannot be used
for both.

We may want to consider separating out these actions and producing separate
documents.