[pmwiki-devel] Variable Expansion Question.

Dominique Faure dominique.faure at gmail.com
Tue Oct 23 11:08:57 CDT 2007


On 10/23/07, Stirling Westrup <sti at pooq.com> wrote:
> I'm wondering if anyone has any insight on how Pm avoids recursive loops in
> his variable expansion routines. I ask because I need to do something similar
> and my reading of the PmWiki code has given me no insight.
>
> This is part of an expansion to the Fox forms system that I need for a
> multilingual blog. Form templates can contain variables with names like
> {$$foo} and I want to be able to expand nested cases so that I can have
> expansions like this:
>
>   {$$foo} => Blog
>   {$$bar} => English
>   {$${$$foo}-{$$bar}} => {$$Blog-English} => Something
>
> I can easily see how to accomplish this, but I don't want to get into infinite
> loops with perverse cases such as:
>
>   {$$foo} => {$$foo}
>
> (ie, the contents of $$foo is the literal string '{$$foo}'). So, somehow I
> need to mark text as having already been expanded, and not expand it again,
> unless its inside {$$..} brackets. This sounds like something that the Keep
> system would be good for, but I'm afraid I just don't get how it works.
>
> I can't use the existing markup engine, since form templates don't get
> translated into HTML, so I'm having to write my own routines for it.
>
> _______________________________________________
> pmwiki-devel mailing list
> pmwiki-devel at pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-devel
>

Basically (I may be wrong, but) I found that the markup engine is not
more than an ordered list of Regexp-Replacement rules applied to the
whole page text, with the additional feature to allow restarting the
whole process according to a specific condition (cf. what the
(:include:) directive does).

As far as I understand what you're trying to do, it seem very close to
what the (:include:) directive does, so why not having a try with
PRR(...)?

-- 
Dominique



More information about the pmwiki-devel mailing list