[bug] nested lists: non-valid HTML?

32 views
Skip to first unread message

FND

unread,
Feb 18, 2007, 7:58:13 AM2/18/07
to Tiddl...@googlegroups.com
Hey all,

While trying to make nested lists collapse/expand when hovering (no JS,
just pure CSS), I noticed that TiddlyWiki seems not to handle nested
lists correctly. Some testing has lead me to believe that the following:
* level 1
** level 2
is translated into this HTML code:
<ul>
<li>level 1, item 1</li>
<ul>
<li>level 1, item 1</li>
</ul>
</ul>
However, correct would be the following:
<ul>
<li>level 1, item 1
<ul>
<li>level 1, item 1</li>
</ul>
</li>
</ul>
(notice how the "level 1" LI now properly surrounds the nested UL)

My problem with this is that I can't use "LI UL" as selector, but have
to use "UL UL" instead. That in turn means that all nested items will
expand at the same time when hovering, which is less than optimal...

Is this something that would take a lot of effort to fix, due to some
parsing issues? Or has it simply been overlooked before?


-- F.

Jeremy Ruston

unread,
Feb 18, 2007, 8:18:29 AM2/18/07
to Tiddl...@googlegroups.com
Yup, that's an oversight on my part:

http://trac.tiddlywiki.org/tiddlywiki/ticket/302

I'd never noticed this problem; sometimes it's a shame that browsers
are so good at rendering incorrect HTML :-)

Cheers

Jeremy


--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com

FND

unread,
Feb 18, 2007, 8:23:41 AM2/18/07
to Tiddl...@googlegroups.com
Wow, that was quick!

> Yup, that's an oversight on my part

Can you say whether it'd be hard to fix? (As I've said, I'm afraid it
might be a complex parser issue - though I'm totally ignorant... )

> I'd never noticed this problem; sometimes it's a shame that browsers
> are so good at rendering incorrect HTML :-)

Worse: Some browsers will ONLY render incorrect HTML *cough*IE*cough* ;)


-- F.

Daniel Baird

unread,
Feb 18, 2007, 6:35:08 PM2/18/07
to Tiddl...@googlegroups.com
i would guess it's a matter of getting the regular expressions right
in the wikifier.. which would probably be easy to do to the point
where it *looks* like it works, but fiendishly difficult to make it
work correctly in all situations.

I nominate Martin! :)


--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)

Jeremy Ruston

unread,
Feb 19, 2007, 4:44:33 AM2/19/07
to Tiddl...@googlegroups.com
> I nominate Martin! :)

Yeah, I also thought this was a Martin shaped fix (I wrote the
original code, but that wikifier code is the kind of code you can wake
up to and not recognise at all).

Cheers

Jeremy

> On 18/02/07, FND <Ace_...@gmx.net> wrote:
> >
> > Wow, that was quick!
> >
> > > Yup, that's an oversight on my part
> >
> > Can you say whether it'd be hard to fix? (As I've said, I'm afraid it
> > might be a complex parser issue - though I'm totally ignorant... )
> >
> > > I'd never noticed this problem; sometimes it's a shame that browsers
> > > are so good at rendering incorrect HTML :-)
> >
> > Worse: Some browsers will ONLY render incorrect HTML *cough*IE*cough* ;)
> >
> >
> > -- F.
> >
> > >
> >
>
>
> --
> Daniel Baird
> http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
> http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
> Things That Suck)
>
> >
>

FND

unread,
Feb 19, 2007, 9:02:46 AM2/19/07
to Tiddl...@googlegroups.com
>> I nominate Martin! :)
>
> Yeah, I also thought this was a Martin shaped fix (I wrote the
> original code, but that wikifier code is the kind of code you can wake
> up to and not recognise at all).

Hehe - though I assume this means it won't be fixed anytime soon?!

I've tried looking into it myself, but I failed miserably. :/
Too bad, because it's really a downer for my collapsing/expanding of
nested lists...


-- F.

FND

unread,
Feb 19, 2007, 9:03:06 AM2/19/07
to Tiddl...@googlegroups.com
>> I nominate Martin! :)
>
> Yeah, I also thought this was a Martin shaped fix (I wrote the
> original code, but that wikifier code is the kind of code you can wake
> up to and not recognise at all).

Hehe - though I assume this means it won't be fixed anytime soon?!

Jeremy Ruston

unread,
Feb 19, 2007, 9:07:34 AM2/19/07
to Tiddl...@googlegroups.com
It'll get fixed as soon as we can; Martin and I are both really maxed
out on the next 2.2 beta at the moment.

Cheers

Jeremy

FND

unread,
Feb 19, 2007, 9:12:36 AM2/19/07
to Tiddl...@googlegroups.com
> It'll get fixed as soon as we can; Martin and I are both really maxed
> out on the next 2.2 beta at the moment.

