Fix nowiki tokenization regression introduced r110495

This commit is contained in:
Gabriel Wicke 2012-02-03 13:10:04 +00:00
parent 26f2026cff
commit 0bea9fdfbb
Notes: Gabriel Wicke 2012-02-27 16:40:01 +00:00

View file

@ -879,24 +879,31 @@ pre
nowiki
= "<nowiki>" nc:nowiki_content "</nowiki>" {
// console.log(pp(nc));
//console.log( 'full nowiki return: ' + pp(nc));
return nc;
}
/ "<nowiki>" {
//console.log('nowiki fallback');
return ['<nowiki>'];
}
/ "</nowiki>" { return ['</nowiki>']; }
/ "</nowiki>" {
//console.log('nowiki end fallback');
return ['</nowiki>'];
}
nowiki_content
= ts:( t:[^<]+ { return t.join('') }
/ "<pre" p0:space* p1:[^>]* ">" p2:nowiki_content "</pre>" {
//console.log('nested pre in nowiki');
return ["<pre"].concat(p0, p1, [">"], [p2[0].value], ["</pre>"]).join('');
return ["<pre"].concat(p0, p1, [">"], p2, ["</pre>"]).join('');
}
/ (!("</nowiki>" / "</pre>") c:. {return c})
/ (!("</"( "nowiki>" / "pre>")) c:. {
//console.log('nowiki: single char' + c);
return c;
})
)* {
// return nowiki tags as well?
//console.log('nowiki_content: return' + pp(ts));
return [ts.join('')];
}