Analysis of underline formatting bug

2 views
Skip to first unread message

Martin Budden

unread,
May 14, 2006, 3:47:48 PM5/14/06
to TiddlyWikiDev
Luke Blanshard was correct in his suggestion that counting an underline
character as a lowercase letter is connected with this bug.

Here's why: if, when subwikifying the text between the starting and
terminating double underscores, a match for a WikiWord is found, then
the terminating underscores are eaten by the "wikiLink" matcher and so
are never received by the "underlineByChar" matcher.

The text __Wiki__Word__ makes this more obvious than the text __DOS__.

1) The easiest way to fix this is to remove the underscore from
config.textPrimitives.lowerLetter and config.textPrimitives.anyLetter.
This will have the effect that words containing underscores will not be
matched as WikiLinks. I think this is acceptable because:

a) CamelCase and words_separated_by_underscores are generally used as
alternatives, not together.
b) I know of at least one other Wiki (TWiki) that has the same
behavior.
c) If a user really wants a WikiLink with underscores, they can use the
[[..]] notation
d) I think that TiddlyWikis rarely use underscores in WikiLinks (I
don't recall seeing any) so very few users will be affected.
e) alternate fixes are problematic.

So what are the alternative fixes. Two come to mind

2) Setting a flag in the "underlineByChar" matcher and checking the
value of that flag in the "wikiLink" matcher. This is just horrible.
3) Using a character other than underscore for the "underlineByChar"
matcher. This is a bigger compatibility break than (1).

Jeremy Ruston

unread,
May 18, 2006, 9:03:02 AM5/18/06
to Tiddly...@googlegroups.com
Hmmm, that's right, I think: it should probably never have counted
underscore as a lowercase letter. Hey ho.

There's a bug ticket for this here:

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

Cheers

Jeremy


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

Reply all
Reply to author
Forward
0 new messages