Index: trunk/parsers/wikidom/lib/es/es.ListBlock.js |
— | — | @@ -358,10 +358,29 @@ |
359 | 359 | es.ListBlock.prototype.getWikiDom = function() { |
360 | 360 | var items = this.list.items; |
361 | 361 | var stack = []; |
| 362 | + var lastStyle = null; |
362 | 363 | |
363 | 364 | for ( var i = 0; i < items.length; i++ ) { |
364 | 365 | var item = items[i]; |
365 | 366 | var itemLevel = item.getLevel(); |
| 367 | + |
| 368 | + if ( itemLevel + 1 === stack.length ) { |
| 369 | + if ( lastStyle !== null && lastStyle != item.getStyle() ) { |
| 370 | + if ( stack[stack.length - 2].items.length === 0 ) { |
| 371 | + stack[stack.length - 2].items.push( { |
| 372 | + 'lists' : [] |
| 373 | + } ); |
| 374 | + } else if( !stack[stack.length - 2].items[stack[stack.length - 2].items.length - 1].lists ) { |
| 375 | + stack[stack.length - 2].items[stack[stack.length - 2].items.length - 1].lists = []; |
| 376 | + } |
| 377 | + stack[stack.length - 2].items[stack[stack.length - 2].items.length - 1].lists.push( stack.pop() ); |
| 378 | + stack.push( { |
| 379 | + 'style' : item.getStyle(), |
| 380 | + 'items' : [] |
| 381 | + } ); |
| 382 | + lastStyle = item.getStyle(); |
| 383 | + } |
| 384 | + } |
366 | 385 | |
367 | 386 | if ( itemLevel + 1 > stack.length ) { |
368 | 387 | for( var j = stack.length; j < itemLevel + 1; j++ ) { |
— | — | @@ -389,6 +408,7 @@ |
390 | 409 | stack[stack.length - 1].items.push( { |
391 | 410 | 'line' : item.content.getWikiDomLines()[0] } |
392 | 411 | ); |
| 412 | + lastStyle = item.getStyle(); |
393 | 413 | } |
394 | 414 | } |
395 | 415 | |