[Pmwiki-users] Re: PmWiki "macros" and [[include:]]

Christian Ridderström chr
Wed Jun 2 12:57:04 CDT 2004


On Wed, 2 Jun 2004, Jesse Jacobsen wrote:

> On 06/02/04, Steven Leite wrote:
> > I can think of one way to make "macros" .. using inline replacements.
> ...
> 
> > I'm not sure if that's close to what you want or not.  It doesn't really
> > allow for authors to change/make modifications to the "macro".
> 
> That's the problem.  I'm thinking of author-defined macros.
> 
> > If you can give some more detailed examples, I might toy around with the
> > idea, but I can't make any promises - I'm involved in two other big
> > projects right now and I'd like to see those finished before I start a
> > new one.
> 
> Upon further reflection, I think everything I have in mind could be done
> using something like [[include:name#startanchor#wikichunkdelim]], which
> would include text from start to an "end include" marker, like
> [[endinclude]] or [[wikichunkdelim]].

That should probably be [[#endinclude]] and [[#wikichunkdelim]] if you 
want to create anchors.

Other than that, I think this sounds like a clever idea. Btw, isn't there
a syntax in the [[include:...]] which allows you to directly include only
a single paragraph? Or doesn't that work in this case because your table
directives must be on separate lines?

Pm, how does [[include:APage#<single-par-anchor>]] treat something that 
looks like this

	[[#anchor]]First line bla bla \\
	second line ... \\
	third line

i.e. what happens with the '\\'? 


> It would keep the macros in author space, and allow authors to include
> many items from a single page.  The included wikimarkup and text could
> be arbitrarily long, and composed of just about anything.  Meanwhile,
> the macro source page could be quite readable, having text outside the
> [[#startanchor]]..[[wikichunkdelim]] sections.
> 
> This seems easier to implement than an entirely new way to define
> macros.  It might involve quite a few includes on a page, with many of
> them identical.  Perhaps it could be optimized.

If you get it to work well for you, I think you should write a cookbook
page on how you did it.

/Christian

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list