Recent Changes
Recent Changes · Search:
 

This is a sample php program, to demonstrate program listing capability.

## first we preserve text in [=...=] and [@...@]
function LatexPreserveText($sigil, $text, $lead) {
  if ($sigil=='=') return $lead.Keep($text);
  if (strpos($text, "\n")===false) 
    return "$lead<tbook:visual markup='tt'>".Keep($text)."</tbook:visual>";
  $text = preg_replace("/^[^\\S\n]*\n/", "\n", substr($lead,1).$text);
  $text = preg_replace("/\n[^\\S\n]*$/", "\n", $text);
  return "<tbook:verbatim>".Keep($text)."</tbook:verbatim>";
}

Markup('[=','_begin',"/(\n[^\\S\n]*)?\\[([=@])(.*?)\\2\\]/se",
    "LatexPreserveText('$2', PSS('$3'), '$1')");

Back to normal text… The typesetting engine supports a wide range of languages. The above code is a fragment of the Wikipublisher replacement for scripts/stdmarkup.php.

Page last modified on 28 September 2006 at 05:08 PM