[Pmwiki-users] [[include: ... ]] part of a page

John Rankin john.rankin
Wed Apr 14 16:21:12 CDT 2004


This is a small enhancement request.
It would be very useful (and trivial to implement) to write:

    [[include:PageName#anchor]]

and have pmwiki return the text up to and excluding [[#anchor]]. 
If $anch is not in PageName, it returns the whole page. 

It could mean the following changes to ProcessTextDirectives:

... preg_match( ... include:(.*?)(#.*)? ... )

...
   if ($inclpage) {
       $incltext = $inclpage['text'];
       $anch = '[['.$match[2].']]';
       if ($match[2]!='')
           $incltext = substr($incltext,0,strpos($incltext.$anch,$anch));
   }

Would anyone else find this useful?

There is an obvious extension to support:

    [[include:PageName#from#to]]

to return the text between the anchors. If [[#to]] is not in PageName, 
return the text from [[#from]] to the end. 
Currently, I don't have a need for this.
-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list