PmWikiCustomMarkup

definiere ich im config.php oder farmconfig.php die custom markup dop mit

  • Markup('tstDop', 'fulltext','/{dop\+(\w+)}/','{tstDoppelt + $1 + $1 und $1}');

bekomme ich folgende Ersetzung:

so {tstDop+wert} oder so

so {tstDoppelt + wert + wert und wert} oder so

mit der e Option kann ich auch php eingeben:

  • Markup('tstPhp', '>fulltext','/{tstPhp\+(\w+)}/e', "'tstPhp + ' . '$1' . ' version=' . '$Version, PageName=$pagename, PageVar(group)=' . PageVar('$pagename', '\$Group') . ' + nachher'");
also {tstPhp+quarkMitSosse} oder?

also ---testPhp--- oder?

Speziell praktisch ist die /e Option wenn ich Entscheidungen treffen will, da kann ich den PHP ? : (triple) Operator benutzen - wenn's noch komplizierter wird muss ich halt eine Funktion definieren. Z.B. Einen DatasetNamen mit Apostropen umrahmen, fehlende schliessende Klammer nach mbr ergänzen und durch html entities ersetzen

  • Markup('tstDsn', '_begin', '/{tstDsn\+\'?([\w.@#]+)(\(([\w.@#]*)\)?)?\'?}/e', "'\'$1' . ('$3' == '' ? '' : '($3)') . '\''");
{tstDsn+a.b.c}

{tstDsn+a.b.c}

{tstDsn+'a.b.c(mbr}

{tstDsn+'a.b.c(mbr}

{tstDsn+a.b.c(mbr'}

{tstDsn+a.b.c(mbr'}

{tstDsn+'a.b.c(mbr)'}

{tstDsn+'a.b.c(mbr)'}

Hints und Warnings

  • If a markup wants to produces a style >>red<< it will not be recognized - because the style markup handling this style looks for &lt;&lt; .... &gt;&gt; . Thus the markup rule should produce this. Look for the correct productions in the source, e.g. stdmarkup.php.

Will ich textVariabeln verwenden, geht das nur wenn das customMarkup nach den Variabeln aufgelöst wird, obwohl ich tstDsn keine { im Parameter akzeptiert und vor den Variabeln aufgelöst wird:

  • {tstDsV+a.{$:textVar}.b.{$Action}.c(mbr} ==>
    • {tstDsV+a.dasIstDerInhaltDerTextVariabelnNamensTextVar.b.browse.c(mbr}
  • {tstDsV+a$b} ==>
    • {tstDsV+a$b}
  • {tstDsn+a.{$:textVar}.b.{$Action}.c(mbr} ==>
    • {tstDsn+a.dasIstDerInhaltDerTextVariabelnNamensTextVar.b.browse.c(mbr}