|
|
@ -85,21 +85,30 @@ function ParserInline() { |
|
|
|
ParserInline.prototype.skipToken = function (state) { |
|
|
|
var i, cached_pos, pos = state.pos, |
|
|
|
rules = this.ruler.getRules(''), |
|
|
|
len = rules.length; |
|
|
|
len = rules.length, |
|
|
|
maxNesting = state.md.options.maxNesting; |
|
|
|
|
|
|
|
|
|
|
|
if ((cached_pos = state.cacheGet(pos)) > 0) { |
|
|
|
state.pos = cached_pos; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (state.level < maxNesting) { |
|
|
|
for (i = 0; i < len; i++) { |
|
|
|
if (rules[i](state, true)) { |
|
|
|
state.cacheSet(pos, state.pos); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
state.pos++; |
|
|
|
|
|
|
|
} else { |
|
|
|
// If nesting level exceeded - skip tail to the end. That's not ordinary
|
|
|
|
// situation and we should not care about content.
|
|
|
|
state.pos = state.max; |
|
|
|
} |
|
|
|
|
|
|
|
state.cacheSet(pos, state.pos); |
|
|
|
}; |
|
|
|
|
|
|
@ -110,10 +119,17 @@ ParserInline.prototype.tokenize = function (state) { |
|
|
|
var ok, i, |
|
|
|
rules = this.ruler.getRules(''), |
|
|
|
len = rules.length, |
|
|
|
end = state.posMax; |
|
|
|
end = state.posMax, |
|
|
|
maxNesting = state.md.options.maxNesting; |
|
|
|
|
|
|
|
while (state.pos < end) { |
|
|
|
|
|
|
|
// If nesting level exceeded - skip tail to the end. That's not ordinary
|
|
|
|
// situation and we should not care about content.
|
|
|
|
if (state.level >= maxNesting) { |
|
|
|
state.pos = end; |
|
|
|
break; |
|
|
|
} |
|
|
|
// Try all possible rules.
|
|
|
|
// On success, rule should:
|
|
|
|
//
|
|
|
|