Index: trunk/extensions/VisualEditor/modules/es/serializers/es.HtmlSerializer.js |
— | — | @@ -99,13 +99,14 @@ |
100 | 100 | var commonPrefixLength = function (x, y) { |
101 | 101 | var minLength = Math.min(x.length, y.length); |
102 | 102 | for(var i = 0; i < minLength; i++) { |
103 | | - if (x[i] !== y[i] |
| 103 | + if (x[i] !== y[i]) { |
104 | 104 | // Both definitiondata and definitionterm are |
105 | 105 | // inside dls, so consider them equivalent here. |
106 | | - && [x[i], y[i]].sort() |
107 | | - !== ['definitiondata', 'definitionterm'] ) |
108 | | - { |
| 106 | + var diffs = [x[i], y[i]].sort(); |
| 107 | + if (diffs[0] !== 'definitiondata' |
| 108 | + && diffs[1] !== 'definitionterm' ) { |
109 | 109 | break; |
| 110 | + } |
110 | 111 | } |
111 | 112 | } |
112 | 113 | return i; |
Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt |
— | — | @@ -55,8 +55,8 @@ |
56 | 56 | var level_padding = ""; |
57 | 57 | var bracket_level_padding = ""; |
58 | 58 | |
59 | | - for (var j = 0; j < level + 1; j++) level_padding += " "; |
60 | | - for (var b = 0; b < level; b++) bracket_level_padding += " "; |
| 59 | + for (var j = 0; j < level + 1; j++) level_padding += " "; |
| 60 | + for (var b = 0; b < level; b++) bracket_level_padding += " "; |
61 | 61 | |
62 | 62 | if (typeof(arr) == 'object') { //Array/Hashes/Objects |
63 | 63 | dumped_text += "Array\n"; |
— | — | @@ -74,8 +74,8 @@ |
75 | 75 | |
76 | 76 | } |
77 | 77 | dumped_text += bracket_level_padding + ")\n\n"; |
78 | | - } else { //Stings/Chars/Numbers etc. |
79 | | - dumped_text = "===>" + arr + "<===(" + typeof(arr) + ")"; |
| 78 | + } else { //Strings/Chars/Numbers etc. |
| 79 | + dumped_text = "=>" + arr + "<=(" + typeof(arr) + ")"; |
80 | 80 | } |
81 | 81 | |
82 | 82 | return dumped_text; |
— | — | @@ -566,19 +566,20 @@ |
567 | 567 | |
568 | 568 | lists = es:(dtdd / li)+ |
569 | 569 | { |
570 | | - // flatten es |
| 570 | + // Flatten es |
571 | 571 | var esLen = es.length; |
572 | 572 | var flatEs = []; |
573 | 573 | for (var i = 0; i < esLen; i++) { |
574 | | - if (es[i].constructor === Array) { |
575 | | - flatEs.concat(es[i]); |
| 574 | + var ei = es[i]; |
| 575 | + if ($.isArray(ei)) { |
| 576 | + flatEs = flatEs.concat(ei); |
576 | 577 | } else { |
577 | | - flatEs.push(es[i]); |
| 578 | + flatEs.push(ei); |
578 | 579 | } |
579 | 580 | } |
580 | 581 | return { |
581 | 582 | type: 'list', |
582 | | - children: es |
| 583 | + children: flatEs |
583 | 584 | } |
584 | 585 | } |
585 | 586 | |
— | — | @@ -598,7 +599,7 @@ |
599 | 600 | dtdd = bullets:list_char+ |
600 | 601 | c:(inline_element / [^:\n])+ |
601 | 602 | ":" |
602 | | - d:(inline / anyline) |
| 603 | + d:(inline_element / [^\n])+ |
603 | 604 | newline |
604 | 605 | { |
605 | 606 | // reject rule if bullets do not end in semicolon |
— | — | @@ -609,12 +610,12 @@ |
610 | 611 | { |
611 | 612 | type: 'listItem', |
612 | 613 | attributes: {styles: bulletsToTypes(bullets)}, |
613 | | - content: c[0] |
| 614 | + content: {text: c.join('')} |
614 | 615 | }, { |
615 | 616 | type: 'listItem', |
616 | 617 | attributes: {styles: bulletsToTypes( |
617 | 618 | bullets.slice(0, bullets.length - 1) + ':')}, |
618 | | - content: d[0] |
| 619 | + content: {text: d.join('')} |
619 | 620 | } |
620 | 621 | ] |
621 | 622 | } |