[pmwiki-users] Automatically add anchors to heading tags? pmwiki-users Digest, Vol 25, Issue 50

H. Fox haganfox at users.sourceforge.net
Thu Jul 26 05:02:28 CDT 2007


On 26 Jul 2007 13:05:11 +1200, John Rankin <john.rankin at affinity.co.nz> wrote:
> On Thursday, 26 July 2007 11:47 AM, H. Fox <haganfox at users.sourceforge.net> wrote:
> >On 26 Jul 2007 10:34:35 +1200, John Rankin <john.rankin at affinity.co.nz> wrote:
> >> Turning heading text into an anchor guaranteed to be valid would also need
> >> a bit of care; eg
> >>
> >> !!!Christian Ridderström
> >>
> >> would need to turn the ö into something else,
> >
> >Maybe there's some regular-expression magic that can do that.
>
> The trick I used in the citations recipe was to pass the text
> through the htmlentities function and remove the & and ; from
> the result.

That's a good trick, now noted on the PITS page.

> So no scheme is going to be 100% robust. The question is, what
> level of non-robustness is acceptable?

Perhaps an extremely low level, to the extent that the perfect doesn't
become the enemy of the good.

> How common is this in practice? For general usage, inter-page
> links to specific headings are the exception rather than the
> rule,

Even if that's true intra-page links (to another section in the same
page, that is) would be similarly affected by a built-in link rot
generator.  I use same-page links frequently, on pmwiki.org
especially.

> Just my 10¢ worth.

Well-reasoned and reasonable; we can agree to disagree.  IMHO link rot
should be avoided, or at the very least mitigated to the extent
possible (within reason).

Having a heading's link change so it later points to a different
heading is even worse than having an anchor vanish. (Principle of
Least Surprise and all...)

FWIW, the crc32 solution[1] is a simple number-link possibility that
only seems to fall down on duplicate headings.

Hagan

[1] http://www.pmwiki.org/wiki/PITS/00955#checksum



More information about the pmwiki-users mailing list