Still hate switches.

This commit is contained in:
Zixaphir 2014-01-19 21:38:46 -07:00
parent f37484cd33
commit 11e5f348f0
3 changed files with 39 additions and 77 deletions

View File

@ -3408,32 +3408,19 @@
return Get.insert(post, root, context);
},
parseMarkup: function(text) {
switch (text) {
case '\n':
return '<br>';
case '[b]':
return '<b>';
case '[/b]':
return '</b>';
case '[spoiler]':
return '<s>';
case '[/spoiler]':
return '</s>';
case '[code]':
return '<pre class=prettyprint>';
case '[/code]':
return '</pre>';
case '[moot]':
return '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">';
case '[/moot]':
return '</div>';
case '[banned]':
return '<strong style="color: red;">';
case '[/banned]':
return '</strong>';
default:
return text.replace(':lit', '');
}
return {
'\n': '<br>',
'[b]': '<b>',
'[/b]': '</b>',
'[spoiler]': '<s>',
'[/spoiler]': '</s>',
'[code]': '<pre class=prettyprint>',
'[/code]': '</pre>',
'[moot]': '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">',
'[/moot]': '</div>',
'[banned]': '<strong style="color: red;">',
'[/banned]': '</strong>'
}[text] || text.replace(':lit', '');
}
};

View File

@ -3418,32 +3418,19 @@
return Get.insert(post, root, context);
},
parseMarkup: function(text) {
switch (text) {
case '\n':
return '<br>';
case '[b]':
return '<b>';
case '[/b]':
return '</b>';
case '[spoiler]':
return '<s>';
case '[/spoiler]':
return '</s>';
case '[code]':
return '<pre class=prettyprint>';
case '[/code]':
return '</pre>';
case '[moot]':
return '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">';
case '[/moot]':
return '</div>';
case '[banned]':
return '<strong style="color: red;">';
case '[/banned]':
return '</strong>';
default:
return text.replace(':lit', '');
}
return {
'\n': '<br>',
'[b]': '<b>',
'[/b]': '</b>',
'[spoiler]': '<s>',
'[/spoiler]': '</s>',
'[code]': '<pre class=prettyprint>',
'[/code]': '</pre>',
'[moot]': '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">',
'[/moot]': '</div>',
'[banned]': '<strong style="color: red;">',
'[/banned]': '</strong>'
}[text] || text.replace(':lit', '');
}
};

View File

@ -215,28 +215,16 @@ Get =
Main.callbackNodes Post, [post]
Get.insert post, root, context
parseMarkup: (text) ->
switch text
when '\n'
'<br>'
when '[b]'
'<b>'
when '[/b]'
'</b>'
when '[spoiler]'
'<s>'
when '[/spoiler]'
'</s>'
when '[code]'
'<pre class=prettyprint>'
when '[/code]'
'</pre>'
when '[moot]'
'<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">'
when '[/moot]'
'</div>'
when '[banned]'
'<strong style="color: red;">'
when '[/banned]'
'</strong>'
else
text.replace ':lit', ''
{
'\n': '<br>'
'[b]': '<b>'
'[/b]': '</b>'
'[spoiler]': '<s>'
'[/spoiler]': '</s>'
'[code]': '<pre class=prettyprint>'
'[/code]': '</pre>'
'[moot]': '<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">'
'[/moot]': '</div>'
'[banned]': '<strong style="color: red;">'
'[/banned]': '</strong>'
}[text] or text.replace ':lit', ''