Merge pull request #1092 from ZogStriP/rolling-back-markdown-conversion-pipeline-order-changes

reverting changes to the markdown conversion pipeline order
This commit is contained in:
Robin Ward 2013-06-25 08:20:10 -07:00
commit 62daeedf08
2 changed files with 13 additions and 13 deletions

View File

@ -109,8 +109,7 @@ Discourse.Markdown = {
// Extract quotes so their contents are not passed through markdown. // Extract quotes so their contents are not passed through markdown.
converter.hooks.chain("preConversion", function(text) { converter.hooks.chain("preConversion", function(text) {
var formated = Discourse.BBCode.format(text, opts); var extracted = Discourse.BBCode.extractQuotes(text);
var extracted = Discourse.BBCode.extractQuotes(formated);
quoteTemplate = extracted.template; quoteTemplate = extracted.template;
return extracted.text; return extracted.text;
}); });
@ -185,7 +184,7 @@ Discourse.Markdown = {
text = quoteTemplate(text); text = quoteTemplate(text);
} }
return text; return Discourse.BBCode.format(text, opts);
}); });
if (opts.sanitize) { if (opts.sanitize) {

View File

@ -68,14 +68,14 @@ test("Links", function() {
test("Quotes", function() { test("Quotes", function() {
cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2", cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2",
{ topicId: 2, lookupAvatar: function(name) { return "" + name; } }, { topicId: 2, lookupAvatar: function(name) { return "" + name; } },
"<p>1</p><aside class='quote' data-post=\"1\" > <br>\n <div class='title'>\n <div class='quote-controls'></div>\n" + "<p>1</p><aside class='quote' data-post=\"1\" >\n <div class='title'>\n <div class='quote-controls'></div>\n" +
" bob\n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside> <br>\n<p>2</p>", " bob\n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside>\n<p> <br>\n2</p>",
"handles quotes properly"); "handles quotes properly");
cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2", cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2",
{ topicId: 2, lookupAvatar: function(name) { } }, { topicId: 2, lookupAvatar: function(name) { } },
"<p>1</p><aside class='quote' data-post=\"1\" > <br>\n <div class='title'>\n <div class='quote-controls'></div></p>\n" + "<p>1</p><aside class='quote' data-post=\"1\" >\n <div class='title'>\n <div class='quote-controls'></div>\n" +
"\n<p>bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside> <br>\n<p>2</p>", " \n bob\n said:\n </div>\n <blockquote>my quote</blockquote>\n</aside>\n<p> <br>\n2</p>",
"includes no avatar if none is found"); "includes no avatar if none is found");
}); });
@ -120,8 +120,9 @@ test("SanitizeHTML", function() {
}); });
test("with BBCode", function() { // TODO
cooked("[img]http://eviltrout.com/eviltrout.png[/img]", // test("with BBCode", function() {
"<p><img src=\"http://eviltrout.com/eviltrout.png\"></p>", // cooked("[img]http://eviltrout.com/eviltrout.png[/img]",
"BBCode is parsed first"); // "<p><img src=\"http://eviltrout.com/eviltrout.png\"></p>",
}); // "BBCode is parsed first");
// });