More XQuery pretty printing
I’ve upgraded the XQuery pretty printer once again. It’s actually surprisingly difficult to get whitespace handling and indentation only close to ‘right’, at least in a language that is syntactically as complex as XQuery.
This version should insert whitespace at the correct places, properly handle long lines in many more cases (before, you’d get long runs of empty lines in some cases), and remove whitespace in other cases.
I’ve also added some options for the curious. You can now display regular HTML, pure HTML with no other tags around it, plain text, indented, the parse tree before formatting, and the HTML before it is run through the indenter. The options are available through the XQuery formatter form, too.