1.0rc14
authorivanl
Mon, 10 Aug 2009 11:26:10 +0100
changeset 17 5dc2963cd75f
parent 16 6544cc5386ce
child 18 b73e6caf0031
1.0rc14 Fixed bbcode rendering
Symbian.org/Forums.js
Symbian.org/Main.js
Symbian.org/style.css
--- a/Symbian.org/Forums.js	Thu Jul 30 16:17:56 2009 +0100
+++ b/Symbian.org/Forums.js	Mon Aug 10 11:26:10 2009 +0100
@@ -472,17 +472,35 @@
 
 function convertTag(tag, fulltag, tagContent) {
 	tag = tag.toLowerCase();
+	var param = null;
+	var eqsign = fulltag.indexOf("=");  // onclick=\"openURL('" + item.url + "');
+	if (eqsign > -1) {
+		param = fulltag.substring(eqsign+1);
+	}
 	switch(tag) {
+		case '*': return bbcode2html(tagContent);
 		case 'b':case 'i':case 'u':case 's':case 'sup':case 'sub':case 'h1':case 'h2':case 'h3':case 'h4':case 'h5':case 'h6':case 'table':case 'tr':case 'th':case 'td':
 		{
-			return '<' + tag + '>' + tagContent + "</" + tag + ">";
+			return '<' + tag + '>' + bbcode2html(tagContent) + "</" + tag + ">";
 		}
-		case 'quote': return '<blockquote><i>' + tagContent + '</i></blockquote>';
+		case 'font': return '<font face="'+param+'">' + bbcode2html(tagContent) + '</font>';
+		case 'size': return '<font size="'+param+'">' + bbcode2html(tagContent) + '</font>';
+		case 'color': return '<font color="'+param+'">' + bbcode2html(tagContent) + '</font>';
+		case 'left': return '<div align="left">' + bbcode2html(tagContent) + '</div>';
+		case 'right': return '<div align="right">' + bbcode2html(tagContent) + '</div>';
+		case 'center': return '<div align="center">' + bbcode2html(tagContent) + '</div>';
+		case 'list': return tagContent; // todo
+		case 'php': 
+		case 'code': return '<div class=codebox><code>' + tagContent + '</code></div>';
+		case 'html':{
+			var escaped = tagContent.replace(/</g, "&lt;").replace(/>/g, "&gt;");
+			return '<div class=codebox><code>' + escaped + '</code></div>';
+		}
+		case 'quote': return '<div class=codebox><b>Quote:</b><br><i>' + tagContent + '</i></div>';
 		case 'url': {
-			var eqsign = fulltag.indexOf("=");  // onclick=\"openURL('" + item.url + "');
 			if ( eqsign > -1 ) {
 				return "<div class=\"FeedItemLink\"><a href=\"JavaScript:void(0)\" onclick=\"openURL( '"
-				+ fulltag.substring(eqsign+1)
+				+ param
 				+ "')\" ><i>"
 				+ tagContent
 				+ '</i></a></div>'; 
--- a/Symbian.org/Main.js	Thu Jul 30 16:17:56 2009 +0100
+++ b/Symbian.org/Main.js	Mon Aug 10 11:26:10 2009 +0100
@@ -51,7 +51,7 @@
 var wikiBaseUrl = symbianOrgBaseUrl+"/wiki/index.php";
 
 // Update variables
-var myversion = "1.0rc13";
+var myversion = "1.0rc14";
 var versionWikiPageUrl = wikiBaseUrl + "/Symbian.org_WRT_Widget";
 var versionWikiPageString = "Current widget version is [";
 var downloadUrl = symbianOrgBaseUrl + "/wiki/images/c/c5/Symbian.org.wgz";
--- a/Symbian.org/style.css	Thu Jul 30 16:17:56 2009 +0100
+++ b/Symbian.org/style.css	Mon Aug 10 11:26:10 2009 +0100
@@ -51,3 +51,11 @@
 	border-color: gray gray gray gray;
 	background-color: white;
 }
+
+.codebox {
+    font: normal 12px Arial, sans-serif;
+	border-width: 1px 1px 1px 1px;
+	padding: 1px 1px 1px 1px;
+	border-style: inset inset inset inset;
+	border-color: gray gray gray gray;
+}