REMOVE: Auto quoting confused more people than it helped.

This commit is contained in:
Robin Ward 2014-08-22 14:51:08 -04:00
parent dafc63e3a0
commit 2ae46b4742
2 changed files with 0 additions and 32 deletions
app/assets/javascripts/discourse/dialects
test/javascripts/lib

View file

@ -1,23 +0,0 @@
/**
If a line contains a single quote, convert it to a blockquote. For example:
"My fake plants died because I did not pretend to water them."
Would be:
<blockquote>My fake plants died because I did not pretend to water them.</blockquote>
**/
Discourse.Dialect.registerInline('"', function(str, match, prev) {
// Make sure we're on a line boundary
var last = prev[prev.length - 1];
if (typeof last === "string") { return; }
if (str.length > 2 && str.charAt(0) === '"' && str.charAt(str.length-1) === '"') {
var inner = str.substr(1, str.length-2);
if (inner.indexOf('"') === -1 && inner.indexOf("\n") === -1) {
return [str.length, ['blockquote', inner]];
}
}
});

View file

@ -30,15 +30,6 @@ test("basic cooking", function() {
cooked("brussel sproutes are *awful*.", "<p>brussel sproutes are <em>awful</em>.</p>", "it doesn't swallow periods.");
});
test("Auto quoting", function() {
cooked('"My fake plants died because I did not pretend to water them."',
"<p><blockquote>My fake plants died because I did not pretend to water them.</blockquote></p>",
"it converts single line quotes to blockquotes");
cooked('"hello\nworld"', "<p>\"hello<br/>world\"</p>", "It doesn't convert multi line quotes");
cooked('"hello "evil" trout"', '<p>"hello "evil" trout"</p>', "it doesn't format quotes in the middle of a line");
cooked('["text"', '<p>["text"</p>', "it recognizes leading tag-like text");
});
test("Traditional Line Breaks", function() {
var input = "1\n2\n3";
cooked(input, "<p>1<br/>2<br/>3</p>", "automatically handles trivial newlines");