New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists

Item1448: Change of the handling of unique anchor names in TOC

Priority: Normal
Current State: Closed
Released In: 1.1.0
Target Release: minor
Applies To: Engine
Reported By: CrawfordCurrie
Waiting For:
Last Change By: KennethLavrsen
The handling of unique anchor names is currently rather obscure (bit of a hack job, AFAICT)

Unique anchor names are generated in the context of a topic. But all unique anchor names are cleared whenever a new TOC macro is processed. That means that an anchor generated outside the context of a TOC in an included topic will be lost. Yuck.

Simple enough to re-code to make anchor name contexts specific to the topic being processed. And anchor names should be session specific.

-- CrawfordCurrie - 14 Apr 2009

Recoded anchor names to use a reversible encoding, and moved the rather sad old code into the Compatibility module. The compatibility mode is controlled by a configurations setting, {RequireCompatibleAnchors}, which should be off for new installs and only enabled on old installs that require slavish compatibility with old format anchors. This requires to be highlighted in the release notes. There were very few existing unit tests for the anchor format, so I can't be 100% sure I got it right, but I did my best.

-- CrawfordCurrie - 15 Apr 2009

Do we really need yet another configuration setting? How much do we gain by this, compared to the relative loss of some anchor links?

-- ArthurClemens - 15 Apr 2009

Yes, I think so. The old scheme was broken in several different ways:
  1. It was about 50 lines of code more complicated than it needed to be
  2. It was not a reversible encoding, and collapsed repeated characters too much. There was a fairly high probability of a clash between anchors.
  3. The encoding was not reversible, so given an anchor it was impossible to find the target inside the topic text. When you are trying to use REST references to anchors within topics, this is a requirement.

However you know how people react when anything changes; hence the configuration setting.

-- CrawfordCurrie - 15 Apr 2009

Please remember to set TargetRelease and ReleasedIn so I do not get 1.1 and 1.0.5 fixes mixed up and accidently put 1.1 fixes in the 1.0.5 release notes.

-- KennethLavrsen - 16 Apr 2009

ItemTemplate edit

Summary Change of the handling of unique anchor names in TOC
ReportedBy CrawfordCurrie
SVN Range SVN 3430: Foswiki-1.1.0-dev, Sun, 05 Apr 2009, build 3374
AppliesTo Engine
Priority Normal
CurrentState Closed
Checkins distro:dc9d6df5aea3 distro:e9a85c7e7d1e distro:c26df6dc0bf0 distro:4fc1124b4ef9
TargetRelease minor
ReleasedIn 1.1.0
Topic revision: r16 - 04 Oct 2010, KennethLavrsen - This page was cached on 19 Sep 2018 - 10:58.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy