[pmwiki-users] FAQs and anchors and TOC

John Rankin john.rankin at affinity.co.nz
Wed Nov 2 17:21:52 CST 2005


On Thursday, 3 November 2005 10:03 AM, Waylan Limberg <waylan at gmail.com> wrote:
>On 11/2/05, Tegan Dowling <tmdowling at gmail.com> wrote:
>> I use the (:toc:) at the top of this faq:
>> http://www.wikitraining.com/PmWiki/FAQ
>>
>>  the recipe is in Cookbook/PageTableOfContents
>>
>>  Hope that Helps.
>>
>>
>Thanks. I looked and searched for that a number of times, but never
>could find it. It does do the trick, although there are a few
>problems.
>
>The list looks like this in the browser:
>
>1. 1 My first question
>2. 2 My second question...
>
>A quick look at the source code reveals that the following is
>generated:
>
><ol class='toc'><li>1&ensp;<a href='#toc1'>My first
>question</a></li>...
>
>Obviosly, this is a problem. If I set $NumberToc = false; (which I'd
>probably use anyway) or use (:*toc:) the problem goes away.

I'm not sure why this problem is happening, as there is an ol.toc with
list-style: none; to turn the browser's automatic numbering off.

It works fine for me and others.

Is there a link where I can view it, with $EnableDiag = 1; set?

The only thing I can think of is that there is a $HTMLStylesFmt['toc']
declared elsewhere, which is overriding the toc recipe's settings.

Run an ?action=diag and check that $HTMLStylesFmt['toc'] does
correctly contain the following settings:

span.anchor {
	float: left;
	font-size: 10px;
	margin-left: -10px;
	width: 10px;
    position:relative; top:-0.1em;
	text-align: center;
}
span.anchor a { text-decoration: none; }
span.anchor a:hover { text-decoration: underline; }
ol.toc { text-indent:-20px; list-style: none; }
ol.toc ol.toc { text-indent:-40px; }


>
>The other problem is that I don't like the anchor links: #toc1,
>#toc2?? Yuck! Wouldn't "#My_first_question" work much better? Anyone
>know of an easy way to change that for the recipe?

If you insert your own anchors, the script will use them, eg

Q:[[#my_first_question]]Which way is up?

Or are you suggesting that the script should form its anchor from
the text of the question, replacing spaces with underscores,  
removing disallowed characters and detecting duplicates?

What are the reasons for not using #toc1, #toc2, ... ?
-- 
JR
--
John Rankin






More information about the pmwiki-users mailing list