You are here: Foswiki>Tasks Web>Item11240 (10 Jan 2012, MichaelDaum)Edit Attach

Item11240: EditChapterPlugin + TOC = funny link text

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: EditChapterPlugin
Branches:
Reported By: JayenAshar
Waiting For:
Last Change By: MichaelDaum
Enabling the EditChapterPlugin (even without the RenderPlugin) makes the TOC look funny.

The TOC now renders with:
 <a href="#A_01_BACKUP"> <span id="chapter_main_science_helpdesk_documentation_21" class="ecpHeading"> BACKUP topic:'Documentation', from:'21', to:'21'}"&gt;<img src="/pub/System/EditChapterPlugin/pencil.png" height="16" width="16" border="0"></span> </a>

I think it should be:
 <a href="#BACKUP"> BACKUP </a>

As you may notice, I think A_01_ should be removed from the anchor. If this is done in the href anchor, it needs to be done in the name anchor as well.

-- JayenAshar - 05 Nov 2011

See Item11045 for a fix of TOC cleaning up headings properly.

-- MichaelDaum - 09 Nov 2011

That worked mostly, but why are my anchor names prefixed with "A_01_"? (They weren't before.)

-- JayenAshar - 09 Nov 2011

True. That's due to the translation token that editchapter inserts to flag the heading as being processed already, and which is cleaned up at the very end when the page is completed. Alas, Foswiki::Render::Anchors::make() does not clean that up properly while creating anchors in a way leading to these funny link texts.

This will be fixed in the next release of EditChapterPlugin by using a translation token that does get cleaned up properly while headings get their anchor. See this patch:

--- lib/Foswiki/Plugins/EditChapterPlugin/Core.pm       (revision 13055)
+++ lib/Foswiki/Plugins/EditChapterPlugin/Core.pm       (working copy)

@@ -56,7 +57,7 @@
     session => $session,
     baseWeb => $session->{webName},
     baseTopic => $session->{topicName},
-    translationToken => "\1",
+    translationToken => "\x{e000}", # a random PUA unicode char. note: this one must be in the set of chars cleaned up by Foswiki::Render::Anchors::make()
     wikiName => $wikiName,
     @_,
   };

-- MichaelDaum - 10 Nov 2011

Yup, that works for me. Thanks.

-- JayenAshar - 10 Nov 2011

Hrm, now I have the problem that the TOC puts a span tag around the link, and it has the same id as the heading, so after an edit, when i'm returned to the page, i'm returned to the TOC and not the part i just edited. Is this part of Item11045, Item11240, or a new task?

-- JayenAshar - 23 Nov 2011

Should be fine on foswiki-1.1.4 which comes with an appropriate fix for TOC

-- MichaelDaum - 10 Jan 2012
 
Topic revision: r7 - 10 Jan 2012, MichaelDaum
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