projects
/
org.ibex.core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6e071bf
)
2002/08/10 23:36:31
author
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 06:49:59 +0000
(06:49 +0000)
committer
megacz
<megacz@xwt.org>
Fri, 30 Jan 2004 06:49:59 +0000
(06:49 +0000)
darcs-hash:
20040130064959
-2ba56-
c56554d8d9871f8bfe57c31c61536363cc13f4f8
.gz
CHANGES
patch
|
blob
|
history
src/org/xwt/HTML.java
patch
|
blob
|
history
diff --git
a/CHANGES
b/CHANGES
index
e93b512
..
9321416
100644
(file)
--- a/
CHANGES
+++ b/
CHANGES
@@
-358,4
+358,6
@@
09-Aug megacz Win32.java, Win32.cc: hack to avoid strange race condition in Win32 GDI
09-Aug megacz Win32.java, Win32.cc: hack to avoid strange race condition in Win32 GDI
+10-Aug megacz HTML.java, html.xwt: fixed HTML widget to handle unclosed <li> tags
+
diff --git
a/src/org/xwt/HTML.java
b/src/org/xwt/HTML.java
index
b04b9d1
..
8d36a10
100644
(file)
--- a/
src/org/xwt/HTML.java
+++ b/
src/org/xwt/HTML.java
@@
-20,8
+20,6
@@
import java.io.*;
http://www.htmlhelp.com/reference/html40/entities/special.html
http://www.htmlhelp.com/reference/html40/entities/symbols.html
http://www.htmlhelp.com/reference/html40/entities/latin1.html
http://www.htmlhelp.com/reference/html40/entities/special.html
http://www.htmlhelp.com/reference/html40/entities/symbols.html
http://www.htmlhelp.com/reference/html40/entities/latin1.html
-
- FIXME FIXME FIXME: <li> tags close enclosing <li> tags
*/
/**
*/
/**
@@
-47,10
+45,14
@@
public class HTML {
/** we keep a StringBuffer around for use by removeRedundantWhitespace() */
private static StringBuffer sbuf = null;
/** we keep a StringBuffer around for use by removeRedundantWhitespace() */
private static StringBuffer sbuf = null;
+ /** true iff we have encountered an LI more recently than the last OL/UL */
+ private static boolean withinLI = false;
+
public static synchronized JSObject parseReader(Reader r) throws IOException {
CharStream cs = new CharStream(r);
JSObject h = new JSObject();
public static synchronized JSObject parseReader(Reader r) throws IOException {
CharStream cs = new CharStream(r);
JSObject h = new JSObject();
+ withinLI = false;
h.put("$name", "html");
try {
h.put("$name", "html");
try {
@@
-84,6
+86,19
@@
public class HTML {
while(Character.isSpace(cs.peek())) cs.get();
String elementName = parseElementName(cs);
while(Character.isSpace(cs.peek())) cs.get();
String elementName = parseElementName(cs);
+ // FIXME: this might not deal correctly with EOFExceptions
+ boolean saveWithinLI = withinLI;
+ if (elementName.equals("li")) {
+ if (withinLI) {
+ cs.unread(new char[] { '<', 'l', 'i', ' ' });
+ return "li";
+ } else {
+ withinLI = true;
+ }
+ } else if (elementName.equals("ol") || elementName.equals("ul")) {
+ withinLI = false;
+ }
+
h.put("$name", elementName);
if (elementName.equals("!--")) {
h.put("0", parseComment(cs));
h.put("$name", elementName);
if (elementName.equals("!--")) {
h.put("0", parseComment(cs));
@@
-108,7
+123,9
@@
public class HTML {
return null;
// scan body
return null;
// scan body
- return parseBody(cs, h, elementName);
+ String ret = parseBody(cs, h, elementName);
+ withinLI = saveWithinLI;
+ return ret;
}
/**
}
/**
@@
-304,7
+321,7
@@
public class HTML {
// CharStream /////////////////////////////////////////////////////////////////////
private static class CharStream extends PushbackReader {
// CharStream /////////////////////////////////////////////////////////////////////
private static class CharStream extends PushbackReader {
- public CharStream(Reader r) { super(r); }
+ public CharStream(Reader r) { super(r, 1024); }
public char peek() throws IOException {
char c = get();
public char peek() throws IOException {
char c = get();