[dokuwiki] Re: invalid anchors

  • From: Anika Henke <a.c.henke@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 08 Feb 2006 23:47:21 +0100

Andreas Gohr wrote:

On Tue, 07 Feb 2006 19:23:54 +0000
Chris Smith <chris@xxxxxxxxxxxxx> wrote:


Great work so far on bring dokwiki's xhtml into line. :-)
Thanks! :-)


I'd be inclined to go further to prevent non-unique ids.

e.g.

hd1_2_ways_to_do_it_better
hd2_1st_way
hd3_2nd_way
hd4_3_more_ways_to_do_it_better
hd5_1st_way
hd6_2nd_way


hmm I don't like that. I want section ids as simple as possible to make
linking to them simple. And I want to keep section links as steady as
possible even when restructuring a document. I know this isn't
completely possible...

I don't like making the anchors a bit less usable either. But I think it is just necessary. And don't forget that a clever editor could always avoid double headlines all by himself.


An anchor structure like the above one is not very handy when you want to link from other pages to a page that is probably often edited. That links would often be pointing to non-existant anchors, because the structure has changed.
So, I think it may be best keeping it like it is -- with the addition of treating anchors of double headlines (and headlines beginning with a digit) specially. Maybe simply like the proposed structure below: by adding a number ...



I though about it some time ago. I think it should work like this. When the same headline is used multiple times then I'd like the following ids:

headline
headline1
headline2

This makes sure headlines and ids still match in most cases and existing
links do not break. As long as the headlines are not duplicated in one
document you can move them around and change their level without
breaking any links.


Why do you only want to change the ids and not the names? By not changing the names, existing links are already broken! (Eg. with headlines "test" and "test" again, the link to the second anchor is definitly broken, because links to both anchors refer both to the first one found in the document.)



Perhaps even allowing the renderer to have a prefix specified, to
allow  web pages with multiple wiki pages (e.g. sidebars or includes)
to avoid  id collisions.


Hmm yes this could make sense. Using no prefix for the usual pages and
adding one for sidebars...

I had a look at how to implement all this but something was more
complicated than I first thought so I didn't do it right away.
Unfortunately I can't remember the problem :-(

Well for the problem of headings starting with digits... Hmm which chars
are allowed at start of an id?

Maybe we could add an underscore:

_3_ways_to_do_it

Sorry, but underscores are not allowed for names/ids to begin with as well:
<cite>
ID and NAME must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
</cite>



Anika

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: