Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -3316,7 +3316,7 @@ |
3317 | 3317 | * Fetch the unparsed text of a template and register a reference to it. |
3318 | 3318 | */ |
3319 | 3319 | function fetchTemplateAndTitle( $title ) { |
3320 | | - $templateCb = $this->mOptions->getTemplateCallback(); |
| 3320 | + $templateCb = $this->mOptions->getTemplateCallback(); # Defaults to Parser::statelessFetchTemplate() |
3321 | 3321 | $stuff = call_user_func( $templateCb, $title, $this ); |
3322 | 3322 | $text = $stuff['text']; |
3323 | 3323 | $finalTitle = isset( $stuff['finalTitle'] ) ? $stuff['finalTitle'] : $title; |
— | — | @@ -4034,102 +4034,6 @@ |
4035 | 4035 | } |
4036 | 4036 | |
4037 | 4037 | /** |
4038 | | - * Merge $tree2 into $tree1 by replacing the section with index |
4039 | | - * $section in $tree1 and its descendants with the sections in $tree2. |
4040 | | - * Note that in the returned section tree, only the 'index' and |
4041 | | - * 'byteoffset' fields are guaranteed to be correct. |
4042 | | - * |
4043 | | - * @param $tree1 Array: section tree from ParserOutput::getSectons() |
4044 | | - * @param $tree2 Array: section tree |
4045 | | - * @param $section Integer: section index |
4046 | | - * @param $title Title: Title both section trees come from |
4047 | | - * @param $len2 Integer: length of the original wikitext for $tree2 |
4048 | | - * @return Array: merged section tree |
4049 | | - */ |
4050 | | - public static function mergeSectionTrees( $tree1, $tree2, $section, $title, $len2 ) { |
4051 | | - global $wgContLang; |
4052 | | - $newTree = array(); |
4053 | | - $targetLevel = false; |
4054 | | - $merged = false; |
4055 | | - $lastLevel = 1; |
4056 | | - $nextIndex = 1; |
4057 | | - $numbering = array( 0 ); |
4058 | | - $titletext = $title->getPrefixedDBkey(); |
4059 | | - foreach ( $tree1 as $s ) { |
4060 | | - if ( $targetLevel !== false ) { |
4061 | | - if ( $s['level'] <= $targetLevel ) { |
4062 | | - # We've skipped enough |
4063 | | - $targetLevel = false; |
4064 | | - } else { |
4065 | | - continue; |
4066 | | - } |
4067 | | - } |
4068 | | - if ( $s['index'] != $section || |
4069 | | - $s['fromtitle'] != $titletext ) { |
4070 | | - self::incrementNumbering( $numbering, |
4071 | | - $s['toclevel'], $lastLevel ); |
4072 | | - |
4073 | | - # Rewrite index, byteoffset and number |
4074 | | - if ( $s['fromtitle'] == $titletext ) { |
4075 | | - $s['index'] = $nextIndex++; |
4076 | | - if ( $merged ) { |
4077 | | - $s['byteoffset'] += $len2; |
4078 | | - } |
4079 | | - } |
4080 | | - $s['number'] = implode( '.', array_map( |
4081 | | - array( $wgContLang, 'formatnum' ), |
4082 | | - $numbering ) ); |
4083 | | - $lastLevel = $s['toclevel']; |
4084 | | - $newTree[] = $s; |
4085 | | - } else { |
4086 | | - # We're at $section |
4087 | | - # Insert sections from $tree2 here |
4088 | | - foreach ( $tree2 as $s2 ) { |
4089 | | - # Rewrite the fields in $s2 |
4090 | | - # before inserting it |
4091 | | - $s2['toclevel'] += $s['toclevel'] - 1; |
4092 | | - $s2['level'] += $s['level'] - 1; |
4093 | | - $s2['index'] = $nextIndex++; |
4094 | | - $s2['byteoffset'] += $s['byteoffset']; |
4095 | | - |
4096 | | - self::incrementNumbering( $numbering, |
4097 | | - $s2['toclevel'], $lastLevel ); |
4098 | | - $s2['number'] = implode( '.', array_map( |
4099 | | - array( $wgContLang, 'formatnum' ), |
4100 | | - $numbering ) ); |
4101 | | - $lastLevel = $s2['toclevel']; |
4102 | | - $newTree[] = $s2; |
4103 | | - } |
4104 | | - # Skip all descendants of $section in $tree1 |
4105 | | - $targetLevel = $s['level']; |
4106 | | - $merged = true; |
4107 | | - } |
4108 | | - } |
4109 | | - return $newTree; |
4110 | | - } |
4111 | | - |
4112 | | - /** |
4113 | | - * Increment a section number. Helper function for mergeSectionTrees() |
4114 | | - * |
4115 | | - * @param $number Array representing a section number |
4116 | | - * @param $level Integer: current TOC level (depth) |
4117 | | - * @param $lastLevel Integer: level of previous TOC entry |
4118 | | - */ |
4119 | | - private static function incrementNumbering( &$number, $level, $lastLevel ) { |
4120 | | - if ( $level > $lastLevel ) { |
4121 | | - $number[$level - 1] = 1; |
4122 | | - } elseif ( $level < $lastLevel ) { |
4123 | | - foreach ( $number as $key => $unused ) |
4124 | | - if ( $key >= $level ) { |
4125 | | - unset( $number[$key] ); |
4126 | | - } |
4127 | | - $number[$level - 1]++; |
4128 | | - } else { |
4129 | | - $number[$level - 1]++; |
4130 | | - } |
4131 | | - } |
4132 | | - |
4133 | | - /** |
4134 | 4038 | * Transform wiki markup when saving a page by doing \r\n -> \n |
4135 | 4039 | * conversion, substitting signatures, {{subst:}} templates, etc. |
4136 | 4040 | * |