[pmwiki-users] line break, page text variables et conditional markup

Petko Yotov 5ko at 5ko.fr
Wed May 8 04:02:07 CDT 2013


Benjamin Grassineau writes:
> Now, if we break a line in the ptv, for example
>
> (:a: Youpi
>  How are you ?:)
>
> (:if equal "{$:a}" "Youpi":)OK(:if:)
>
> We obtain
>
> "(:if equal "Youpi How are you ?" "Youpi":)OK"
>
> Wich is not exactly what we wish to obtain !!

It is important to note that when there is a Page(Text)Variable in a wiki  
page, almost at the very beginning of the processing the value or the text 
content of this variable is pasted in the page, without any modification.  
This happens very early, long before the markup engine starts processing  
conditionals. (And this is done because some PageTextVariables contain wiki  
markup that needs to be processed too.)

So, when conditionals are processed, your page contains something like this:

(:if equal "Youpi
How are you ?" "Youpi":)OK(:if:)

Unfortunately it is not possible to have line breaks inside the (:if:)  
conditional markup, so PmWiki doesn't recognize the pattern, and leaves it  
as plain text (line breaks inside plain text are converted to spaces by your  
browser, so you see it as a single line).

I am not aware of a recipe that does what you want.

It may be easier to test for a variable that cannot have line breaks or  
quotes.

Petko




More information about the pmwiki-users mailing list