Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt |
— | — | @@ -371,7 +371,7 @@ |
372 | 372 | // XXX: ] and other end delimiters should probably only be activated inside |
373 | 373 | // structures to avoid unnecessarily leaving the text production on plain |
374 | 374 | // content. |
375 | | -text = t:[^'<~\][\n\r{}]+ { return t.join(''); } |
| 375 | +text = t:[^'<~\][\n\r{}:]+ { return t.join(''); } |
376 | 376 | //text = t:[A-Za-z0-9,._ "?!\t-]+ { return t.join('') } |
377 | 377 | |
378 | 378 | // Experimental tweaked version: avoid expensive single-char substrings |
— | — | @@ -469,6 +469,7 @@ |
470 | 470 | & { return syntaxFlags['table']; } |
471 | 471 | a:(newline [!|] / '||' / '!!' / '|}') { dp("table break" + pp(a)); return true; } |
472 | 472 | / & { return syntaxFlags['linkdesc']; } link_end { return true; } |
| 473 | + / & { return syntaxFlags['colon']; } ":" { return true; } |
473 | 474 | / & { return syntaxFlags['h']; } |
474 | 475 | ( & { return syntaxFlags['h1'] } '=' newline { return true; } |
475 | 476 | / & { return syntaxFlags['h2'] } '==' newline { return true; } |
— | — | @@ -984,16 +985,23 @@ |
985 | 986 | |
986 | 987 | dtdd = bullets:(!(";" !list_char) list_char)* |
987 | 988 | ";" |
988 | | - // XXX: convert to inline stops! |
989 | | - c:(inline_element / (n:[^:\n] { return {type: 'TEXT', value: n}; }))+ |
| 989 | + & {return setFlag('colon');} |
| 990 | + c:inlineline |
990 | 991 | ":" |
| 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;} |
991 | 995 | d:inlineline |
992 | 996 | &eolf |
993 | 997 | { |
994 | | - // convert trailing space into |
| 998 | + // Convert trailing space into |
| 999 | + // XXX: This should be moved to a serializer |
995 | 1000 | 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 | + } |
998 | 1006 | } |
999 | 1007 | |
1000 | 1008 | return [ { type: 'TAG', name: 'listItem', bullets: bullets + ";" } ] |
— | — | @@ -1002,7 +1010,11 @@ |
1003 | 1011 | , d ); |
1004 | 1012 | } |
1005 | 1013 | |
| 1014 | +/ bullets:(!(";" !list_char) list_char)* |
| 1015 | + ";" |
| 1016 | + {syntaxFlags['colon'] = 0; return null; } |
1006 | 1017 | |
| 1018 | + |
1007 | 1019 | list_char = [*#:;] |
1008 | 1020 | |
1009 | 1021 | |