Michal Kwiatkowski <[EMAIL PROTECTED]> wrote Wed, Feb 23, 2005:
> Hi,
>
> I've noticed that elinks doesn't display ordered list properly when
> parsing html code like this:
>
> <html>
> <body>
> <OL>
> <P><LI>First item</P>
> <P><LI>Second item</P>
> <P><LI>Third item</P>
> </OL>
> </body>
> </html>
>
> It shows:
>
> 1. First item
>
> 1. Second item
>
> 1. Third item
>
> Of course html code above is not valid, so it's questionable if elinks
> should support it. Well, it works in firefox, and was found to be used
> on some sites (which are broken, but as a user I would still want to
> browse them properly).
>
> Tested on 0.9.3, 0.10.2 and current cvs sorces. All are affected.
Below is a patch that presents where the problem is. The successive list number
is only updated in the nesting tag, but the code should probably update it all
the way down HTML stack to the parent <ol>-tag.
Index: document/html/parser.c
===================================================================
RCS file: /home/cvs/elinks/elinks/src/document/html/parser.c,v
retrieving revision 1.519
diff -u -d -p -r1.519 parser.c
--- document/html/parser.c 28 Jan 2005 14:56:44 -0000 1.519
+++ document/html/parser.c 23 Feb 2005 22:21:59 -0000
@@ -950,6 +950,15 @@ html_li(unsigned char *a)
par_format.leftmargin += nlen + c + 2;
par_format.align = ALIGN_LEFT;
html_top.next->parattr.list_number = par_format.list_number + 1;
+
+ {
+ struct html_element *element;
+
+ element = search_html_stack("ol");
+ if (element)
+ element->parattr.list_number =
par_format.list_number + 1;
+ }
+
par_format.list_number = 0;
}
--
Jonas Fonseca
_______________________________________________
elinks-users mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-users