From 4afd2c7cb2fe7b40f5dd662bd79125bfcfcefbe8 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Wed, 21 Mar 2012 11:57:30 +1100 Subject: Customizable markup syntax. --- inc/functions.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'inc/functions.php') diff --git a/inc/functions.php b/inc/functions.php index b999df8c..51af3332 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1440,11 +1440,12 @@ $body = utf8tohtml($body); - if($config['wiki_markup']) { - $body = preg_replace("/(^|\n)==(.+?)==\n?/m", "$2", $body); - $body = preg_replace("/'''(.+?)'''/m", "$1", $body); - $body = preg_replace("/''(.+?)''/m", "$1", $body); - $body = preg_replace("/\*\*(.+?)\*\*/m", "$1", $body); + foreach($config['markup'] as $markup) { + if(is_string($markup[1])) { + $body = preg_replace($markup[0], $markup[1], $body); + } elseif(is_callable($markup[1])) { + $body = preg_replace_callback($markup[0], $markup[1], $body); + } } if($config['markup_urls']) { -- cgit v1.3