Index: trunk/wiki2xml/php/xml2xhtml.php |
— | — | @@ -136,6 +136,34 @@ |
137 | 137 | |
138 | 138 | |
139 | 139 | |
| 140 | + function tag_extension ( $open , &$attrs ) { |
| 141 | + if( !defined( 'MEDIAWIKI' ) ) return ; # Only as MediaWiki extension |
| 142 | + |
| 143 | + |
| 144 | + if ( $open ) { |
| 145 | + $this->extension_name = $attrs['EXTENSION_NAME'] ; |
| 146 | + $this->extension_attrs = $attrs ; |
| 147 | + unset ( $this->extension_attrs['EXTENSION_NAME'] ) ; |
| 148 | + $this->extension_text_before = $this->s ; |
| 149 | + $this->s = "" ; |
| 150 | + } else { |
| 151 | + $extension_text = trim ( $this->s ) ; |
| 152 | + $this->s = $this->extension_text_before ; |
| 153 | + $this->extension_text_before = "" ; |
| 154 | + |
| 155 | + global $wgParser , $wgTitle ; |
| 156 | + if ( !isset ( $wgParser ) ) return ; # Paranoia |
| 157 | + if ( !isset ( $wgParser->mTagHooks[$this->extension_name] ) ) return ; # Extension has no handler |
| 158 | + |
| 159 | + if ( $extension_text == "" ) $extension_text = "<{$this->extension_name}/>" ; |
| 160 | + else $extension_text = "<{$this->extension_name}>{$extension_text}</{$this->extension_name}>" ; |
| 161 | + $options = new ParserOptions ; |
| 162 | + $s = $wgParser->parse ( $extension_text , $wgTitle , $options , false ) ; |
| 163 | + $this->add ( $s->getText() ) ; |
| 164 | + } |
| 165 | + } |
| 166 | + |
| 167 | + |
140 | 168 | function tag_paragraph ( $open , &$attrs ) { |
141 | 169 | if ( !isset ( $attrs['align'] ) ) $attrs['align'] = 'justify' ; |
142 | 170 | if ( $open ) $this->add_tag ( "p" , $attrs ) ; |