|
|
|
@ -40,6 +40,7 @@ DEFINES.WORD_LENGTH_LIMIT = 120;
|
|
|
|
|
DEFINES.S_BOL = 1;
|
|
|
|
|
DEFINES.S_QUOTE = 2;
|
|
|
|
|
DEFINES.S_BIG = 4;
|
|
|
|
|
DEFINES.S_FQUOTE = 8;
|
|
|
|
|
|
|
|
|
|
function initial_state() {
|
|
|
|
|
// state[0] = output mode
|
|
|
|
@ -308,7 +309,12 @@ OS.iku = function (token, to) {
|
|
|
|
|
state[0] |= DEFINES.S_BIG;
|
|
|
|
|
}
|
|
|
|
|
if (to & DEFINES.S_QUOTE && !(state[0] & DEFINES.S_QUOTE)) {
|
|
|
|
|
this.callback(safe('<em>'));
|
|
|
|
|
if (to & DEFINES.S_FQUOTE) {
|
|
|
|
|
this.callback(safe('<em class="fancy">'));
|
|
|
|
|
state[0] |= DEFINES.S_FQUOTE;
|
|
|
|
|
} else {
|
|
|
|
|
this.callback(safe('<em>'));
|
|
|
|
|
}
|
|
|
|
|
state[0] |= DEFINES.S_QUOTE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -340,7 +346,7 @@ OS.fragment = function (frag) {
|
|
|
|
|
if (i % 2) {
|
|
|
|
|
var to = 'SPOIL';
|
|
|
|
|
if (chunk[1] == '/' && state[1] < 1)
|
|
|
|
|
to = state[0] & DEFINES.S_QUOTE;
|
|
|
|
|
to = state[0] & (DEFINES.S_QUOTE | DEFINES.S_FQUOTE);
|
|
|
|
|
this.iku(chunk, to);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -354,12 +360,16 @@ OS.fragment = function (frag) {
|
|
|
|
|
var to = DEFINES.S_BIG;
|
|
|
|
|
if (/[>>]/.test(line[2]))
|
|
|
|
|
to |= DEFINES.S_QUOTE;
|
|
|
|
|
else if (/»/.test(line[2]))
|
|
|
|
|
to |= DEFINES.S_QUOTE | DEFINES.S_FQUOTE;
|
|
|
|
|
this.iku(line.slice(2), to);
|
|
|
|
|
}
|
|
|
|
|
else if (is_bol && /^[>>]/.test(line))
|
|
|
|
|
this.iku(line, DEFINES.S_QUOTE);
|
|
|
|
|
else if (is_bol && /^»/.test(line))
|
|
|
|
|
this.iku(line, DEFINES.S_QUOTE | DEFINES.S_FQUOTE);
|
|
|
|
|
else if (line)
|
|
|
|
|
this.iku(line, state[0] & (DEFINES.S_QUOTE | DEFINES.S_BIG));
|
|
|
|
|
this.iku(line, state[0] & (DEFINES.S_QUOTE | DEFINES.S_BIG | DEFINES.S_FQUOTE));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -368,6 +378,8 @@ OS.close_out = function () {
|
|
|
|
|
if (this.state[0] & DEFINES.S_QUOTE) {
|
|
|
|
|
this.callback(safe('</em>'));
|
|
|
|
|
this.state[0] -= DEFINES.S_QUOTE;
|
|
|
|
|
if(this.state[0] & DEFINES.S_FQUOTE)
|
|
|
|
|
this.state[0] -= DEFINES.S_FQUOTE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.state[0] & DEFINES.S_BIG) {
|
|
|
|
|