[pmwiki-users] Passing blocks of markup to an include

Charlie Hayes cosmotic at cybercoment.com
Tue Jun 22 07:31:32 PDT 2021


Excellent! This works pretty well. I ended up wrapping the block in a
comment too.

-Charlie

On Tue, Jun 22, 2021 at 4:54 AM Petko Yotov <5ko at 5ko.fr> wrote:

> We have built-in PageTextVariables, see documentation:
>
>    https://www.pmwiki.org/wiki/PmWiki/PageTextVariables
>
> In your page:
>
>    (:include Template.MyTemplate param1="{*$:Var1}" :)
>
>    (:Var1:my markup block:)
>
> The above will work exactly as if you wrote:
>
>    (:include Template.MyTemplate param1="my markup block" :)
>
> Note that the include markup doesn't expect line breaks in the
> parameters, so your variable you can be a line, not a multiline block.
>
> If I need to pass a multiline block, I would try passing a page section
> to be included by the included page, something like:
>
>    (:include Template.MyTemplate param1="SomePage#start#end" :)
>
> and then Template.MyTemplate has a line like this:
>
>    (:include {$$param1}:)
>
> And SomePage contains something like:
>
>    [[#start]]
>    This is line 1.
>    Line 2.
>    [[#end]]
>
> Petko
>
> On 21/06/2021 22:04, Charlie Hayes wrote:
> > I would like to pass a block of markup to an (:include :)
> >
> > Something like:
> >
> > (:set var1:)
> > my markup block
> > (:setend:)
> > (:include Template.MyTemplate param1={$var1} :)
> >
> > I’ve been playing around with and reading through the documentation
> > and can’t figure out a built in method or a cookbook plugin.
> >
> > Any ideas?
> >
> > -Charlie
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20210622/8e5b1066/attachment.html>


More information about the pmwiki-users mailing list