Index: trunk/extensions/Babel/Babel.class.php |
— | — | @@ -37,19 +37,21 @@ |
38 | 38 | if ( $name === '' ) { |
39 | 39 | continue; |
40 | 40 | } elseif ( self::mPageExists( $template ) ) { |
| 41 | + // Existent template page has precedence |
41 | 42 | if ( count($templateParameters) ) { |
42 | 43 | $template .= '|'.implode('|', $templateParameters); |
43 | 44 | } |
44 | | - $content .= $parser->replaceVariables( "{{{$template}}}" ); |
| 45 | + $content .= self::mGenerateNotaBox( $parser->replaceVariables( "{{{$template}}}" ) ); |
45 | 46 | } elseif ( $components !== false ) { |
| 47 | + // Non-existent page and valid parameter syntax, babel box |
46 | 48 | $content .= self::mGenerateBox( $components['code'], $components['level'] ); |
47 | 49 | $content .= self::mGenerateCategories( $components['code'], $components['level'] ); |
48 | 50 | } elseif ( self::mValidTitle( $template ) ) { |
49 | 51 | // Non-existent page and invalid parameter syntax, red link. |
50 | | - $content .= "\n[[$template]]"; |
| 52 | + $content .= self::mGenerateNotaBox( '[['.$template.']]' ); |
51 | 53 | } else { |
52 | 54 | // Invalid title, output raw. |
53 | | - $content .= "\n$template"; |
| 55 | + $content .= self::mGenerateNotaBox( $template ); |
54 | 56 | } |
55 | 57 | } |
56 | 58 | |
— | — | @@ -173,6 +175,20 @@ |
174 | 176 | } |
175 | 177 | |
176 | 178 | /** |
| 179 | + * Generate an inner box which is not a babel box. |
| 180 | + * |
| 181 | + * @param $coontent String: what's inside the box, in wikitext format. |
| 182 | + * @return String: A single non-babel box, in wikitext format. |
| 183 | + */ |
| 184 | + protected static function mGenerateNotaBox( $content ) { |
| 185 | + $dir_content = wfMessage( 'babel-directionality' )->inContentLanguage()->text(); |
| 186 | + $notabox = <<<EOT |
| 187 | +<div class="mw-babel-notabox" dir="$dir_content">$content</div> |
| 188 | +EOT; |
| 189 | + return $notabox; |
| 190 | + } |
| 191 | + |
| 192 | + /** |
177 | 193 | * Generate a babel box for the given language and level. |
178 | 194 | * |
179 | 195 | * @param $code String: Language code to use. |