[pmwiki-users] (:include parameters

Martin Fick fick at fgm.com
Mon Nov 21 14:29:20 CST 2005

On Mon, Nov 21, 2005 at 09:15:49AM -0600, Patrick R. Michaud wrote:
> On Sun, Nov 20, 2005 at 02:11:45PM -0500, Henrik Bechmann wrote:
> > (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.
> > ...
> > Note that the only difference is the removal of [^\n]* in both cases
> > [...]. So the question:
> > 
> > Is there any problem with this change to the regex? Any suggestions?
> Yes, the problem is that (:include:) was originally designed to
> be able to work with markup like:
>     !!! [#section1] Section 1
>     text
>     text
>     text
>     !!! [#section2] Section 2
>     text
>     text
>     text
> so that someone can do (:include SomePage#section1#section2:) or
> (:include SomePage#section1) to get the contents of section1.  
> Removing the [^\n]'s from the regex means that the !!!'s above 
> are treated as being in the wrong sections.
> (:include Page#from#to:) has always been defined in PmWiki as a 
> line-oriented markup.  If we really want to cut markers in mid-line
> we probably need a different option or (:include:) syntax to support it.
> Pm

  While I can see the utility of the current markup, I find
myself using it more the way that Henrik wants to use it.

I would suggest this added syntax:

(:include section=Section Page:)

where Section is assumed to be two anchors such as:


	...and ...


This would greatly reduce the wordiness for this case.

  As a note, in these cases I would prefer if nothing were
returned if the section does not exist, (currently the
entire page is  returned).  Maybe this could be the default
behaviour for this syntax?  Of course, one could always add
a default="defaulttext" switch  allowing text to be specifed
if a section is blank, :) 


More information about the pmwiki-users mailing list