[pmwiki-users] Including a file with PmWiki markup
Michael Benjamin
mikerb at mit.edu
Thu Jun 16 07:34:58 CDT 2011
Hi Peter - Thanks. That works pretty well. The exception is that it
doesn't seem to handle newline requests such as [[<<]] or \\.
Mike
On Wed, 15 Jun 2011, Peter Bowers wrote:
> On Tue, Jun 14, 2011 at 10:22 PM, Michael Benjamin <mikerb at mit.edu> wrote:
>> How can I include a file containing PmWiki markup into a page?
>> For example, I'm looking to include a file such as:
>>
>> ------------------------- file foobar.txt
>> !! Introduction
>> Hello World
>> [[<<]]
>> Good bye
>> ------------------------
>>
>> I've tried (:includefile:) and even (:includeupload), but both just
>> include the text verbatim without converting [[<<]] to a newline etc,
>> or the !! as a section heading.
>
> Security concerns aside (which should not be set aside)...
>
> I'm assuming you are tlaking about the IncludeFile recipe. If so,
> change the definition from
>
> ===(snip)===
> Markup('includefile', '<block',
> '/\\(:includefile\\s*(.*?):\\)/ei',
> "Keep(includeTextAsCodeFunc('$pagename',PSS('$1')))");
> ===(snip)===
>
> to
>
> ===(snip)===
> Markup('includefile', '<block',
> '/\\(:includefile\\s*(.*?):\\)/ei',
> "PRR(includeTextAsCodeFunc('$pagename',PSS('$1')))");
> ===(snip)===
>
> (Notice the change from "Keep" to "PRR".)
>
> Or, alternatively, you could create a new markup called includemarkup like this:
>
> ===(snip)===
> Markup('includemarkup', '<block',
> '/\\(:includemarkup\\s*(.*?):\\)/ei',
> "PRR(includeTextAsCodeFunc('$pagename',PSS('$1')))");
> ===(snip)===
>
> I think either of these will allow this recipe to run markup rules
> over the text that is included. No guarantees, but it's worth a shot.
>
> -Peter
>
More information about the pmwiki-users
mailing list