Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt |
— | — | @@ -461,6 +461,7 @@ |
462 | 462 | return flatten_string ( r ); |
463 | 463 | } |
464 | 464 | |
| 465 | + |
465 | 466 | wikilink_preprocessor_text |
466 | 467 | = r:( t:[^%<~[{\n\r\t|!\]} &=]+ { return t.join(''); } |
467 | 468 | / urlencoded_char |
— | — | @@ -501,6 +502,27 @@ |
502 | 503 | return flatten_string ( r ); |
503 | 504 | } |
504 | 505 | |
| 506 | +// Variants with the entire attribute on a single line |
| 507 | +attribute_preprocessor_text_line |
| 508 | + = r:( ts:(!inline_breaks t:[^=<>{\n\r&'"\t ] {return t})+ { return ts.join(''); } |
| 509 | + / directive |
| 510 | + / !inline_breaks !'\n' [&%] )* { |
| 511 | + //console.warn('prep'); |
| 512 | + return flatten_string ( r ); |
| 513 | + } |
| 514 | +attribute_preprocessor_text_single_line |
| 515 | + = r:( t:[^{&']+ { return t.join(''); } |
| 516 | + / directive |
| 517 | + / !inline_breaks !'\n' [{&] )* { |
| 518 | + return flatten_string ( r ); |
| 519 | + } |
| 520 | +attribute_preprocessor_text_double_line |
| 521 | + = r:( t:[^{&"]+ { return t.join(''); } |
| 522 | + / directive |
| 523 | + / !inline_breaks !'\n' [{&] )* { |
| 524 | + //console.warn( 'double:' + pp(r) ); |
| 525 | + return flatten_string ( r ); |
| 526 | + } |
505 | 527 | |
506 | 528 | // A document (start production) is a sequence of toplevelblocks. Tokens are |
507 | 529 | // emitted in chunks per toplevelblock to avoid buffering the full document. |
— | — | @@ -946,7 +968,7 @@ |
947 | 969 | // '=' here. |
948 | 970 | hs:( '=' inline)? |
949 | 971 | { |
950 | | - console.warn('link_text' + pp(h) + pp(hs)); |
| 972 | + //console.warn('link_text' + pp(h) + pp(hs)); |
951 | 973 | clearFlag('linkdesc'); |
952 | 974 | if( hs !== '' ) { |
953 | 975 | return h.concat(hs); |
— | — | @@ -1132,12 +1154,15 @@ |
1133 | 1155 | |
1134 | 1156 | // XXX: attributes can contain templates and template args!! |
1135 | 1157 | att_value |
1136 | | - = t:(!inline_breaks c:[^ \t'"<>='\n] { return c } )+ { |
1137 | | - return t.join(''); |
1138 | | - } |
1139 | | - // XXX: is "\"" also valid html? or just Wikitext? |
1140 | | - / "'" t:[^'>]* "'" { return unquote("'", t.join('')); } |
1141 | | - / '"' t:[^">]* '"' { return unquote('"', t.join('')); } |
| 1158 | + = "'" t:attribute_preprocessor_text_single_line "'" { return t; } |
| 1159 | + / '"' t:attribute_preprocessor_text_double_line '"' { return t; } |
| 1160 | + / attribute_preprocessor_text_line |
| 1161 | +// = t:(!inline_breaks c:[^ \t'"<>='\n] { return c } )+ { |
| 1162 | +// return t.join(''); |
| 1163 | +// } |
| 1164 | +// // XXX: is "\"" also valid html? or just Wikitext? |
| 1165 | +// / "'" t:[^'>]* "'" { return unquote("'", t.join('')); } |
| 1166 | +// / '"' t:[^">]* '"' { return unquote('"', t.join('')); } |
1142 | 1167 | |
1143 | 1168 | /* Lists */ |
1144 | 1169 | lists = e:(dtdd / li) es:(sol (dtdd / li))* |