The HTML whitespace handling is haunting me. Now it is whitespace after
block-like tags (like p, h1 etc, but _not_ b i etc) that needs to be
consumed be the parser. Makes the JAPI pages render a little better.
2006-11-15 Roman Kennke <[EMAIL PROTECTED]>
* gnu/javax/swing/text/html/parser/support/Parser.java
(_handleEndTag_remaining): Consume whitespace after a closing
block like tag.
/Roman
Index: gnu/javax/swing/text/html/parser/support/Parser.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/javax/swing/text/html/parser/support/Parser.java,v
retrieving revision 1.11
diff -u -1 -5 -r1.11 Parser.java
--- gnu/javax/swing/text/html/parser/support/Parser.java 15 Nov 2006 13:35:09 -0000 1.11
+++ gnu/javax/swing/text/html/parser/support/Parser.java 15 Nov 2006 21:42:30 -0000
@@ -1209,30 +1209,35 @@
* initiated by the tag validator.
* Package-private to avoid an accessor method.
*/
void _handleEndTag_remaining(TagElement tag)
{
HTML.Tag h = tag.getHTMLTag();
handleEndTag(tag);
endTag(tag.fictional());
if (h.isPreformatted())
preformatted--;
if (preformatted < 0)
preformatted = 0;
+ // When a block tag is closed, consume whitespace that follows after
+ // it.
+ if (h.isBlock())
+ optional(WS);
+
if (h == HTML.Tag.TITLE)
{
titleOpen = false;
titleHandled = true;
char[] a = new char[ title.length() ];
title.getChars(0, a.length, a, 0);
handleTitle(a);
}
}
/**
* A hooks for operations, preceeding call to handleStartTag().
* The method is called when the HTML opening tag ((like <table>)
* is found.