Merge pull request #263 from megawac/style-parser

This commit is contained in:
Mattias Erming 2014-10-27 22:51:18 +01:00
commit a0ed791926
1 changed files with 34 additions and 30 deletions

View File

@ -50,6 +50,7 @@ function uri(text) {
var regex = {
color: /\003([0-9]{1,2})[,]?([0-9]{1,2})?([^\003]+)/,
terminator: /\x0D/,
styles: [
[/\002([^\002]+)(\002)?/, ["<b>", "</b>"]],
[/\037([^\037]+)(\037)?/, ["<u>", "</u>"]],
@ -59,6 +60,9 @@ function colors(text) {
if (!text) {
return text;
}
if (regex.terminator.test(text)) {
return $.map(text.split(regex.terminator), colors);
}
if (regex.color.test(text)) {
var match, bg;
while (match = regex.color.exec(text)) {