simpler markup regular expressions

This commit is contained in:
Michael Save 2012-04-11 06:10:50 +10:00
parent 4db78899e4
commit 4dcdca997e
2 changed files with 6 additions and 8 deletions

View File

@ -333,10 +333,10 @@
*/
// "Wiki" markup syntax ($config['wiki_markup'] in pervious versions):
$config['markup'][] = Array("/'''(.+?)'''/m", "<strong>\$1</strong>");
$config['markup'][] = Array("/''(.+?)''/m", "<em>\$1</em>");
$config['markup'][] = Array("/\*\*(.+?)\*\*/m", "<span class=\"spoiler\">\$1</span>");
$config['markup'][] = Array("/(^|\n)==(.+?)==\n?/m", "<span class=\"heading\">\$2</span>");
$config['markup'][] = Array("/'''(.+?)'''/", "<strong>\$1</strong>");
$config['markup'][] = Array("/''(.+?)''/", "<em>\$1</em>");
$config['markup'][] = Array("/\*\*(.+?)\*\*/", "<span class=\"spoiler\">\$1</span>");
$config['markup'][] = Array("/^\s*==(.+?)==\s*$/m", "<span class=\"heading\">\$1</span>");
// Highlight PHP code wrapped in <code> tags (PHP 5.3.0+)
// $config['markup'][] = Array(

View File

@ -1451,6 +1451,7 @@
function markup(&$body, $track_cites = false) {
global $board, $config, $markup_urls;
$body = str_replace("\r", '', $body);
$body = utf8tohtml($body);
foreach($config['markup'] as $markup) {
@ -1557,10 +1558,7 @@
}
}
$body = str_replace("\r", '', $body);
$body = preg_replace("/(^|\n)([\s]+)?(&gt;)([^\n]+)?($|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body);
$body = preg_replace("/^\s*&gt;.*$/m", '<span class="quote">$0</span>', $body);
if($config['strip_superfluous_returns'])
$body = preg_replace('/\s+$/', '', $body);