r104854 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104853‎ | r104854 | r104855 >
Date:14:39, 1 December 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Add a quick html entity decoding hack, and document need for general decoder.
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt
@@ -393,7 +393,9 @@
394394 * } end of parser func/transclusion/template arg
395395 */
396396
397 -urltext = ( t:[^'<~[{\n\rfghimnstw:\]} ]+ { return t.join(''); }
 397+urltext = ( t:[^'<~[{\n\rfghimnstw:\]} &]+ { return t.join(''); }
 398+ // XXX: use general entity decode!
 399+ / "&amp;" { return "&"; } // decode ampersand in text
398400 / urllink
399401 // Convert trailing space into &nbsp;
400402 // XXX: This should be moved to a serializer
@@ -743,8 +745,11 @@
744746
745747 url
746748 = proto:url_protocol
747 - rest:( [^ :\]\[\n<>\x00-\x20\x7f,.]
748 - / s:[.:,] !(space / eolf) { return s } )+
 749+ rest:( [^ :\]\[\n<>\x00-\x20\x7f,.&]
 750+ / s:[.:,] !(space / eolf) { return s }
 751+ // XXX: use general entity decode!
 752+ / '&amp;' { return '&' }
 753+ / '&' )+
749754 {
750755 return proto + rest.join('');
751756 }

Status & tagging log