Tiddler IDs are a composed of the tiddler name and the "tiddler" prefix.
Tiddler names containing spaces are not be converted in any way, which
means the resulting ID is invalid*.
What's to stop us from converting those spaces to, say, underscores
(MediaWiki does that for page names)?
I can't think of any negative consequences resulting from such a
change - but then, I might be missing something!?
(Even if some odd user had both a "foo bar" and a "foo_bar" tiddler,
that wouldn't really cause any problems for regular users.)
By the way: If/When this is solved, we could also assign IDs as anchors
to content headings, with the ID being a combination of the tiddler ID
and the (converted) heading text:
<h1 id="tiddlerFoo_Bar_headingBar_Baz">Bar Baz</h1>
This way we could link to HREF="TW.html#tiddlerFoo_Bar_headingBar_Baz".
-- F.
I only realised the issue much later on (actually when experimenting
with the ID-based CSS selectors), and by that time there was already a
significant user base. We could have escaped the tiddler titles, but
it seemed like another nail in backwards compatibility for little
practical benefit.
So the situation at the moment is that everything works, apart from
trying to use tiddler IDs in CSS selectors - if you want to do that,
you have to make sure that the tiddler name doesn't contain spaces.
Hope that helps,
Cheers
Jeremy
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
Yes, but there's a huge number of cruel things browsers will allow you
to do - that doesn't mean you should take advantage of such leniency
though, not if you can avoid it...
(Sorry to be a PitA here, but I can't help it.)
> So the situation at the moment is that everything works, apart from
> trying to use tiddler IDs in CSS selectors - if you want to do that,
> you have to make sure that the tiddler name doesn't contain spaces.
That's exactly the problem.
Disregarding my obsession with standard compliance, it's still very
confusing from a regular user's perspective that the CSS selector works
for some tiddlers but not for others.
So why not simply convert spaces to underscores in tiddler IDs?
That fully preserves backwards compatibility and does no harm.
...
...
Or maybe it does? I've tried patching
Story.prototype.createTiddler
by changing
var tiddlerElem = createTiddlyElement(null,"div",
this.idPrefix + title,"tiddler");
to
var tiddlerTitle = this.idPrefix + title.replace(/\s/,"_");
var tiddlerElem = createTiddlyElement(null,"div",
tiddlerTitle,"tiddler");
But for some odd reason that breaks the newTiddler macro.
Update: It also breaks when trying to open a tiddler with spaces in its
name; still not sure why though.
-- F.
You can always ship a LegacyTiddlerIdsPlugin..
;D
--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)
That will work too if you escape the space character:
#tiddlerNew\0020Tiddler { /* ... */ }
Cheers,
Andrew
Wow, I/we had no idea!
Thanks for sharing (bonus points for your updating the wiki!).
-- F.