[Pmwiki-users] Wikis with multiple languages

Patrick R. Michaud pmichaud
Mon Jan 12 11:19:40 CST 2004


On Mon, Jan 12, 2004 at 06:33:36PM +0100, Dr. Rainer Decker (privat) wrote:
> The main purpose of my proposal was to  use ONE keyword 
> ("endif") instead of a whole lot of these ("endtime", "endtrue",
>  .., i.e. one per initial keyword), which I understood was your 
> proposal.

I hadn't really thought it out in great detail before the last
message; the original proposal had come up several months ago and,
following PmWikiPhilosophy #3, I didn't go much further towards an
implementation until I could get a clearer picture of how it might
be used.

> I agree that a complete parser is probably overkill, however
> even if one day someone would feel tempted to write one, the 
> syntax is already there.....

Actually, after thinking about my latest proposal a bit, if a
WikiAdministrator was crazy enough to want to allow arbitrary
expressions they could do it with

    $Conditional['expr'] = '$1';

which would allow arbitrary PHP expressions such as

    [[if expr ($hour<12) && ($day=='Mon')]]

Of course, this is horribly unsafe precisely because it allows any 
arbitrary PHP expression to be executed by a wiki author--consider

    [[if expr unlink('pmwiki.php')]]

I suppose someone could write a function to limit the sorts of
"arbitrary" expressions that would be permitted, but I'm not going to
do it.  :-)

> If you don't like the "[[else]]" - what's about another keyword,
> e.g. [[ifnot xxxx]], which just does the opposite of the "if"? 

The canonical opposite of "if" is "unless":

   [[unless false]]
   [[unless printing]]
   [[unless lang en]]

> a statement  like
>     [[if lang ]] 
> or
>     [[if lang default]]
> would then be obsolete, as everything outside a "language
> bracket pair" would be displayed regardless of the setting
> of the lang parameter.
> I think this solution is far superior to the "five-dollar" approach
> that Eike used in his initial solution. 

Indeed, I agree.

Still, conditional markup is pretty low according to DevelopmentPriority,
so I have a few other things that need working on before I tackle that.
One big question is when the conditional markup should be processed,
currently the sequence is:

   [[include:]] files
   GroupHeader, GroupFooter
   BrowseDirectives (e.g., [[spacewikiwords]] [[noheader]] [[nofooter]])
   [=...=] preservation
   $DoubleBrackets  replacements
   $LinkPatterns
   block-level HTML (tables, lists, pre, paragraphs)
   $InlineReplacements
   restore links
   WikiStyles
   restore [=...=] preserved elements

I'm guessing that conditional markup should go at the same level as
BrowseDirectives...after headers/footers but before [=...=] sequences
are processed.
   
Pm



More information about the pmwiki-users mailing list