[pmwiki-users] figuring out table of contents location
John Rankin
john.rankin at affinity.co.nz
Sun Jul 29 03:42:13 CDT 2012
> 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.
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
More information about the pmwiki-users
mailing list