[pmwiki-users] Stuck creating markup to add self link to included pages

Dominique Faure dominique.faure at gmail.com
Tue Oct 2 10:00:08 CDT 2007


On 10/2/07, DaveG <pmwiki at solidgone.com> wrote:
> Wow, that is *exactly* what I've been trying to do -- I basically gave
> up hope that it was even possible [1]
>
> I'd like to try and understand what you have...
>
> a] What exactly does $QualifyPatterns do? There's no mention of it on
> pmwiki.com that I could find.
>
> b] Also, what is ".PageVar"?
>
> Thanks very much Dominique.
>
>   ~ ~ Dave
>
> [1]
> http://www.pmichaud.com/pipermail/pmwiki-users/2007-September/046372.html
>
> Dominique Faure wrote:
> > On 10/1/07, Chris Cox <ccox at airmail.net> wrote:
> >> Dominique Faure wrote:
> >>> On 9/29/07, Chris Cox <ccox at airmail.net> wrote:
> >>>> In later version of PmWiki you can do put the following in a page:
> >>>>
> >>>> [[{$FullName}?action=edit|edit]]
> >>>>
> >>>> And then when the page is (:include:)'d, it's a link
> >>>> to edit the included content.  Nice.
> >>>>
> >>>> I'd like to create a new markup that adds this to a page
> >>>> instead of typing all of the above in.  But, I can't figure
> >>>> it out.  Any hints?
> >>>>
> >>>> For example, I could add (:e:) and it would effectively
> >>>> be the same as having the above inside the page to be
> >>>> included.
> >>>>
> >>>>
> >>> What about (untested)?
> >>>
> >>> $ROSPatterns['/\\(:e:\\)/'] = '[[({$FullName}?action=)edit]]';
> >>>
> >> Hmmm... ok... but I really want a markup, not a substitute on
> >> save solution (want to keep the simplified markup in the page).
> >>
> >> Anyone else have an idea?
> >>
> >
> > Then, here you are with an "almost-regular" markup ;)
> >
> > Markup('(:e:)', 'directives', '/\\(:e:\\)/ei',
> >   "'[[('.PageVar(\$pagename,'\$FullName').'?action=)edit]]'");
> > $QualifyPatterns['/\\(:e:\\)/ei'] =
> >   "'[[('.PageVar(\$pagename,'\$FullName').'?action=)edit]]'";
> >
> > The Markup(...); directive is responsible for generating the edit link
> > when pages are displayed directly.
> > The $QualifyPatterns[...] definition handle the markup transformation
> > when the considered page is included into another one.
> >
> > Hope this helps,
>

Patrick should be the one to thanks here since he provides all what is
needed ;), but as far as I understand the PmWiki code, I could give
the following details:

a] When the (:include:) directive retrieves a page content, the
included text is processed (qualified) to transform "relative"
variable references to "absolute" ones, making {$SomeVar} becomes
{Group.IncludedPage$SomeVar}, which resolves as expected when the page
is finally rendered.
The internal $QualifyPatterns maintains the dedicated
search/replacement regular expressions.

b] PageVar($pagename, '$VarName') is the php function able to retrieve
the value of a Wiki variable.

That's all.
-- 
Dominique



More information about the pmwiki-users mailing list