Revert "New API for replacing elements in the final JsonML. Also changes spoiler"

This reverts commit 6b9b2d3d6ad0dfc026fbf66d250220eab2c8c8fe.

We have come up with a better solution that does not involve HTML
parsing.
This commit is contained in:
Robin Ward
2014-01-21 12:04:26 -05:00
parent 3c2d4070a8
commit 3c3449aa1b
3 changed files with 8 additions and 92 deletions

View File

@ -1,8 +1,8 @@
module("Discourse.BBCode");
var format = function(input, expected, text) {
var cooked = Discourse.Markdown.cook(input, {lookupAvatar: false}).replace(/'/g, "\"");
equal(cooked, "<p>" + expected.replace(/'/g, "\"") + "</p>", text);
var cooked = Discourse.Markdown.cook(input, {lookupAvatar: false});
equal(cooked, "<p>" + expected + "</p>", text);
};
test('basic bbcode', function() {
@ -30,15 +30,8 @@ test('code', function() {
});
test('spoiler', function() {
format("[spoiler][/spoiler]", "", "it can spoil nothing");
format("[spoiler]it's a sled[/spoiler]", "<span class=\"spoiler\">it's a sled</span>", "supports spoiler tags on text");
format("[spoiler]<img src='http://eviltrout.com/eviltrout.png' width='50' height='50'>[/spoiler]", "<div class=\"spoiler\"><img src='http://eviltrout.com/eviltrout.png' width='50' height='50'/></div>", "supports spoiler tags on images");
format("foo bar[spoiler]aaa <img src='#'> bbb[/spoiler]",
"foo bar<span class='spoiler'>aaa </span><div class='spoiler'><img src='#'/></div><span class='spoiler'> bbb</span>",
"It wraps images and text differently in the same block");
format("[spoiler]<a href='#'>hello</a>[/spoiler]",
"<span class='spoiler'><a href='#'>hello</a></span>",
"It surrounds other HTML");
format("[spoiler]<img src='http://eviltrout.com/eviltrout.png' width='50' height='50'>[/spoiler]", "<div class=\"spoiler\"><img src='http://eviltrout.com/eviltrout.png' width='50' height='50'></div>", "supports spoiler tags on images");
});
test('lists', function() {