From e1e510cea296924ed3873247f039c39655b524bf Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 6 Dec 2011 16:54:13 +0000 Subject: [PATCH] Added proper HTML rendering of style attributes --- js/WikiTextParser.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/WikiTextParser.js b/js/WikiTextParser.js index c0c4bc1a5..eef95426e 100644 --- a/js/WikiTextParser.js +++ b/js/WikiTextParser.js @@ -60,7 +60,15 @@ WikiTextParser.prototype.renderAsHtml = function(store,title) { var tagBits = [element.type]; if(element.attributes) { for(var a in element.attributes) { - tagBits.push(a + "=\"" + utils.htmlEncode(element.attributes[a]) + "\""); + var r = element.attributes[a]; + if(a === "style") { + var s = []; + for(var t in r) { + s.push(t + ":" + r[t] + ";"); + } + r = s.join(""); + } + tagBits.push(a + "=\"" + utils.htmlEncode(r) + "\""); } } output.push("<" + tagBits.join(" ") + (selfClosing ? " /" : "") + ">");