[pmwiki-users] Including a file with PmWiki markup
Peter Bowers
pbowers at pobox.com
Wed Jun 15 21:01:33 CDT 2011
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