Index: trunk/extensions/VisualEditor/modules/parser/pegTokenizer.pegjs.txt |
— | — | @@ -30,6 +30,8 @@ |
31 | 31 | }; |
32 | 32 | |
33 | 33 | // Remove escaped quotes from attributes etc |
| 34 | + // This was in the original PEG parser, but could not find anything in |
| 35 | + // MediaWiki that supports \' and \"-style escaping. So remove? -- gwicke |
34 | 36 | var unquote = function (quotec, text) { |
35 | 37 | return text.replace('\\' + quotec, quotec); |
36 | 38 | }; |
— | — | @@ -683,6 +685,7 @@ |
684 | 686 | obj.args[position] = param[1]; |
685 | 687 | position++; |
686 | 688 | } else { |
| 689 | + // Last value wins for duplicates. |
687 | 690 | obj.args[param[0]] = param[1]; |
688 | 691 | } |
689 | 692 | } |
— | — | @@ -736,7 +739,7 @@ |
737 | 740 | = "[[" |
738 | 741 | ! url |
739 | 742 | target:link_target |
740 | | - ltext:( "|" lt:link_text { return lt } )* |
| 743 | + lcontent:( "|" lt:link_text { return lt } )* |
741 | 744 | "]]" |
742 | 745 | suffix:(![ \]] tc:text_char { return tc })* { |
743 | 746 | var obj = { |
— | — | @@ -745,17 +748,22 @@ |
746 | 749 | attribs: [ |
747 | 750 | ['data-type', 'internal'] |
748 | 751 | ] |
749 | | - }; |
| 752 | + }, |
| 753 | + suffixTokens = [], |
| 754 | + textTokens = []; |
750 | 755 | obj.attribs.push(['href', target]); |
751 | | - if (ltext && ltext.length) { |
752 | | - var textTokens = ltext; |
| 756 | + if (lcontent && lcontent.length) { |
| 757 | + textTokens = lcontent; |
| 758 | + if (suffix) { |
| 759 | + suffixTokens = [{ type: 'TEXT', value: suffix.join('') }]; |
| 760 | + } |
753 | 761 | } else { |
754 | 762 | if (suffix) { |
755 | 763 | target += suffix.join(''); |
756 | 764 | } |
757 | | - var textTokens = [{type: 'TEXT', value: target}]; |
| 765 | + textTokens = [{type: 'TEXT', value: target}]; |
758 | 766 | } |
759 | | - return [obj].concat(textTokens, [{type: 'ENDTAG', name: 'a'}]); |
| 767 | + return [obj].concat(textTokens, [{type: 'ENDTAG', name: 'a'}], suffixTokens); |
760 | 768 | } |
761 | 769 | |
762 | 770 | link_target |