Recent Changes
Recent Changes · Search:

Wikipublisher.ProgramListings History

Hide minor edits - Show changes to output

28 September 2006 at 05:08 PM by John Rankin - demonstrate capability
Added lines 1-18:
This is a sample php program, to demonstrate program listing capability.

(:source lang=php:)
## 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')");
(:sourceend:)

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