mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Another tokenizer robustness improvement
This patch fixes a tokenizer syntax error encountered on [[:en:Template:JacksonvilleWikiProject-Member]] and [[:en:Template:Infobox former country]] by allowing optional whitespace before start-of-line template syntax. Change-Id: Ic214a731de58bf766e51f23d5e24ea2ce6788f58
This commit is contained in:
parent
a133768781
commit
c5d7e01944
|
@ -205,12 +205,15 @@ PegTokenizer.prototype.inline_breaks = function (input, pos, stops ) {
|
|||
! counters.linkdesc || null;
|
||||
case "\r":
|
||||
return stops.onStack( 'table' ) &&
|
||||
input.substr(pos, 4).match(/\r\n?[!|]/) !== null ||
|
||||
input.substr(pos).match(/\r\n?\s*[!|]/) !== null ||
|
||||
null;
|
||||
case "\n":
|
||||
return stops.onStack( 'table' ) &&
|
||||
input[pos + 1] === '!' ||
|
||||
input[pos + 1] === '|' ||
|
||||
return ( stops.onStack( 'table' ) &&
|
||||
// allow leading whitespace in tables
|
||||
input.substr(pos, 200).match( /^\n\s*[!|]/ ) ) ||
|
||||
// break on table-like syntax when the table stop is not
|
||||
// enabled. XXX: see if this can be improved
|
||||
input.substr(pos, 200).match( /^\n[!|]/ ) ||
|
||||
null;
|
||||
case "]":
|
||||
return stops.onStack( 'extlink' ) ||
|
||||
|
|
|
@ -1483,7 +1483,7 @@ table_heading_tag
|
|||
}
|
||||
|
||||
table_end_tag
|
||||
= pipe "}" {
|
||||
= space* pipe "}" {
|
||||
var tok = [new EndTagTk( 'table' )];
|
||||
return tok;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue