Support nested colours

This commit is contained in:
megawac 2014-10-25 15:16:54 -04:00
parent 3fc80efd7c
commit 3d5e070c56
1 changed files with 4 additions and 2 deletions

View File

@ -60,10 +60,12 @@ function colors(text) {
return text; return text;
} }
if (regex.color.test(text)) { if (regex.color.test(text)) {
var match; var match, bg;
while (match = regex.color.exec(text)) { while (match = regex.color.exec(text)) {
var color = "color-" + match[1]; var color = "color-" + match[1];
var bg = match[2]; if (match[2]) {
bg = match[2];
}
if (bg) { if (bg) {
color += " bg-" + bg; color += " bg-" + bg;
} }