[pmwiki-users] Getting the list of all anchors in a page ?

Petko Yotov 5ko at 5ko.fr
Mon Jul 19 18:46:50 CDT 2010

On Tuesday 20 July 2010 00:22:28, ABClf wrote :
> I'm testing your markup code and can't make it work now.
> In page where I use (:listanchor:) I get an error message

Right, the directive only displays anchors that exist earlier in the page, so 
there is an error when there is no anchor before it. We can deal with empty 
lists without issuing error messages :

  Markup('listanchor', '>[[#', '/\\(:listanchors:\\)/e', 
      implode(" ; ", array_keys($GLOBALS["SeenAnchor"])) : "")');

The $SeenAnchor array contains all anchors that PmWiki has encountered in the 
page untill that moment when we read it in order to display the list. 
Unfortunately, I don't have an easy way to display anchors that have not yet 
been seen by PmWiki. :-)


More information about the pmwiki-users mailing list