[Fwd: RE: [pmwiki-users] Re: RE: Fixed: Error in cookbook rename function]
Patrick R. Michaud
pmichaud at pobox.com
Fri Jun 3 11:46:35 CDT 2005
> From: Jan Jacobs <Jacobsjan at spector.be>
> So far I managed to create a markup (:calendar:), which works similar to
> the calendar found in the cookbook, and I'm able to output a simple
> month calendar. However, all code was ripped from other cookbook
> recipes, and my knowledge about the markup function lacks badly, so i
> need your help here :)
> This is the markup call I use now:
> 1) what is the meaning of the 2nd parameter, and how do I have to fill
> it correctly?
The 2nd parameter identifies where in the markup processing sequence
this markup should be processed relative to some other rule. A value
of '<title' means that it should be processed before the markup rule
named 'title' (although it doesn't necessarily mean "immediately before",
because a later rule could specify '>calendar').
You can see pmwiki.org's markup table at
http://www.pmwiki.org/wiki?action=ruleset . The first column is the
name of the markup, the second column is the specifier used to indicate
where the markup should be processed relative to another markup.
(The third column is internal to PmWiki.) Here's an excerpt:
[[ links B>>>>>=
img <urllink B>>>>>=><
mailto <urllink B>>>>>=><
urllink >[[ B>>>>>=>
`wikiword <wikilink B>>>>>=>><
varlink <wikilink B>>>>>=>><
wikilink >urllink B>>>>>=>>
This says that
'[[' markups are performed in the 'links' section,
'urllink' markup (http://...) must be performed after '[[',
'img' and 'mailto' markups must be performed before 'urllink',
'wikilink' (i.e., wikiwords) must be performed after 'urllink',
'varlink' and '`wikiword' must be performed before 'wikilink'.
The order in which the markups are actually processed is given in
the table above.
For more details about the processing sequence, look at
> 2) what regular expression do I need to make for a (:calendar:) or a
> (:calendar -1:) or a (calendar +4) markup that can be put anywhere in
> the typed text of a page, and which would result in the insertion of the
> result of my function call view_SimpleCalendar ??? How would I extract
> the extra parameter from the calendar markup and pass it to this function?
"/\\(:calendar\\s*(.*?):\\)/e" should work -- this grabs the argument and
places it into $1 in the substituted expression. You might also want
to take a look at http://www.pmwiki.org/wiki/Cookbook/ParseArgs
which is a built-in PmWiki function that knows how to parse out
things like (:calendar when=+1 fmt=blahblah title="My Title":) .
More information about the pmwiki-users