Ticket #472 (closed defect: fixed)
rendered XHTML is pretty-printed but should not
Description
Pretty-printing the XHTML rendered by JOMDoc is harmful. Consider nested inline markup like
<span class="a">This is <span class="b">cool</span></span>!
This is perfectly legal HTML, which frequently occurs in GenCS. JOMDoc outputs it pretty-printed with indentation, leading to sth. like
<span class="a">This is <span class="b">cool</span> </span>!
which in HTML renders as "This is cool !", as span is inline markup and not block markup, i.e. whitespace between tags counts as one space.
For now, Slava hacked his TNTBase variant of JOMDoc like this:
Index: src/jomdoc/org/omdoc/jomdoc/util/xml/XMLUtil.java
===================================================================
--- src/jomdoc/org/omdoc/jomdoc/util/xml/XMLUtil.java (revision 963)
+++ src/jomdoc/org/omdoc/jomdoc/util/xml/XMLUtil.java (working copy)
@@ -226,7 +226,7 @@
*/
public static void serialize(Document xomDocument, OutputStream os) throws IOException {
nu.xom.Serializer serializer = new nu.xom.Serializer(os);
- serializer.setIndent(2);
+ serializer.setIndent(0);
serializer.write(xomDocument);
}
I could imagine the following proper solution: Pretty-printing will never be needed for production output. But it will be needed for debugging. So I'd say when the "verbose" (debug) mode is on, then JOMDoc should pretty-print. Or maybe pretty-printing or not should even be a separate option to configure.
