You are here: Foswiki>Tasks Web>Item12898 (31 May 2014, GeorgeClark)Edit Attach

Item12898: Allow topic-specific TOC without topic reference in link

pencil
Priority: Enhancement
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: TOC
Branches:
Reported By: LynnwoodBrown
Waiting For:
Last Change By: GeorgeClark
The intent of this enhancement request is to allow including a topic that contains a TOC macro such that the rendered TOC is restricted to the included topic content, but the anchors still link to the INCLUDING page.

To clarify, here's a review of the current functionality of VarTOC:
  • Inserting basic %TOC% macro in a topic will result in anchor links in the format <a href='#AnAchor'>
  • If that topic is INCLUDED in another topic, the TOC will generate a table of contents for the entire INCLUDING topic.
  • Adding the "Topic Name" parameter to TOC macro (e.g. %TOC{"RefTopic"}%) results in anchor links in the format <a href='/Web/Topic#AnAchor'>
  • If this topic is INCLUDED in another topic, the rendered TOC is only for the referenced page and all links in the TOC link directly to the referenced topic.

In some cases, it's desirable to have the TOC for the included topic render links only for the referenced topic, but also not include the topic pathg in the rendered link so that the link jumps to the corresponding section within the including topic.

I'm not sure what's the best and simpliest way to achieve this. Here's a couple possibilities:
  • Add a "remote" attribute to control whether the rendered link includes the topic path. Setting it to "on" would include the topic path, off would not.
  • Add a "format" attribute which would allow greater control over the rendered links. Perhaps this is overkill but would be consistent with other macros and possibly address other needs not currently addressed by the macro. The formatting could include standard rendering parameters like $web and $topic as well as a special one $anchor for the hashtag and anchor reference.

-- LynnwoodBrown - 13 May 2014

Given that there are questions on how to implement, marking this as proposal required.

-- GeorgeClark - 31 May 2014

 

ItemTemplate edit

Summary Allow topic-specific TOC without topic reference in link
ReportedBy LynnwoodBrown
Codebase
SVN Range
AppliesTo Engine
Component TOC
Priority Enhancement
CurrentState Proposal Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
Release01x01Checkins
Topic revision: r2 - 31 May 2014, GeorgeClark
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