r104685 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104684‎ | r104685 | r104686 >
Date:14:53, 30 November 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Allow inlines in the term part of ; term : definition
Modified paths:
  • /trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt
@@ -371,7 +371,7 @@
372372 // XXX: ] and other end delimiters should probably only be activated inside
373373 // structures to avoid unnecessarily leaving the text production on plain
374374 // content.
375 -text = t:[^'<~\][\n\r{}]+ { return t.join(''); }
 375+text = t:[^'<~\][\n\r{}:]+ { return t.join(''); }
376376 //text = t:[A-Za-z0-9,._ "?!\t-]+ { return t.join('') }
377377
378378 // Experimental tweaked version: avoid expensive single-char substrings
@@ -469,6 +469,7 @@
470470 & { return syntaxFlags['table']; }
471471 a:(newline [!|] / '||' / '!!' / '|}') { dp("table break" + pp(a)); return true; }
472472 / & { return syntaxFlags['linkdesc']; } link_end { return true; }
 473+ / & { return syntaxFlags['colon']; } ":" { return true; }
473474 / & { return syntaxFlags['h']; }
474475 ( & { return syntaxFlags['h1'] } '=' newline { return true; }
475476 / & { return syntaxFlags['h2'] } '==' newline { return true; }
@@ -984,16 +985,23 @@
985986
986987 dtdd = bullets:(!(";" !list_char) list_char)*
987988 ";"
988 - // XXX: convert to inline stops!
989 - c:(inline_element / (n:[^:\n] { return {type: 'TEXT', value: n}; }))+
 989+ & {return setFlag('colon');}
 990+ c:inlineline
990991 ":"
 992+ // Fortunately dtdds cannot be nested, so we can simply set the flag
 993+ // back to 0 to disable it.
 994+ & {syntaxFlags['colon'] = 0; return true;}
991995 d:inlineline
992996 &eolf
993997 {
994 - // convert trailing space into &nbsp;
 998+ // Convert trailing space into &nbsp;
 999+ // XXX: This should be moved to a serializer
9951000 var clen = c.length;
996 - if (clen && c[clen - 1].type === 'TEXT' && c[clen - 1].value == ' ') {
997 - c[clen - 1].value = "\u00a0";
 1001+ if (clen && c[clen - 1].type === 'TEXT') {
 1002+ var val = c[clen - 1].value;
 1003+ if(val.length && val[val.length - 1] == ' ') {
 1004+ c[clen - 1].value = val.substr(0, val.length - 1) + "\u00a0";
 1005+ }
9981006 }
9991007
10001008 return [ { type: 'TAG', name: 'listItem', bullets: bullets + ";" } ]
@@ -1002,7 +1010,11 @@
10031011 , d );
10041012 }
10051013
 1014+/ bullets:(!(";" !list_char) list_char)*
 1015+ ";"
 1016+ {syntaxFlags['colon'] = 0; return null; }
10061017
 1018+
10071019 list_char = [*#:;]
10081020
10091021

Status & tagging log