[pmwiki-users] figuring out table of contents location

tamouse mailing lists tamouse.lists at gmail.com
Mon Jul 30 00:57:08 CDT 2012


On Jul 29, 2012 1:42 AM, "John Rankin" <john.rankin at affinity.co.nz> wrote:
>
>
> > John Rankin <john.rankin at affinity.co.nz> wrote:
> >> Try this test: put (:toc-hide:) into one of the pages (ie not in the
> >> GroupHeader) and see if the page toc appears in the side bar.
> >
> > Yes, when I put it directly into a page, then I get the toc in the
> > aside.
> >
> Cool! You also wrote:
>
> > In Site.GroupHeader, I have the following:
> >
> > (:description {*$:Summary}:)(:toc-hide:)
>
> How do you tell pmwiki to include Site.GroupHeader in
> {$Group}.GroupHeader? The pagetoc code needs a way to detect that the page
> includes a (:toc-hide:) when it is not part of the page's text. In case
> you are wondering, (:toc-hide:) tells the pagetoc code to generate anchors
> for (:toc-page:) links to find.
>

I use a version of Cookbook:AllGroupHeader in local/config.php.

> If all else fails, we can do this:
>
> function RemoteTableOfContents($pagename,$ref,$self=0) {
>     global $TocHeaderFmt,$RemoteTocFmt;
>
>     global $TrustMeIKnowWhatIAmDoingHonest;
>     SDV($TrustMeIKnowWhatIAmDoingHonest, false);
>
>     $oTocHeader = $TocHeaderFmt;
>     $TocHeaderFmt = str_replace('$Toc',$ref,$RemoteTocFmt);
>     $tocname = MakePageName($pagename,$ref);
>     if ($tocname==$pagename && $self==0) return '';
>     $tocpage=RetrieveAuthPage($tocname,'read',false);
>     $toctext=@$tocpage['text'];
>
>     if ($TrustMeIKnowWhatIAmDoingHonest) $toctext =
'(:toc-hide:)'.$toctext;
>
>     if
>
(preg_match('/\(:([#\*])?toc(?:-(float|hide))?(?:\s+anchors=(v)isible)?(?:\s+(.*?))?(?:\s+(Q))?:\)(.*)$/se',$toctext,$m))
>         $toc = str_replace('[[#',"[[$ref#",
>             TableOfContents($tocname,$m[1],'page','',$m[5],PSS($m[6])));
>     $TocHeaderFmt = $oTocHeader;
>     return $toc;
> }
>
> You could then add the following line to local/config.php:
>
>     $TrustMeIKnowWhatIAmDoingHonest = true;
>
> JR
> --
> John Rankin
>

Maybe what I'm after isn't quite clear. For this design, I want a top-level
toc to appear in an aside (think sidebar, but nothing else). I want this on
every page, but rather than having to include (:toc-hide:) on every page in
the wiki, I want to have in one place. I would like it to include all
heading displayed, not just those in the page text itself. I may just end
up writing my own.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20120730/1bfae8b7/attachment.html>


More information about the pmwiki-users mailing list