r101984 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101983‎ | r101984 | r101985 >
Date:12:25, 4 November 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Rename definitiondata to definitiondescription, minor fixes
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/serializers/es.HtmlSerializer.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/serializers/es.WikitextSerializer.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt (modified) (history)
  • /trunk/extensions/VisualEditor/tests/parser/parserTests.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js
@@ -137,8 +137,6 @@
138138 'references': MWReferencesTagHook
139139 }
140140 });
141 - // XXX: hack
142 - tree.children = tree.content;
143141 var res = es.HtmlSerializer.stringify(tree,environment);
144142 if (err) {
145143 console.log('RENDER FAIL', err);
Index: trunk/extensions/VisualEditor/modules/es/serializers/es.HtmlSerializer.js
@@ -100,10 +100,10 @@
101101 var minLength = Math.min(x.length, y.length);
102102 for(var i = 0; i < minLength; i++) {
103103 if (x[i] !== y[i]) {
104 - // Both definitiondata and definitionterm are
 104+ // Both definitiondescription and definitionterm are
105105 // inside dls, so consider them equivalent here.
106106 var diffs = [x[i], y[i]].sort();
107 - if (diffs[0] !== 'definitiondata'
 107+ if (diffs[0] !== 'definitiondescription'
108108 && diffs[1] !== 'definitionterm' ) {
109109 break;
110110 }
@@ -134,7 +134,7 @@
135135 closeTags.push(es.Html.makeClosingTag('ol'));
136136 break;
137137 case 'definitionterm':
138 - case 'definitiondata':
 138+ case 'definitiondescription':
139139 out.push(es.Html.makeOpeningTag('dl', attribs));
140140 closeTags.push(es.Html.makeClosingTag('dl'));
141141 break;
@@ -144,8 +144,7 @@
145145 };
146146 }
147147
148 - var childrenLength = node.children.length;
149 - for (var i = 0; i < childrenLength; i++) {
 148+ for (var i = 0, length = node.children.length; i < length; i++) {
150149 var e = node.children[i];
151150 bnext = e.attributes.styles;
152151 delete e.attributes['styles'];
@@ -154,7 +153,7 @@
155154 switch(bnext[bnext.length - 1]) {
156155 case 'definitionterm':
157156 tag = 'dt'; break;
158 - case 'definitiondata':
 157+ case 'definitiondescription':
159158 tag = 'dd'; break;
160159 default:
161160 tag = 'li'; break;
Index: trunk/extensions/VisualEditor/modules/es/serializers/es.WikitextSerializer.js
@@ -79,7 +79,9 @@
8080 es.WikitextSerializer.prototype.list = function( node ) {
8181 var symbolTable = {
8282 'bullet': '*',
83 - 'number': '#'
 83+ 'number': '#',
 84+ 'definitionterm': ';',
 85+ 'definitiondescription': ':'
8486 };
8587 function convertStyles( styles ) {
8688 var symbols = '';
Index: trunk/extensions/VisualEditor/modules/parser/pegParser.pegjs.txt
@@ -95,7 +95,7 @@
9696 case ';':
9797 bTypes.push('definitionterm'); break;
9898 case ':':
99 - bTypes.push('definitiondata'); break;
 99+ bTypes.push('definitiondescription'); break;
100100 }
101101 }
102102 return bTypes;
@@ -115,7 +115,7 @@
116116 dp(es);
117117 return {
118118 type: 'page',
119 - content: es
 119+ children: es
120120 }
121121 }
122122
@@ -313,6 +313,7 @@
314314 return out;
315315 }
316316
 317+// TODO: convert all these to annotations!
317318 inline_element
318319 = comment
319320 / xmlish_tag

Status & tagging log