[Moin-user] Defining custom variables

Greg Ward gerg.ward+moin at gmail.com
Thu Oct 30 13:42:46 EDT 2008


[my complaint about <<GetVal>>]
> Hmmm. I just tried something like this in a test wiki running 1.8.0rc1.
> Putting wiki markup in a variables works fine if I expand at save time
> with @VAR at .  But if I use <<GetVal>>, the wiki markup is rendered
> literally in the output HTML.
> 
> Explanation: page "gward/MyDict" contains just
> 
> """
>  NAME:: Greg
>  HOMEPAGE:: [[http://www.gerg.ca/|my personal home page]]
> """
> 
> When I edit a page to say
> 
>   Please visit @HOMEPAGE@!
> 
> it works; the wiki markup is inserted into the page text and then
> processed into HTML when the page is rendered.  But if I put this in a
> page:
> 
>   Please visit <<GetVal(gward/MyDict, HOMEPAGE)>>
> 
> then the HTML looks like
> 
>   Please visit [[http://www.gerg.ca/|my personal home page]]
> 
> Oops!

[Reimar explains]
> Well you asked for the value not for the rendered result. formatter.text
> is used for output. (sorry I should not have used the word "expanded" in
> my explaination.)

Yes, it's fairly clear that the surprising behaviour of <<GetVal>> is
due to the order in which things are expanded/rendered.  I'm just
pointing out that it *is* surprising behaviour, and it's a subtle
inconsistency between @VAR@ and <<GetVal(..., VAR)>>.  With @VAR@, it's
OK if the variable value contains wiki markup; but with GetVal, it's
not.

Is this the intended behaviour of <<GetVal>>?  If so, it should probably
be mentioned in HelpOnMacros.  Otherwise, perhaps it is a bug.

> feel free to add the description improvement on http://master18.moinmo.in

Done: I rewrote the section "Expanding Variables" as "Defining New
Variables", almost exactly as in the patch I quoted earlier.

        Greg




More information about the Moin-user mailing list