From 82e31ffd42c8b07bcbf855fa7e6b75c7605293c5 Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Wed, 30 Nov 2011 15:12:53 +0000 Subject: [PATCH] Do not allow newlines in various attributes --- modules/parser/pegParser.pegjs.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/parser/pegParser.pegjs.txt b/modules/parser/pegParser.pegjs.txt index 18e09e3b2f..645d88700e 100644 --- a/modules/parser/pegParser.pegjs.txt +++ b/modules/parser/pegParser.pegjs.txt @@ -647,10 +647,11 @@ extlink // = "[" target:url text:extlink_text "]" { return { type: 'extlink', target: target, text: text } } url - = proto:"http:" rest:([^ \]]+) { return proto + rest.join(''); } + = proto:"http:" rest:([^ \]\n]+) { return proto + rest.join(''); } +// XXX: convert to syntax flags and generic inline! extlink_text - = c:(inline_element / ch:[^\]] { return {type: 'TEXT', value: ch}; })+ + = c:(inline_element / ch:[^\]\n] { return {type: 'TEXT', value: ch}; })+ template = "{{" target:template_target params:("|" p:template_param { return p })* "}}" { @@ -665,7 +666,7 @@ template } template_target - = h:( !"}}" x:([^|]) { return x } )* { return h.join(''); } + = h:( !"}}" x:([^|\n]) { return x } )* { return h.join(''); } template_param = name:template_param_name "=" c:template_param_text { @@ -688,7 +689,7 @@ tplarg } template_param_name - = h:( !"}}" x:([^=|]) { return x } )* { return h.join(''); } + = h:( !"}}" x:([^=|\n]) { return x } )* { return h.join(''); } template_param_text = template_param_text_chunk* @@ -701,7 +702,7 @@ template_param_text_chunk / template / link / quote - / !"}}" x:([^|]) { return x } + / !"}}" x:([^|\n]) { return x } link = "[[" target:link_target text:("|" link_text)* "]]" { @@ -720,7 +721,7 @@ link } link_target - = h:( !"]]" x:([^|]) { return x } )* { return h.join(''); } + = h:( !"]]" x:([^|\n]) { return x } )* { return h.join(''); } link_text = h:( & { return setFlag('linkdesc'); } @@ -856,7 +857,7 @@ generic_attribute_value = "=" space* v:att_value {return v} att_value - = t:[^ \t'"<>=']+ { return [null, t.join('')]; } + = t:[^ \t'"<>='\n]+ { return [null, t.join('')]; } / "'" t:[^'>]+ "'" { return unquote("'", t.join('')); } / '"' t:[^">]+ '"' { return unquote('"', t.join('')); }