[pmwiki-users] Switching (:include:) context

Martin Fick fick at fgm.com
Thu Jul 14 17:22:24 CDT 2005


On Thu, Jul 14, 2005 at 05:02:49PM -0500, Patrick R. Michaud wrote:
> On Wed, Jul 13, 2005 at 10:14:04AM -0400, Martin Fick wrote:
> > Feature request.  Would it be possible to add a switch to
> > the (:include :) directive so that if desired the context
> > could be switched during the inculde so that variables such
> > as {$Name} and {$Group} take on the values for the 
> > included page.  
> 
> Unfortunately, this isn't quite so simple as it might seem at
> first.  (:include:) does a straight text substitution into
> the current page; after processing the (:include:) PmWiki has
> no idea where the include starts/stops.

  yes, it looked very difficult to me or else I would have
attempted it myself. ;)


> Also, such a switch would need to handle more than just {$Name}
> and {$Group} -- page references within the (:include:) should
> probably be made relative to the included page.

  There is even more 'context' than I thought, another good
argument for it!


> Conversations in the past around this issue have also generally
> assumed that {$Name} and {$Group} would continue to refer to
> the including page, which is opposite from what you're proposing,
> so there's some potential for confusion there.  

  Hmm, I was proposing to keep it that way unless somone
specifically used the switch in the including page in which
case they would not be confused, would they?  Did you mean
that they used the switch to get relative links, but would
not expect {$Group} and {$Name} to change?



> In general the principle is that an included page already
> knows its own group and > name, so it doesn't need {$Group}
> or {$Name} for that.

  I guess in many cases that's true.  I have cases where a
Group.Template was used to create the initial text and
users are not expected to have to replace {$Name} with the
actual value, but it would be nice to be able to have it
set for the included page.

  If you coulde give me a head start I would try
implementing it myself, to start with I would only need to
deal with the real cases that I use such as subsitution
variables.


  -Martin




More information about the pmwiki-users mailing list