r95291 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95290‎ | r95291 | r95292 >
Date:00:51, 23 August 2011
Author:inez
Status:deferred
Tags:
Comment:
Not completly done yet getWikiDom for ListBlock
Modified paths:
  • /trunk/parsers/wikidom/lib/es/es.ListBlock.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/es/es.ListBlock.js
@@ -356,7 +356,44 @@
357357 };
358358
359359 es.ListBlock.prototype.getWikiDom = function() {
 360+ var items = this.list.items;
 361+ var stack = [];
360362
 363+ for ( var i = 0; i < items.length; i++ ) {
 364+ var item = items[i];
 365+ var itemLevel = item.getLevel();
 366+
 367+ if ( itemLevel + 1 > stack.length ) {
 368+ for( var j = stack.length; j < itemLevel + 1; j++ ) {
 369+ stack.push( {
 370+ 'style' : item.getStyle(j),
 371+ 'items' : []
 372+ } );
 373+ }
 374+ }
 375+
 376+ if ( itemLevel + 1 < stack.length ) {
 377+ for( var j = stack.length; j > itemLevel + 1; j-- ) {
 378+ if ( stack[stack.length - 2].items.length === 0 ) {
 379+ stack[stack.length - 2].items.push( {
 380+ 'lists' : []
 381+ } );
 382+ } else if( !stack[stack.length - 2].items[stack[stack.length - 2].items.length - 1].lists ) {
 383+ stack[stack.length - 2].items[stack[stack.length - 2].items.length - 1].lists = [];
 384+ }
 385+ stack[stack.length - 2].items[stack[stack.length - 2].items.length - 1].lists.push( stack.pop() );
 386+ }
 387+ }
 388+
 389+ if ( itemLevel + 1 === stack.length ) {
 390+ stack[stack.length - 1].items.push( {
 391+ 'line' : item.content.getWikiDomLines()[0] }
 392+ );
 393+ }
 394+ }
 395+
 396+ stack[0].type = 'list';
 397+ return stack[0];
361398 };
362399
363400 /* Registration */

Status & tagging log