r104690 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104689‎ | r104690 | r104691 >
Date:15:12, 30 November 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Do not allow newlines in various attributes
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt
@@ -647,10 +647,11 @@
648648 // = "[" target:url text:extlink_text "]" { return { type: 'extlink', target: target, text: text } }
649649
650650 url
651 - = proto:"http:" rest:([^ \]]+) { return proto + rest.join(''); }
 651+ = proto:"http:" rest:([^ \]\n]+) { return proto + rest.join(''); }
652652
 653+// XXX: convert to syntax flags and generic inline!
653654 extlink_text
654 - = c:(inline_element / ch:[^\]] { return {type: 'TEXT', value: ch}; })+
 655+ = c:(inline_element / ch:[^\]\n] { return {type: 'TEXT', value: ch}; })+
655656
656657 template
657658 = "{{" target:template_target params:("|" p:template_param { return p })* "}}" {
@@ -665,7 +666,7 @@
666667 }
667668
668669 template_target
669 - = h:( !"}}" x:([^|]) { return x } )* { return h.join(''); }
 670+ = h:( !"}}" x:([^|\n]) { return x } )* { return h.join(''); }
670671
671672 template_param
672673 = name:template_param_name "=" c:template_param_text {
@@ -688,7 +689,7 @@
689690 }
690691
691692 template_param_name
692 - = h:( !"}}" x:([^=|]) { return x } )* { return h.join(''); }
 693+ = h:( !"}}" x:([^=|\n]) { return x } )* { return h.join(''); }
693694
694695 template_param_text
695696 = template_param_text_chunk*
@@ -701,7 +702,7 @@
702703 / template
703704 / link
704705 / quote
705 - / !"}}" x:([^|]) { return x }
 706+ / !"}}" x:([^|\n]) { return x }
706707
707708 link
708709 = "[[" target:link_target text:("|" link_text)* "]]" {
@@ -720,7 +721,7 @@
721722 }
722723
723724 link_target
724 - = h:( !"]]" x:([^|]) { return x } )* { return h.join(''); }
 725+ = h:( !"]]" x:([^|\n]) { return x } )* { return h.join(''); }
725726
726727 link_text
727728 = h:( & { return setFlag('linkdesc'); }
@@ -856,7 +857,7 @@
857858 = "=" space* v:att_value {return v}
858859
859860 att_value
860 - = t:[^ \t'"<>=']+ { return [null, t.join('')]; }
 861+ = t:[^ \t'"<>='\n]+ { return [null, t.join('')]; }
861862 / "'" t:[^'>]+ "'" { return unquote("'", t.join('')); }
862863 / '"' t:[^">]+ '"' { return unquote('"', t.join('')); }
863864

Status & tagging log