array('{$var}', "'''")));
## If you wanted to run ''' (strong) rule and [+...+] rule (large) for [@...@]
# $EscapedMarkupRules['@'] = array("'''", '[+');
## If you wanted to run [+...+] rule for [=...=]
# $EscapedMarkupRules['='] = array("[+");
# Replace [=...=] and [@...@] rules and create the new [$...$] markup rule
Markup('[=','_begin',"/(\n[^\\S\n]*)?\\[([=@\$])(.*?)\\2\\]/se",
"MyPreserveText(\$pagename, '$2', PSS('$3'), '$1')");
## This function copied from PreserveText() in scripts/stdmarkup.php
## Added functionality here is the ability to run certain rules over the
## $text before it gets escaped. Also the [$...$] markup is introduced to
## allow unchanged behavior for [=...=] and [@...@] while still allowing
## markup for another escaped class.
# Each of $, @, = corresponds to an entry in $EscapedMarkupRules[X]. If an
# array exists with the relevant index then those rules will be run.
function MyPreserveText($pagename, $sigil, $text, $lead) {
global $EnableEscapedMarkup, $EscapedMarkupRules;
if (IsEnabled($EnableEscapedMarkup, false) && isset($EscapedMarkupRules[$sigil]) && !empty($EscapedMarkupRules[$sigil])) {
$text = RunMarkupRules($pagename, $EscapedMarkupRules[$sigil], $text);
}
if ($sigil=='=') return $lead.Keep($text);
if (strpos($text, "\n")===false)
return "$lead".Keep($text)."
";
$text = preg_replace("/\n[^\\S\n]+$/", "\n", $text);
if ($lead == "" || $lead == "\n")
return "$lead
".Keep($text).""; return "$lead<:pre,1>".Keep($text); }