Index: trunk/extensions/VisualEditor/modules/parser/mediawiki.parser.defines.js |
— | — | @@ -8,26 +8,63 @@ |
9 | 9 | this.attribs = attribs || []; |
10 | 10 | } |
11 | 11 | |
| 12 | +TagTk.prototype.toJSON = function () { |
| 13 | + return { |
| 14 | + type: 'TagTk', |
| 15 | + name: this.name, |
| 16 | + attribs: this.attribs |
| 17 | + }; |
| 18 | +}; |
| 19 | + |
12 | 20 | function EndTagTk( name, attribs ) { |
13 | 21 | //this.type = 'ENDTAG'; |
14 | 22 | this.name = name; |
15 | 23 | this.attribs = attribs || []; |
16 | 24 | } |
| 25 | +EndTagTk.prototype.toJSON = function () { |
| 26 | + return { |
| 27 | + type: 'EndTagTk', |
| 28 | + name: this.name, |
| 29 | + attribs: this.attribs |
| 30 | + }; |
| 31 | +}; |
| 32 | + |
17 | 33 | function SelfclosingTagTk( name, attribs ) { |
18 | 34 | //this.type = 'SELFCLOSINGTAG'; |
19 | 35 | this.name = name; |
20 | 36 | this.attribs = attribs || []; |
21 | 37 | } |
| 38 | +SelfclosingTagTk.prototype.toJSON = function () { |
| 39 | + return { |
| 40 | + type: 'SelfclosingTagTk', |
| 41 | + name: this.name, |
| 42 | + attribs: this.attribs |
| 43 | + }; |
| 44 | +}; |
| 45 | + |
22 | 46 | function NlTk( ) { |
23 | 47 | //this.type = 'NEWLINE'; |
24 | 48 | } |
| 49 | +NlTk.prototype.toJSON = function () { |
| 50 | + return { type: 'NlTk' }; |
| 51 | +}; |
| 52 | + |
25 | 53 | function CommentTk( value ) { |
26 | 54 | this.type = 'COMMENT'; |
27 | 55 | this.value = value; |
28 | 56 | } |
| 57 | +CommentTk.prototype.toJSON = function () { |
| 58 | + return { |
| 59 | + type: 'COMMENT', |
| 60 | + value: this.value |
| 61 | + }; |
| 62 | +}; |
29 | 63 | function EOFTk( ) { |
30 | 64 | this.type = 'END'; |
31 | 65 | } |
| 66 | +EOFTk.prototype.toJSON = function () { |
| 67 | + return { type: 'EOFTk' }; |
| 68 | +}; |
32 | 69 | |
33 | 70 | // A key-value pair |
34 | 71 | function KV ( k, v ) { |