Fixed parsing problem

We need to recheck for the next terminator after a successful run match
to cope with the situation that the run match included the previously
found terminator match
print-window-tiddler
Jeremy Ruston 2012-06-05 22:01:06 +01:00
rodzic ee7fba9297
commit ad25ab4c1a
2 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -168,9 +168,11 @@ WikiTextRenderer.prototype.parseRunTerminated = function(terminatorRegExp,option
if(rule) { if(rule) {
tree.push.apply(tree,rule.parse.call(this,runRuleMatch,false)); tree.push.apply(tree,rule.parse.call(this,runRuleMatch,false));
} }
// Look for the next run rule // Look for the next run rule and the next terminator match
this.parser.runRegExp.lastIndex = this.pos; this.parser.runRegExp.lastIndex = this.pos;
runRuleMatch = this.parser.runRegExp.exec(this.source); runRuleMatch = this.parser.runRegExp.exec(this.source);
terminatorRegExp.lastIndex = this.pos;
terminatorMatch = terminatorRegExp.exec(this.source);
} }
} }
// Process the remaining text // Process the remaining text

Wyświetl plik

@ -27,6 +27,8 @@ Here is a macro <<version>>.
This is a macro with content <<link to:"HelloThere"><This is a //link// to something.>> This is a macro with content <<link to:"HelloThere"><This is a //link// to something.>>
This is another macro with content, this time including another macro: <<link to:"HelloThere"><This is a //link// to something in <<version>> of TiddlyWiki.>>. That's that.
! This is a new heading ! This is a new heading
This is a paragraph This is a paragraph
immediately after immediately after