Index: trunk/extensions/DataTransclusion/DataTransclusionHandler.php |
— | — | @@ -133,18 +133,37 @@ |
134 | 134 | } |
135 | 135 | |
136 | 136 | static function renderTemplate( $parser, $title, $record ) { |
| 137 | + //XXX: use cached & preparsed template. $template doesn't have the right type, it seems |
| 138 | + /* |
| 139 | + list( $text, $title ) = $parser->getTemplateDom( $title ); |
| 140 | + $frame = $parser->getPreprocessor()->newCustomFrame( $record ); |
| 141 | + $text = $frame->expand( $template ); |
| 142 | + */ |
| 143 | + |
| 144 | + //XXX: trying another way. but $piece['parts'] needs to be a PPNode. how to do that? |
| 145 | + /* |
| 146 | + $frame = $parser->getPreprocessor()->newCustomFrame( $record ); |
| 147 | + |
| 148 | + $piece = array(); |
| 149 | + |
| 150 | + if ( $title->getNamespace() == NS_TEMPLATE ) $n = ""; |
| 151 | + else $n = $title->getNsText() . ":"; |
| 152 | + |
| 153 | + $piece ['title'] = $n . $title->getText(); |
| 154 | + $piece['parts'] = $record; |
| 155 | + $piece['lineStart'] = false; //XXX: ugly. can't know here whether the brace was at the start of a line |
| 156 | + |
| 157 | + $ret = $parser->braceSubstitution( $piece, $frame ); |
| 158 | + $text = $ret[ 'text' ]; |
| 159 | + */ |
| 160 | + |
| 161 | + //dumb and slow, but works |
137 | 162 | $p = new Article( $title ); |
138 | 163 | if ( !$p->exists() ) return false; |
139 | 164 | |
140 | 165 | $text = $p->getContent(); |
141 | 166 | $text = $parser->replaceVariables( $text, $record ); |
142 | 167 | |
143 | | - //FIXME: use cached & preparsed template. figure out how to... |
144 | | - /* |
145 | | - list( $text, $title ) = $parser->getTemplateDom( $title ); |
146 | | - $frame = $parser->getPreprocessor()->newCustomFrame( $record ); |
147 | | - $text = $frame->expand( $template ); |
148 | | - */ |
149 | 168 | return $text; |
150 | 169 | } |
151 | 170 | |