Sorry, I didn't mean to pressure you...
TW 2.2 definitely has priority over such minor issues.


-- F.

Samuel Reynolds

unread,
Feb 19, 2007, 9:52:47 AM2/19/07
to Tiddl...@googlegroups.com
At 04:35 PM 2/18/2007, you wrote:
>i would guess it's a matter of getting the regular expressions right
>in the wikifier.. which would probably be easy to do to the point
>where it *looks* like it works, but fiendishly difficult to make it
>work correctly in all situations.

Every wiki I've every worked with has similar problems,
and the reason is similar: they use regular expressions
to process the markup instead of a true parser. This one
may be fixable by tweaking the REs, but this approach
always suffers from edge cases. (On the other hand, I
don't consider nested lists an edge case.)

- Sam


Udo Borkowski

unread,
Feb 19, 2007, 10:39:06 AM2/19/07
to Tiddl...@googlegroups.com
Every wiki I've every worked with has similar problems,
and the reason is similar: they use regular expressions
to process the markup instead of a true parser.

Notice that while TiddlyWiki uses regular expressions intensively it does no solely rely on REs to process the markup. Just using REs wouldn't allow handle nested structures (like the nested list) anyhow. In fact the "true parser" you are looking for is embedded in the various "wikify" code, implementing a variation of an "recursive descendant parser".

I doubt the problem reported is related to any regular expression problem (in contrast to what Daniel assumes) but it is just an error how the DOM tree is constructed. I.e. the ULs nested in the the LI are appended to the children of LI's parent rather than to the children of the LI element itself.


Udo

----------
Udo Borkowski
http://www.abego-software.de


Samuel Reynolds

unread,
Feb 19, 2007, 12:34:56 PM2/19/07
to Tiddl...@googlegroups.com
At 08:39 AM 2/19/2007, you wrote:
>Every wiki I've every worked with has similar problems,
>and the reason is similar: they use regular expressions
>to process the markup instead of a true parser.
>
>
>Notice that while TiddlyWiki uses regular expressions intensively it
>does no solely rely on REs to process the markup. Just using REs
>wouldn't allow handle nested structures (like the nested list)
>anyhow. In fact the "true parser" you are looking for is embedded in
>the various "wikify" code, implementing a variation of an "recursive
>descendant parser".
>
>I doubt the problem reported is related to any regular expression
>problem (in contrast to what Daniel assumes) but it is just an error
>how the DOM tree is constructed. I.e. the ULs nested in the the LI
>are appended to the children of LI's parent rather than to the
>children of the LI element itself.
>
>
>Udo

My mistake, then. Sounds like TW does it right.

- Sam


Martin Budden

unread,
Feb 19, 2007, 8:11:37 PM2/19/07
to TiddlyWiki
Yes, it looks like something I should fix. It will have to wait until
2.3 though - the adaptors are the big thing that need finishing for
2.2

(I have a few other enhancements planned for the wikifiers for 2.3 as
well.)

Martin

On 18 Feb, 23:35, "Daniel Baird" <danielba...@gmail.com> wrote:
> i would guess it's a matter of getting the regular expressions right
> in the wikifier.. which would probably be easy to do to the point
> where it *looks* like it works, but fiendishly difficult to make it
> work correctly in all situations.
>
> I nominate Martin! :)
>

> On 18/02/07, FND <Ace_No...@gmx.net> wrote:
>
>
>
>
>
> > Wow, that was quick!
>
> > > Yup, that's an oversight on my part
>
> > Can you say whether it'd be hard to fix? (As I've said, I'm afraid it
> > might be a complex parser issue - though I'm totally ignorant... )
>
> > > I'd never noticed this problem; sometimes it's a shame that browsers
> > > are so good at rendering incorrect HTML :-)
>
> > Worse: Some browsers will ONLY render incorrect HTML *cough*IE*cough* ;)
>
> > -- F.
>
> --

> Daniel Bairdhttp://tiddlyspot.com(free, effortless TiddlyWiki hosting)http://danielbaird.com(TiddlyW;nks! :: Whiteboard Koala :: Blog ::
> Things That Suck)

FND

unread,
Apr 14, 2007, 8:02:57 AM4/14/07
to Tiddl...@googlegroups.com
Quick update, for posterity:
The ticket URL is now http://trac.tiddlywiki.org/ticket/302

Also, I've noticed that other block elements cannot be nested in lists;
e.g. the following code will re-start numbering after the blockquote:
# item 1
<<<
blockquote
<<<
# item 2
I assume that's hard to do because there are no closing tags in the wiki
syntax for list items. I guess this could only be fixed by adding a
starting and closing tag for the list as a whole, like this:
regular text
****
# item 1
<<<
blockquote
<<<
# item 2
****
regular text
Not sure whether it's worth the effort though...


-- F.

Reply all
Reply to author
Forward
0 new messages