if(! function_exists('get_tags')) {
function get_tags($s) {
$ret = array();
+
+ // ignore anything in a code block
+
+ $s = preg_replace('/\[code\](.*?)\[\/code\]/sm','',$s);
+
if(preg_match_all('/([@#][^ \x0D\x0A,:?]*)([ \x0D\x0A,:?]|$)/',$s,$match)) {
foreach($match[1] as $match) {
if(strstr($match,"]")) {
}
}
+ /**
+ * Fold multi-line [code] sequences
+ */
+ $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body);
/**
* Look for any tags and linkify them
rep(/<u>/gi,"[u]");\r
rep(/<blockquote[^>]*>/gi,"[quote]");\r
rep(/<\/blockquote>/gi,"[/quote]");\r
- rep(/<br \/>/gi,"\n");\r
- rep(/<br\/>/gi,"\n");\r
+ rep(/<br \/>/gi,"\n\n");\r
+ rep(/<br\/>/gi,"\n\n");\r
rep(/<br>/gi,"\n");\r
rep(/<p>/gi,"");\r
rep(/<\/p>/gi,"\n");\r
rep(/\[url\](.*?)\[\/url\]/gi,"<a href=\"$1\">$1</a>");\r
rep(/\[img\](.*?)\[\/img\]/gi,"<img src=\"$1\" />");\r
rep(/\[color=(.*?)\](.*?)\[\/color\]/gi,"<span style=\"color: $1;\">$2</span>");\r
+// rep(/\[\/code\]\s*\[code\]/gi,"<br />"); // fold multiline code\r
rep(/\[code\](.*?)\[\/code\]/gi,"<code>$1</code>");\r
rep(/\[quote.*?\](.*?)\[\/quote\]/gi,"<blockquote>$1</blockquote>");\r
\r
cite {border-bottom:1px dashed blue}\r
acronym {border-bottom:1px dotted #CCC; cursor:help}\r
abbr {border-bottom:1px dashed #CCC; cursor:help}\r
+code {\r
+ font-family: Courier, monospace;\r
+ white-space: pre;\r
+ display: block;\r
+ overflow: auto;\r
+ border: 1px solid #444;\r
+ background: #EEE;\r
+ color: #444;\r
+ padding: 10px;\r
+ margin-top: 20px;\r
+}\r
+\r
\r
/* IE */\r
* html body {\r