This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Proper HTML List nesting#

The following patch makes <ul> and <ol> nest properly.

Without it, the Test pages has errors in the list section, with it, just the <b> accross <p> intentional error.

Try it at memojo.com.

Note that the templates have further errors that make this page at JSPWiki not compliant.

--SantiagoGala

Of course, this is why we don't use the strict DTD, but the loose DTD :-).

--JanneJalkanen

I think I fount the biggest non-compliance issue lasting (even for Transitional DTD) is that <NOSCRIPT> can only be used in <body>, which seems reasonable, since no user agent should ever show head information. I have taken ages to notice! I just scraped the whole head section from the templates in my tests. --Santiago

Index: src/com/ecyrd/jspwiki/TranslatorReader.java
===================================================================
RCS file: /p/cvs/JSPWiki/src/com/ecyrd/jspwiki/TranslatorReader.java,v
retrieving revision 2.25
diff -i -u -r2.25 TranslatorReader.java
--- src/com/ecyrd/jspwiki/TranslatorReader.java	20 Feb 2003 21:32:18 -0000	2.25
+++ src/com/ecyrd/jspwiki/TranslatorReader.java	23 Feb 2003 20:58:46 -0000
@@ -1227,24 +1227,30 @@
     {
         StringBuffer buf = new StringBuffer();
 
-        if( m_listlevel > 0 )
-        {
-            buf.append("</LI>\n");
-        }
-
         int numBullets = countChars( m_in, '*' ) + 1;        
 
+	/* Opening a nested list */
         if( numBullets > m_listlevel )
         {
             for( ; m_listlevel < numBullets; m_listlevel++ )
-                buf.append("<UL>\n");
-        }
+	    {
+		/* Insert new list */
+		buf.append("<ul>\n");
+			    
+	    }
+        } /* or closing a nested list */
         else if( numBullets < m_listlevel )
         {
             for( ; m_listlevel > numBullets; m_listlevel-- )
-                buf.append("</UL>\n");
+                buf.append("</li></ul>\n");
         }
-                
+	else if( m_listlevel > 0 )
+        {
+	    /* Close current element */
+            buf.append("</li>\n");
+        }
+
+	/*Open a new element */
         buf.append("<LI>");
 
         return buf.toString();
@@ -1255,24 +1261,28 @@
     {
         StringBuffer buf = new StringBuffer();
 
-        if( m_numlistlevel > 0 )
-        {
-            buf.append("</LI>\n");
-        }
-
         int numBullets = countChars( m_in, '#' ) + 1;
                 
         if( numBullets > m_numlistlevel )
         {
             for( ; m_numlistlevel < numBullets; m_numlistlevel++ )
-                buf.append("<OL>\n");
-        }
+            {
+		/* Insert new list */
+		buf.append("<ol>\n");
+	    }
+        } /* or closing a nested list */
         else if( numBullets < m_numlistlevel )
         {
             for( ; m_numlistlevel > numBullets; m_numlistlevel-- )
-                buf.append("</OL>\n");
+                buf.append("</li></ol>\n");
         }
-                
+	else if( m_listlevel > 0 )
+        {
+	    /* Close current element */
+            buf.append("</li>\n");
+        }
+
+	/*Open a new element */
         buf.append("<LI>");
 
         return buf.toString();


Back to Category Patches

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 24-Feb-2003 17:47 by SantiagoGala.