diff options
Diffstat (limited to 'scripts/stdmarkup.php')
-rw-r--r-- | scripts/stdmarkup.php | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/scripts/stdmarkup.php b/scripts/stdmarkup.php index 87cf6540..c368f1ca 100644 --- a/scripts/stdmarkup.php +++ b/scripts/stdmarkup.php @@ -114,6 +114,7 @@ function CondText2($pagename, $text, $code = '') { if (!isset($Conditions[$condname])) return preg_replace_callback($CondTextPattern, $repl, $condtext); + $tf = @eval("return ({$Conditions[$condname]});"); if ($tf xor $not) return preg_replace_callback($CondTextPattern, $repl, $condtext); @@ -213,7 +214,7 @@ Markup('linebreaks', 'directives', ## (:messages:) Markup('messages', 'directives', - '/^\\(:messages:\\)/i', + '/^\\(:messages( .*)?:\\)/i', "MarkupDirectives"); function MarkupDirectives($m) { @@ -222,13 +223,27 @@ function MarkupDirectives($m) { case 'linkwikiwords': return PZZ($GLOBALS['LinkWikiWords']=(@$m[1]!='no')); case 'spacewikiwords': return PZZ($GLOBALS['SpaceWikiWords']=(@$m[1]!='no')); case 'linebreaks': - return PZZ($GLOBALS['HTMLPNewline'] = (@$m[1]!='no') ? '<br />' : ''); + return PZZ($GLOBALS['HTMLPNewline'] = (@$m[1]!='no') ? '<br />' : ''); case 'messages': - return '<:block>'.Keep(FmtPageName( - implode('',(array)$GLOBALS['MessagesFmt']), $pagename)); + global $MessagesFmt; + $args = isset($m[1]) ? ParseArgs($m[1]) : array(); + if (isset($args['key'])) { + $keys = MatchNames(array_keys($MessagesFmt), $args['key']); + $msg = array(); + foreach($keys as $k) $msg[$k] = $MessagesFmt[$k]; + if (! $msg) return ''; + } + else $msg = $MessagesFmt; + return '<:block>'.Keep(FmtPageName(MergeMessages($msg), $pagename)); } } +function MergeMessages($msg) { + $out = ''; + if (is_array($msg)) foreach($msg as $x) $out .= MergeMessages($x); + else $out .= $msg; + return $out; +} ## (:comment:) Markup('comment', 'directives', '/\\(:comment .*?:\\)/i', ''); |