Index: trunk/phase3/includes/parser/Preprocessor_Hash.php |
— | — | @@ -23,6 +23,33 @@ |
24 | 24 | return new PPCustomFrame_Hash( $this, $args ); |
25 | 25 | } |
26 | 26 | |
| 27 | + function newPartNodeArray( $values ) { |
| 28 | + $list = array(); |
| 29 | + |
| 30 | + foreach ( $values as $k => $val ) { |
| 31 | + $partNode = new PPNode_Hash_Tree( 'part' ); |
| 32 | + $nameNode = new PPNode_Hash_Tree( 'name' ); |
| 33 | + |
| 34 | + if ( is_int( $k ) ) { |
| 35 | + $nameNode->addChild( new PPNode_Hash_Attr( 'index', $k ) ); |
| 36 | + $partNode->addChild( $nameNode ); |
| 37 | + } else { |
| 38 | + $nameNode->addChild( new PPNode_Hash_Text( $k ) ); |
| 39 | + $partNode->addChild( $nameNode ); |
| 40 | + $partNode->addChild( new PPNode_Hash_Text( '=' ) ); |
| 41 | + } |
| 42 | + |
| 43 | + $valueNode = new PPNode_Hash_Tree( 'value' ); |
| 44 | + $valueNode->addChild( new PPNode_Hash_Text( $val ) ); |
| 45 | + $partNode->addChild( $valueNode ); |
| 46 | + |
| 47 | + $list[] = $partNode; |
| 48 | + } |
| 49 | + |
| 50 | + $node = new PPNode_Hash_Array( $list ); |
| 51 | + return $node; |
| 52 | + } |
| 53 | + |
27 | 54 | /** |
28 | 55 | * Preprocess some wikitext and return the document tree. |
29 | 56 | * This is the ghost of Parser::replace_variables(). |