[pmwiki-users] (:include parameters

Henrik Bechmann henrik at bechmannsoftware.com
Sun Nov 20 13:11:45 CST 2005


All,

(Probably a question for Pm)

The (:include ... :) directive includes options to select a portion of 
the included page, between named markers: MyGroup.MyPage#Start#End

where the MyPage text has

[[#Start]] and [[#End]] markers embedded.

BUT it turns out these markers have to mark blocks, so you can't do in 
MyPage

Hello There. [[#Start]]This is the first sentence that I want to 
Include.[[#End]] And the rest I don't want.

To fix this, I have modified the IncludeText regex (experimentally) to

        if ($aa)
#          
$itext=preg_replace("/^.*?([^\n]*\\[\\[#$aa\\]\\])/s",'$1',$itext,1);
          $itext=preg_replace("/^.*?(\\[\\[#$aa\\]\\])/s",'$1',$itext,1);
        if ($bb)
#          
$itext=preg_replace("/(.)[^\n]*\\[\\[#$bb\\]\\].*$/s",'$1',$itext,1);
          $itext=preg_replace("/(.)\\[\\[#$bb\\]\\].*$/s",'$1',$itext,1);

Note that the only difference is the removal of [^\n]* in both cases

I Actually want to apply this to my home grown (:includefieldpage ... :) 
directive (I understand it is not recommended to make changes to core 
code). So the question:

Is there any problem with this change to the regex? Any suggestions?

Thanks,

- Henrik

Is there some reason

-- 

Henrik Bechmann
www.osscommons.ca
www.bechmannsoftware.com
Webmaster, www.dufferinpark.ca





More information about the pmwiki-users mailing list