[Pmwiki-users] Re: TOC for PmWiki 2

John Rankin john.rankin
Wed Nov 17 13:36:03 CST 2004


On Wednesday, 17 November 2004 4:46 AM, chr at home.se wrote:
>On 28 Oct 2004, John Rankin wrote:
>
>> New version now uploaded. 
>
>Hi John, it's been a while but I finally got around to test (:toc:) with 
>the latest PmWiki 2. It almost works, except that I get a lot
>of 
>
>	Notice: Uninitialized string offset: 0 in 
>	/srv/www/htdocs/wiki/local/share/recipes/pagetoc.php on line
>129
>
>where the offending lines are probably these
>
>         if ($match[1][$i]==':') {
>            if ($match[2][$i][0]=='#')  $counter++;	// line 129
>            continue; }
>
>where some match isn't found properly. 

Fixed (well, I was able to duplicate it and then make it go away).

Try the latest version, line 129 now reads:

            if ($match[2][$i] && $match[2][$i][0]=='#')  $counter++;

This treats the pathalogical case of a page with markup

:#some term:some text

An author sets an automatic anchor, whereas toc omits : ... : ...
entries, thus leading to the counters in the toc and body being out
of step. In your case, I expect the page contains

:some term:some text

and $match[2][$i] is null, causing offset 0 to fail

Thanks for letting me know


-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list