Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -1,1884 +0,0 @@ |
2 | | -<?php |
3 | | -# Copyright (C) 2004, 2010 Brion Vibber <brion@pobox.com> |
4 | | -# http://www.mediawiki.org/ |
5 | | -# |
6 | | -# This program is free software; you can redistribute it and/or modify |
7 | | -# it under the terms of the GNU General Public License as published by |
8 | | -# the Free Software Foundation; either version 2 of the License, or |
9 | | -# (at your option) any later version. |
10 | | -# |
11 | | -# This program is distributed in the hope that it will be useful, |
12 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | -# GNU General Public License for more details. |
15 | | -# |
16 | | -# You should have received a copy of the GNU General Public License along |
17 | | -# with this program; if not, write to the Free Software Foundation, Inc., |
18 | | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | | -# http://www.gnu.org/copyleft/gpl.html |
20 | | - |
21 | | -/** |
22 | | - * @todo Make this more independent of the configuration (and if possible the database) |
23 | | - * @todo document |
24 | | - * @file |
25 | | - * @ingroup Maintenance |
26 | | - */ |
27 | | - |
28 | | -/** |
29 | | - * @ingroup Maintenance |
30 | | - */ |
31 | | -class ParserTest { |
32 | | - /** |
33 | | - * boolean $color whereas output should be colorized |
34 | | - */ |
35 | | - private $color; |
36 | | - |
37 | | - /** |
38 | | - * boolean $showOutput Show test output |
39 | | - */ |
40 | | - private $showOutput; |
41 | | - |
42 | | - /** |
43 | | - * boolean $useTemporaryTables Use temporary tables for the temporary database |
44 | | - */ |
45 | | - private $useTemporaryTables = true; |
46 | | - |
47 | | - /** |
48 | | - * boolean $databaseSetupDone True if the database has been set up |
49 | | - */ |
50 | | - private $databaseSetupDone = false; |
51 | | - |
52 | | - /** |
53 | | - * string $oldTablePrefix Original table prefix |
54 | | - */ |
55 | | - private $oldTablePrefix; |
56 | | - |
57 | | - private $maxFuzzTestLength = 300; |
58 | | - private $fuzzSeed = 0; |
59 | | - private $memoryLimit = 50; |
60 | | - |
61 | | - /** |
62 | | - * Sets terminal colorization and diff/quick modes depending on OS and |
63 | | - * command-line options (--color and --quick). |
64 | | - */ |
65 | | - public function ParserTest( $options = array() ) { |
66 | | - # Only colorize output if stdout is a terminal. |
67 | | - $this->color = !wfIsWindows() && posix_isatty( 1 ); |
68 | | - |
69 | | - if ( isset( $options['color'] ) ) { |
70 | | - switch( $options['color'] ) { |
71 | | - case 'no': |
72 | | - $this->color = false; |
73 | | - break; |
74 | | - case 'yes': |
75 | | - default: |
76 | | - $this->color = true; |
77 | | - break; |
78 | | - } |
79 | | - } |
80 | | - |
81 | | - $this->term = $this->color |
82 | | - ? new AnsiTermColorer() |
83 | | - : new DummyTermColorer(); |
84 | | - |
85 | | - $this->showDiffs = !isset( $options['quick'] ); |
86 | | - $this->showProgress = !isset( $options['quiet'] ); |
87 | | - $this->showFailure = !( |
88 | | - isset( $options['quiet'] ) |
89 | | - && ( isset( $options['record'] ) |
90 | | - || isset( $options['compare'] ) ) ); // redundant output |
91 | | - |
92 | | - $this->showOutput = isset( $options['show-output'] ); |
93 | | - |
94 | | - |
95 | | - if ( isset( $options['regex'] ) ) { |
96 | | - if ( isset( $options['record'] ) ) { |
97 | | - echo "Warning: --record cannot be used with --regex, disabling --record\n"; |
98 | | - unset( $options['record'] ); |
99 | | - } |
100 | | - $this->regex = $options['regex']; |
101 | | - } else { |
102 | | - # Matches anything |
103 | | - $this->regex = ''; |
104 | | - } |
105 | | - |
106 | | - $this->setupRecorder( $options ); |
107 | | - $this->keepUploads = isset( $options['keep-uploads'] ); |
108 | | - |
109 | | - if ( isset( $options['seed'] ) ) { |
110 | | - $this->fuzzSeed = intval( $options['seed'] ) - 1; |
111 | | - } |
112 | | - |
113 | | - $this->runDisabled = isset( $options['run-disabled'] ); |
114 | | - |
115 | | - $this->hooks = array(); |
116 | | - $this->functionHooks = array(); |
117 | | - } |
118 | | - |
119 | | - public function setupRecorder ( $options ) { |
120 | | - if ( isset( $options['record'] ) ) { |
121 | | - $this->recorder = new DbTestRecorder( $this ); |
122 | | - $this->recorder->version = isset( $options['setversion'] ) ? |
123 | | - $options['setversion'] : SpecialVersion::getVersion(); |
124 | | - } elseif ( isset( $options['compare'] ) ) { |
125 | | - $this->recorder = new DbTestPreviewer( $this ); |
126 | | - } elseif ( isset( $options['upload'] ) ) { |
127 | | - $this->recorder = new RemoteTestRecorder( $this ); |
128 | | - } else { |
129 | | - $this->recorder = new TestRecorder( $this ); |
130 | | - } |
131 | | - } |
132 | | - |
133 | | - /** |
134 | | - * Remove last character if it is a newline |
135 | | - */ |
136 | | - public function chomp( $s ) { |
137 | | - if ( substr( $s, -1 ) === "\n" ) { |
138 | | - return substr( $s, 0, -1 ); |
139 | | - } |
140 | | - else { |
141 | | - return $s; |
142 | | - } |
143 | | - } |
144 | | - |
145 | | - /** |
146 | | - * Run a fuzz test series |
147 | | - * Draw input from a set of test files |
148 | | - */ |
149 | | - function fuzzTest( $filenames ) { |
150 | | - $GLOBALS['wgContLang'] = Language::factory( 'en' ); |
151 | | - $dict = $this->getFuzzInput( $filenames ); |
152 | | - $dictSize = strlen( $dict ); |
153 | | - $logMaxLength = log( $this->maxFuzzTestLength ); |
154 | | - $this->setupDatabase(); |
155 | | - ini_set( 'memory_limit', $this->memoryLimit * 1048576 ); |
156 | | - |
157 | | - $numTotal = 0; |
158 | | - $numSuccess = 0; |
159 | | - $user = new User; |
160 | | - $opts = ParserOptions::newFromUser( $user ); |
161 | | - $title = Title::makeTitle( NS_MAIN, 'Parser_test' ); |
162 | | - |
163 | | - while ( true ) { |
164 | | - // Generate test input |
165 | | - mt_srand( ++$this->fuzzSeed ); |
166 | | - $totalLength = mt_rand( 1, $this->maxFuzzTestLength ); |
167 | | - $input = ''; |
168 | | - |
169 | | - while ( strlen( $input ) < $totalLength ) { |
170 | | - $logHairLength = mt_rand( 0, 1000000 ) / 1000000 * $logMaxLength; |
171 | | - $hairLength = min( intval( exp( $logHairLength ) ), $dictSize ); |
172 | | - $offset = mt_rand( 0, $dictSize - $hairLength ); |
173 | | - $input .= substr( $dict, $offset, $hairLength ); |
174 | | - } |
175 | | - |
176 | | - $this->setupGlobals(); |
177 | | - $parser = $this->getParser(); |
178 | | - |
179 | | - // Run the test |
180 | | - try { |
181 | | - $parser->parse( $input, $title, $opts ); |
182 | | - $fail = false; |
183 | | - } catch ( Exception $exception ) { |
184 | | - $fail = true; |
185 | | - } |
186 | | - |
187 | | - if ( $fail ) { |
188 | | - echo "Test failed with seed {$this->fuzzSeed}\n"; |
189 | | - echo "Input:\n"; |
190 | | - var_dump( $input ); |
191 | | - echo "\n\n"; |
192 | | - echo "$exception\n"; |
193 | | - } else { |
194 | | - $numSuccess++; |
195 | | - } |
196 | | - |
197 | | - $numTotal++; |
198 | | - $this->teardownGlobals(); |
199 | | - $parser->__destruct(); |
200 | | - |
201 | | - if ( $numTotal % 100 == 0 ) { |
202 | | - $usage = intval( memory_get_usage( true ) / $this->memoryLimit / 1048576 * 100 ); |
203 | | - echo "{$this->fuzzSeed}: $numSuccess/$numTotal (mem: $usage%)\n"; |
204 | | - if ( $usage > 90 ) { |
205 | | - echo "Out of memory:\n"; |
206 | | - $memStats = $this->getMemoryBreakdown(); |
207 | | - |
208 | | - foreach ( $memStats as $name => $usage ) { |
209 | | - echo "$name: $usage\n"; |
210 | | - } |
211 | | - $this->abort(); |
212 | | - } |
213 | | - } |
214 | | - } |
215 | | - } |
216 | | - |
217 | | - /** |
218 | | - * Get an input dictionary from a set of parser test files |
219 | | - */ |
220 | | - function getFuzzInput( $filenames ) { |
221 | | - $dict = ''; |
222 | | - |
223 | | - foreach ( $filenames as $filename ) { |
224 | | - $contents = file_get_contents( $filename ); |
225 | | - preg_match_all( '/!!\s*input\n(.*?)\n!!\s*result/s', $contents, $matches ); |
226 | | - |
227 | | - foreach ( $matches[1] as $match ) { |
228 | | - $dict .= $match . "\n"; |
229 | | - } |
230 | | - } |
231 | | - |
232 | | - return $dict; |
233 | | - } |
234 | | - |
235 | | - /** |
236 | | - * Get a memory usage breakdown |
237 | | - */ |
238 | | - function getMemoryBreakdown() { |
239 | | - $memStats = array(); |
240 | | - |
241 | | - foreach ( $GLOBALS as $name => $value ) { |
242 | | - $memStats['$' . $name] = strlen( serialize( $value ) ); |
243 | | - } |
244 | | - |
245 | | - $classes = get_declared_classes(); |
246 | | - |
247 | | - foreach ( $classes as $class ) { |
248 | | - $rc = new ReflectionClass( $class ); |
249 | | - $props = $rc->getStaticProperties(); |
250 | | - $memStats[$class] = strlen( serialize( $props ) ); |
251 | | - $methods = $rc->getMethods(); |
252 | | - |
253 | | - foreach ( $methods as $method ) { |
254 | | - $memStats[$class] += strlen( serialize( $method->getStaticVariables() ) ); |
255 | | - } |
256 | | - } |
257 | | - |
258 | | - $functions = get_defined_functions(); |
259 | | - |
260 | | - foreach ( $functions['user'] as $function ) { |
261 | | - $rf = new ReflectionFunction( $function ); |
262 | | - $memStats["$function()"] = strlen( serialize( $rf->getStaticVariables() ) ); |
263 | | - } |
264 | | - |
265 | | - asort( $memStats ); |
266 | | - |
267 | | - return $memStats; |
268 | | - } |
269 | | - |
270 | | - function abort() { |
271 | | - $this->abort(); |
272 | | - } |
273 | | - |
274 | | - /** |
275 | | - * Run a series of tests listed in the given text files. |
276 | | - * Each test consists of a brief description, wikitext input, |
277 | | - * and the expected HTML output. |
278 | | - * |
279 | | - * Prints status updates on stdout and counts up the total |
280 | | - * number and percentage of passed tests. |
281 | | - * |
282 | | - * @param $filenames Array of strings |
283 | | - * @return Boolean: true if passed all tests, false if any tests failed. |
284 | | - */ |
285 | | - public function runTestsFromFiles( $filenames ) { |
286 | | - $GLOBALS['wgContLang'] = Language::factory( 'en' ); |
287 | | - $this->recorder->start(); |
288 | | - $this->setupDatabase(); |
289 | | - $ok = true; |
290 | | - |
291 | | - foreach ( $filenames as $filename ) { |
292 | | - $tests = new TestFileIterator( $filename, $this ); |
293 | | - $ok = $this->runTests( $tests ) && $ok; |
294 | | - } |
295 | | - |
296 | | - $this->teardownDatabase(); |
297 | | - $this->recorder->report(); |
298 | | - $this->recorder->end(); |
299 | | - |
300 | | - return $ok; |
301 | | - } |
302 | | - |
303 | | - function runTests( $tests ) { |
304 | | - $ok = true; |
305 | | - |
306 | | - foreach ( $tests as $i => $t ) { |
307 | | - $result = |
308 | | - $this->runTest( $t['test'], $t['input'], $t['result'], $t['options'], $t['config'] ); |
309 | | - $ok = $ok && $result; |
310 | | - $this->recorder->record( $t['test'], $result ); |
311 | | - } |
312 | | - |
313 | | - if ( $this->showProgress ) { |
314 | | - print "\n"; |
315 | | - } |
316 | | - |
317 | | - return $ok; |
318 | | - } |
319 | | - |
320 | | - /** |
321 | | - * Get a Parser object |
322 | | - */ |
323 | | - function getParser( $preprocessor = null ) { |
324 | | - global $wgParserConf; |
325 | | - |
326 | | - $class = $wgParserConf['class']; |
327 | | - $parser = new $class( array( 'preprocessorClass' => $preprocessor ) + $wgParserConf ); |
328 | | - |
329 | | - foreach ( $this->hooks as $tag => $callback ) { |
330 | | - $parser->setHook( $tag, $callback ); |
331 | | - } |
332 | | - |
333 | | - foreach ( $this->functionHooks as $tag => $bits ) { |
334 | | - list( $callback, $flags ) = $bits; |
335 | | - $parser->setFunctionHook( $tag, $callback, $flags ); |
336 | | - } |
337 | | - |
338 | | - wfRunHooks( 'ParserTestParser', array( &$parser ) ); |
339 | | - |
340 | | - return $parser; |
341 | | - } |
342 | | - |
343 | | - /** |
344 | | - * Run a given wikitext input through a freshly-constructed wiki parser, |
345 | | - * and compare the output against the expected results. |
346 | | - * Prints status and explanatory messages to stdout. |
347 | | - * |
348 | | - * @param $desc String: test's description |
349 | | - * @param $input String: wikitext to try rendering |
350 | | - * @param $result String: result to output |
351 | | - * @param $opts Array: test's options |
352 | | - * @param $config String: overrides for global variables, one per line |
353 | | - * @return Boolean |
354 | | - */ |
355 | | - public function runTest( $desc, $input, $result, $opts, $config ) { |
356 | | - if ( $this->showProgress ) { |
357 | | - $this->showTesting( $desc ); |
358 | | - } |
359 | | - |
360 | | - $opts = $this->parseOptions( $opts ); |
361 | | - $this->setupGlobals( $opts, $config ); |
362 | | - |
363 | | - $user = new User(); |
364 | | - $options = ParserOptions::newFromUser( $user ); |
365 | | - |
366 | | - if ( isset( $opts['title'] ) ) { |
367 | | - $titleText = $opts['title']; |
368 | | - } |
369 | | - else { |
370 | | - $titleText = 'Parser test'; |
371 | | - } |
372 | | - |
373 | | - $noxml = isset( $opts['noxml'] ); |
374 | | - $local = isset( $opts['local'] ); |
375 | | - $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null; |
376 | | - $parser = $this->getParser( $preprocessor ); |
377 | | - $title = Title::newFromText( $titleText ); |
378 | | - |
379 | | - if ( isset( $opts['pst'] ) ) { |
380 | | - $out = $parser->preSaveTransform( $input, $title, $user, $options ); |
381 | | - } elseif ( isset( $opts['msg'] ) ) { |
382 | | - $out = $parser->transformMsg( $input, $options ); |
383 | | - } elseif ( isset( $opts['section'] ) ) { |
384 | | - $section = $opts['section']; |
385 | | - $out = $parser->getSection( $input, $section ); |
386 | | - } elseif ( isset( $opts['replace'] ) ) { |
387 | | - $section = $opts['replace'][0]; |
388 | | - $replace = $opts['replace'][1]; |
389 | | - $out = $parser->replaceSection( $input, $section, $replace ); |
390 | | - } elseif ( isset( $opts['comment'] ) ) { |
391 | | - $linker = $user->getSkin(); |
392 | | - $out = $linker->formatComment( $input, $title, $local ); |
393 | | - } elseif ( isset( $opts['preload'] ) ) { |
394 | | - $out = $parser->getpreloadText( $input, $title, $options ); |
395 | | - } else { |
396 | | - $output = $parser->parse( $input, $title, $options, true, true, 1337 ); |
397 | | - $out = $output->getText(); |
398 | | - |
399 | | - if ( isset( $opts['showtitle'] ) ) { |
400 | | - if ( $output->getTitleText() ) { |
401 | | - $title = $output->getTitleText(); |
402 | | - } |
403 | | - |
404 | | - $out = "$title\n$out"; |
405 | | - } |
406 | | - |
407 | | - if ( isset( $opts['ill'] ) ) { |
408 | | - $out = $this->tidy( implode( ' ', $output->getLanguageLinks() ) ); |
409 | | - } elseif ( isset( $opts['cat'] ) ) { |
410 | | - global $wgOut; |
411 | | - |
412 | | - $wgOut->addCategoryLinks( $output->getCategories() ); |
413 | | - $cats = $wgOut->getCategoryLinks(); |
414 | | - |
415 | | - if ( isset( $cats['normal'] ) ) { |
416 | | - $out = $this->tidy( implode( ' ', $cats['normal'] ) ); |
417 | | - } else { |
418 | | - $out = ''; |
419 | | - } |
420 | | - } |
421 | | - |
422 | | - $result = $this->tidy( $result ); |
423 | | - } |
424 | | - |
425 | | - |
426 | | - $this->teardownGlobals(); |
427 | | - |
428 | | - if ( $result === $out && ( $noxml === true || $this->wellFormed( $out ) ) ) { |
429 | | - return $this->showSuccess( $desc ); |
430 | | - } else { |
431 | | - return $this->showFailure( $desc, $result, $out ); |
432 | | - } |
433 | | - } |
434 | | - |
435 | | - /** |
436 | | - * Use a regex to find out the value of an option |
437 | | - * @param $key String: name of option val to retrieve |
438 | | - * @param $opts Options array to look in |
439 | | - * @param $default Mixed: default value returned if not found |
440 | | - */ |
441 | | - private static function getOptionValue( $key, $opts, $default ) { |
442 | | - $key = strtolower( $key ); |
443 | | - |
444 | | - if ( isset( $opts[$key] ) ) { |
445 | | - return $opts[$key]; |
446 | | - } else { |
447 | | - return $default; |
448 | | - } |
449 | | - } |
450 | | - |
451 | | - private function parseOptions( $instring ) { |
452 | | - $opts = array(); |
453 | | - $lines = explode( "\n", $instring ); |
454 | | - // foo |
455 | | - // foo=bar |
456 | | - // foo="bar baz" |
457 | | - // foo=[[bar baz]] |
458 | | - // foo=bar,"baz quux" |
459 | | - $regex = '/\b |
460 | | - ([\w-]+) # Key |
461 | | - \b |
462 | | - (?:\s* |
463 | | - = # First sub-value |
464 | | - \s* |
465 | | - ( |
466 | | - " |
467 | | - [^"]* # Quoted val |
468 | | - " |
469 | | - | |
470 | | - \[\[ |
471 | | - [^]]* # Link target |
472 | | - \]\] |
473 | | - | |
474 | | - [\w-]+ # Plain word |
475 | | - ) |
476 | | - (?:\s* |
477 | | - , # Sub-vals 1..N |
478 | | - \s* |
479 | | - ( |
480 | | - "[^"]*" # Quoted val |
481 | | - | |
482 | | - \[\[[^]]*\]\] # Link target |
483 | | - | |
484 | | - [\w-]+ # Plain word |
485 | | - ) |
486 | | - )* |
487 | | - )? |
488 | | - /x'; |
489 | | - |
490 | | - if ( preg_match_all( $regex, $instring, $matches, PREG_SET_ORDER ) ) { |
491 | | - foreach ( $matches as $bits ) { |
492 | | - $match = array_shift( $bits ); |
493 | | - $key = strtolower( array_shift( $bits ) ); |
494 | | - if ( count( $bits ) == 0 ) { |
495 | | - $opts[$key] = true; |
496 | | - } elseif ( count( $bits ) == 1 ) { |
497 | | - $opts[$key] = $this->cleanupOption( array_shift( $bits ) ); |
498 | | - } else { |
499 | | - // Array! |
500 | | - $opts[$key] = array_map( array( $this, 'cleanupOption' ), $bits ); |
501 | | - } |
502 | | - } |
503 | | - } |
504 | | - return $opts; |
505 | | - } |
506 | | - |
507 | | - private function cleanupOption( $opt ) { |
508 | | - if ( substr( $opt, 0, 1 ) == '"' ) { |
509 | | - return substr( $opt, 1, -1 ); |
510 | | - } |
511 | | - |
512 | | - if ( substr( $opt, 0, 2 ) == '[[' ) { |
513 | | - return substr( $opt, 2, -2 ); |
514 | | - } |
515 | | - return $opt; |
516 | | - } |
517 | | - |
518 | | - /** |
519 | | - * Set up the global variables for a consistent environment for each test. |
520 | | - * Ideally this should replace the global configuration entirely. |
521 | | - */ |
522 | | - private function setupGlobals( $opts = '', $config = '' ) { |
523 | | - global $wgDBtype; |
524 | | - |
525 | | - # Find out values for some special options. |
526 | | - $lang = |
527 | | - self::getOptionValue( 'language', $opts, 'en' ); |
528 | | - $variant = |
529 | | - self::getOptionValue( 'variant', $opts, false ); |
530 | | - $maxtoclevel = |
531 | | - self::getOptionValue( 'wgMaxTocLevel', $opts, 999 ); |
532 | | - $linkHolderBatchSize = |
533 | | - self::getOptionValue( 'wgLinkHolderBatchSize', $opts, 1000 ); |
534 | | - |
535 | | - $settings = array( |
536 | | - 'wgServer' => 'http://localhost', |
537 | | - 'wgScript' => '/index.php', |
538 | | - 'wgScriptPath' => '/', |
539 | | - 'wgArticlePath' => '/wiki/$1', |
540 | | - 'wgActionPaths' => array(), |
541 | | - 'wgLocalFileRepo' => array( |
542 | | - 'class' => 'LocalRepo', |
543 | | - 'name' => 'local', |
544 | | - 'directory' => $this->uploadDir, |
545 | | - 'url' => 'http://example.com/images', |
546 | | - 'hashLevels' => 2, |
547 | | - 'transformVia404' => false, |
548 | | - ), |
549 | | - 'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ), |
550 | | - 'wgStyleSheetPath' => '/skins', |
551 | | - 'wgSitename' => 'MediaWiki', |
552 | | - 'wgServerName' => 'Britney-Spears', |
553 | | - 'wgLanguageCode' => $lang, |
554 | | - 'wgDBprefix' => $wgDBtype != 'oracle' ? 'parsertest_' : 'pt_', |
555 | | - 'wgRawHtml' => isset( $opts['rawhtml'] ), |
556 | | - 'wgLang' => null, |
557 | | - 'wgContLang' => null, |
558 | | - 'wgNamespacesWithSubpages' => array( 0 => isset( $opts['subpage'] ) ), |
559 | | - 'wgMaxTocLevel' => $maxtoclevel, |
560 | | - 'wgCapitalLinks' => true, |
561 | | - 'wgNoFollowLinks' => true, |
562 | | - 'wgNoFollowDomainExceptions' => array(), |
563 | | - 'wgThumbnailScriptPath' => false, |
564 | | - 'wgUseImageResize' => false, |
565 | | - 'wgUseTeX' => isset( $opts['math'] ), |
566 | | - 'wgMathDirectory' => $this->uploadDir . '/math', |
567 | | - 'wgLocaltimezone' => 'UTC', |
568 | | - 'wgAllowExternalImages' => true, |
569 | | - 'wgUseTidy' => false, |
570 | | - 'wgDefaultLanguageVariant' => $variant, |
571 | | - 'wgVariantArticlePath' => false, |
572 | | - 'wgGroupPermissions' => array( '*' => array( |
573 | | - 'createaccount' => true, |
574 | | - 'read' => true, |
575 | | - 'edit' => true, |
576 | | - 'createpage' => true, |
577 | | - 'createtalk' => true, |
578 | | - ) ), |
579 | | - 'wgNamespaceProtection' => array( NS_MEDIAWIKI => 'editinterface' ), |
580 | | - 'wgDefaultExternalStore' => array(), |
581 | | - 'wgForeignFileRepos' => array(), |
582 | | - 'wgLinkHolderBatchSize' => $linkHolderBatchSize, |
583 | | - 'wgExperimentalHtmlIds' => false, |
584 | | - 'wgExternalLinkTarget' => false, |
585 | | - 'wgAlwaysUseTidy' => false, |
586 | | - 'wgHtml5' => true, |
587 | | - 'wgWellFormedXml' => true, |
588 | | - 'wgAllowMicrodataAttributes' => true, |
589 | | - ); |
590 | | - |
591 | | - if ( $config ) { |
592 | | - $configLines = explode( "\n", $config ); |
593 | | - |
594 | | - foreach ( $configLines as $line ) { |
595 | | - list( $var, $value ) = explode( '=', $line, 2 ); |
596 | | - |
597 | | - $settings[$var] = eval( "return $value;" ); |
598 | | - } |
599 | | - } |
600 | | - |
601 | | - $this->savedGlobals = array(); |
602 | | - |
603 | | - foreach ( $settings as $var => $val ) { |
604 | | - if ( array_key_exists( $var, $GLOBALS ) ) { |
605 | | - $this->savedGlobals[$var] = $GLOBALS[$var]; |
606 | | - } |
607 | | - |
608 | | - $GLOBALS[$var] = $val; |
609 | | - } |
610 | | - |
611 | | - $langObj = Language::factory( $lang ); |
612 | | - $GLOBALS['wgLang'] = $langObj; |
613 | | - $GLOBALS['wgContLang'] = $langObj; |
614 | | - $GLOBALS['wgMemc'] = new FakeMemCachedClient; |
615 | | - $GLOBALS['wgOut'] = new OutputPage; |
616 | | - |
617 | | - global $wgHooks; |
618 | | - |
619 | | - $wgHooks['ParserTestParser'][] = 'ParserTestParserHook::setup'; |
620 | | - $wgHooks['ParserTestParser'][] = 'ParserTestStaticParserHook::setup'; |
621 | | - $wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp'; |
622 | | - |
623 | | - MagicWord::clearCache(); |
624 | | - |
625 | | - global $wgUser; |
626 | | - $wgUser = new User(); |
627 | | - } |
628 | | - |
629 | | - /** |
630 | | - * List of temporary tables to create, without prefix. |
631 | | - * Some of these probably aren't necessary. |
632 | | - */ |
633 | | - private function listTables() { |
634 | | - global $wgDBtype; |
635 | | - |
636 | | - $tables = array( 'user', 'user_properties', 'page', 'page_restrictions', |
637 | | - 'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks', |
638 | | - 'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks', |
639 | | - 'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage', |
640 | | - 'recentchanges', 'watchlist', 'math', 'interwiki', 'logging', |
641 | | - 'querycache', 'objectcache', 'job', 'l10n_cache', 'redirect', 'querycachetwo', |
642 | | - 'archive', 'user_groups', 'page_props', 'category', 'msg_resource', 'msg_resource_links' |
643 | | - ); |
644 | | - |
645 | | - if ( in_array( $wgDBtype, array( 'mysql', 'sqlite' ) ) ) |
646 | | - array_push( $tables, 'searchindex' ); |
647 | | - |
648 | | - // Allow extensions to add to the list of tables to duplicate; |
649 | | - // may be necessary if they hook into page save or other code |
650 | | - // which will require them while running tests. |
651 | | - wfRunHooks( 'ParserTestTables', array( &$tables ) ); |
652 | | - |
653 | | - return $tables; |
654 | | - } |
655 | | - |
656 | | - /** |
657 | | - * Set up a temporary set of wiki tables to work with for the tests. |
658 | | - * Currently this will only be done once per run, and any changes to |
659 | | - * the db will be visible to later tests in the run. |
660 | | - */ |
661 | | - public function setupDatabase() { |
662 | | - global $wgDBprefix, $wgDBtype; |
663 | | - |
664 | | - if ( $this->databaseSetupDone ) { |
665 | | - return; |
666 | | - } |
667 | | - |
668 | | - if ( $wgDBprefix === 'parsertest_' || ( $wgDBtype == 'oracle' && $wgDBprefix === 'pt_' ) ) { |
669 | | - throw new MWException( 'setupDatabase should be called before setupGlobals' ); |
670 | | - } |
671 | | - |
672 | | - $this->databaseSetupDone = true; |
673 | | - $this->oldTablePrefix = $wgDBprefix; |
674 | | - |
675 | | - # SqlBagOStuff broke when using temporary tables on r40209 (bug 15892). |
676 | | - # It seems to have been fixed since (r55079?). |
677 | | - # If it fails, $wgCaches[CACHE_DB] = new HashBagOStuff(); should work around it. |
678 | | - |
679 | | - # CREATE TEMPORARY TABLE breaks if there is more than one server |
680 | | - if ( wfGetLB()->getServerCount() != 1 ) { |
681 | | - $this->useTemporaryTables = false; |
682 | | - } |
683 | | - |
684 | | - $temporary = $this->useTemporaryTables || $wgDBtype == 'postgres'; |
685 | | - |
686 | | - $db = wfGetDB( DB_MASTER ); |
687 | | - $tables = $this->listTables(); |
688 | | - |
689 | | - foreach ( $tables as $tbl ) { |
690 | | - # Clean up from previous aborted run. So that table escaping |
691 | | - # works correctly across DB engines, we need to change the pre- |
692 | | - # fix back and forth so tableName() works right. |
693 | | - $this->changePrefix( $this->oldTablePrefix ); |
694 | | - $oldTableName = $db->tableName( $tbl ); |
695 | | - $this->changePrefix( $wgDBtype != 'oracle' ? 'parsertest_' : 'pt_' ); |
696 | | - $newTableName = $db->tableName( $tbl ); |
697 | | - |
698 | | - if ( $wgDBtype == 'mysql' ) { |
699 | | - $db->query( "DROP TABLE IF EXISTS $newTableName" ); |
700 | | - } elseif ( in_array( $wgDBtype, array( 'postgres', 'oracle' ) ) ) { |
701 | | - /* DROPs wouldn't work due to Foreign Key Constraints (bug 14990, r58669) |
702 | | - * Use "DROP TABLE IF EXISTS $newTableName CASCADE" for postgres? That |
703 | | - * syntax would also work for mysql. |
704 | | - */ |
705 | | - } elseif ( $db->tableExists( $tbl ) ) { |
706 | | - $db->query( "DROP TABLE $newTableName" ); |
707 | | - } |
708 | | - |
709 | | - # Create new table |
710 | | - $db->duplicateTableStructure( $oldTableName, $newTableName, $temporary ); |
711 | | - } |
712 | | - |
713 | | - if ( $wgDBtype == 'oracle' ) |
714 | | - $db->query( 'BEGIN FILL_WIKI_INFO; END;' ); |
715 | | - |
716 | | - $this->changePrefix( $wgDBtype != 'oracle' ? 'parsertest_' : 'pt_' ); |
717 | | - |
718 | | - # Hack: insert a few Wikipedia in-project interwiki prefixes, |
719 | | - # for testing inter-language links |
720 | | - $db->insert( 'interwiki', array( |
721 | | - array( 'iw_prefix' => 'wikipedia', |
722 | | - 'iw_url' => 'http://en.wikipedia.org/wiki/$1', |
723 | | - 'iw_api' => '', |
724 | | - 'iw_wikiid' => '', |
725 | | - 'iw_local' => 0 ), |
726 | | - array( 'iw_prefix' => 'meatball', |
727 | | - 'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', |
728 | | - 'iw_api' => '', |
729 | | - 'iw_wikiid' => '', |
730 | | - 'iw_local' => 0 ), |
731 | | - array( 'iw_prefix' => 'zh', |
732 | | - 'iw_url' => 'http://zh.wikipedia.org/wiki/$1', |
733 | | - 'iw_api' => '', |
734 | | - 'iw_wikiid' => '', |
735 | | - 'iw_local' => 1 ), |
736 | | - array( 'iw_prefix' => 'es', |
737 | | - 'iw_url' => 'http://es.wikipedia.org/wiki/$1', |
738 | | - 'iw_api' => '', |
739 | | - 'iw_wikiid' => '', |
740 | | - 'iw_local' => 1 ), |
741 | | - array( 'iw_prefix' => 'fr', |
742 | | - 'iw_url' => 'http://fr.wikipedia.org/wiki/$1', |
743 | | - 'iw_api' => '', |
744 | | - 'iw_wikiid' => '', |
745 | | - 'iw_local' => 1 ), |
746 | | - array( 'iw_prefix' => 'ru', |
747 | | - 'iw_url' => 'http://ru.wikipedia.org/wiki/$1', |
748 | | - 'iw_api' => '', |
749 | | - 'iw_wikiid' => '', |
750 | | - 'iw_local' => 1 ), |
751 | | - ) ); |
752 | | - |
753 | | - |
754 | | - if ( $wgDBtype == 'oracle' ) { |
755 | | - # Insert 0 user to prevent FK violations |
756 | | - |
757 | | - # Anonymous user |
758 | | - $db->insert( 'user', array( |
759 | | - 'user_id' => 0, |
760 | | - 'user_name' => 'Anonymous' ) ); |
761 | | - } |
762 | | - |
763 | | - # Update certain things in site_stats |
764 | | - $db->insert( 'site_stats', array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) ); |
765 | | - |
766 | | - # Reinitialise the LocalisationCache to match the database state |
767 | | - Language::getLocalisationCache()->unloadAll(); |
768 | | - |
769 | | - # Make a new message cache |
770 | | - global $wgMessageCache, $wgMemc; |
771 | | - $wgMessageCache = new MessageCache( $wgMemc, true, 3600 ); |
772 | | - |
773 | | - $this->uploadDir = $this->setupUploadDir(); |
774 | | - $user = User::createNew( 'WikiSysop' ); |
775 | | - $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) ); |
776 | | - $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array( |
777 | | - 'size' => 12345, |
778 | | - 'width' => 1941, |
779 | | - 'height' => 220, |
780 | | - 'bits' => 24, |
781 | | - 'media_type' => MEDIATYPE_BITMAP, |
782 | | - 'mime' => 'image/jpeg', |
783 | | - 'metadata' => serialize( array() ), |
784 | | - 'sha1' => sha1( '' ), |
785 | | - 'fileExists' => true |
786 | | - ), $db->timestamp( '20010115123500' ), $user ); |
787 | | - |
788 | | - # This image will be blacklisted in [[MediaWiki:Bad image list]] |
789 | | - $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Bad.jpg' ) ); |
790 | | - $image->recordUpload2( '', 'zomgnotcensored', 'Borderline image', array( |
791 | | - 'size' => 12345, |
792 | | - 'width' => 320, |
793 | | - 'height' => 240, |
794 | | - 'bits' => 24, |
795 | | - 'media_type' => MEDIATYPE_BITMAP, |
796 | | - 'mime' => 'image/jpeg', |
797 | | - 'metadata' => serialize( array() ), |
798 | | - 'sha1' => sha1( '' ), |
799 | | - 'fileExists' => true |
800 | | - ), $db->timestamp( '20010115123500' ), $user ); |
801 | | - } |
802 | | - |
803 | | - /** |
804 | | - * Change the table prefix on all open DB connections/ |
805 | | - */ |
806 | | - protected function changePrefix( $prefix ) { |
807 | | - global $wgDBprefix; |
808 | | - wfGetLBFactory()->forEachLB( array( $this, 'changeLBPrefix' ), array( $prefix ) ); |
809 | | - $wgDBprefix = $prefix; |
810 | | - } |
811 | | - |
812 | | - public function changeLBPrefix( $lb, $prefix ) { |
813 | | - $lb->forEachOpenConnection( array( $this, 'changeDBPrefix' ), array( $prefix ) ); |
814 | | - } |
815 | | - |
816 | | - public function changeDBPrefix( $db, $prefix ) { |
817 | | - $db->tablePrefix( $prefix ); |
818 | | - } |
819 | | - |
820 | | - public function teardownDatabase() { |
821 | | - global $wgDBtype; |
822 | | - |
823 | | - if ( !$this->databaseSetupDone ) { |
824 | | - return; |
825 | | - } |
826 | | - $this->teardownUploadDir( $this->uploadDir ); |
827 | | - |
828 | | - $this->changePrefix( $this->oldTablePrefix ); |
829 | | - $this->databaseSetupDone = false; |
830 | | - |
831 | | - if ( $this->useTemporaryTables ) { |
832 | | - # Don't need to do anything |
833 | | - return; |
834 | | - } |
835 | | - |
836 | | - $tables = $this->listTables(); |
837 | | - $db = wfGetDB( DB_MASTER ); |
838 | | - |
839 | | - foreach ( $tables as $table ) { |
840 | | - $sql = $wgDBtype == 'oracle' ? "DROP TABLE pt_$table DROP CONSTRAINTS" : "DROP TABLE `parsertest_$table`"; |
841 | | - $db->query( $sql ); |
842 | | - } |
843 | | - |
844 | | - if ( $wgDBtype == 'oracle' ) |
845 | | - $db->query( 'BEGIN FILL_WIKI_INFO; END;' ); |
846 | | - } |
847 | | - |
848 | | - /** |
849 | | - * Create a dummy uploads directory which will contain a couple |
850 | | - * of files in order to pass existence tests. |
851 | | - * |
852 | | - * @return String: the directory |
853 | | - */ |
854 | | - private function setupUploadDir() { |
855 | | - global $IP; |
856 | | - |
857 | | - if ( $this->keepUploads ) { |
858 | | - $dir = wfTempDir() . '/mwParser-images'; |
859 | | - |
860 | | - if ( is_dir( $dir ) ) { |
861 | | - return $dir; |
862 | | - } |
863 | | - } else { |
864 | | - $dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images"; |
865 | | - } |
866 | | - |
867 | | - // wfDebug( "Creating upload directory $dir\n" ); |
868 | | - if ( file_exists( $dir ) ) { |
869 | | - wfDebug( "Already exists!\n" ); |
870 | | - return $dir; |
871 | | - } |
872 | | - |
873 | | - wfMkdirParents( $dir . '/3/3a' ); |
874 | | - copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); |
875 | | - wfMkdirParents( $dir . '/0/09' ); |
876 | | - copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); |
877 | | - |
878 | | - return $dir; |
879 | | - } |
880 | | - |
881 | | - /** |
882 | | - * Restore default values and perform any necessary clean-up |
883 | | - * after each test runs. |
884 | | - */ |
885 | | - private function teardownGlobals() { |
886 | | - RepoGroup::destroySingleton(); |
887 | | - LinkCache::singleton()->clear(); |
888 | | - |
889 | | - foreach ( $this->savedGlobals as $var => $val ) { |
890 | | - $GLOBALS[$var] = $val; |
891 | | - } |
892 | | - } |
893 | | - |
894 | | - /** |
895 | | - * Remove the dummy uploads directory |
896 | | - */ |
897 | | - private function teardownUploadDir( $dir ) { |
898 | | - if ( $this->keepUploads ) { |
899 | | - return; |
900 | | - } |
901 | | - |
902 | | - // delete the files first, then the dirs. |
903 | | - self::deleteFiles( |
904 | | - array ( |
905 | | - "$dir/3/3a/Foobar.jpg", |
906 | | - "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg", |
907 | | - "$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg", |
908 | | - "$dir/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg", |
909 | | - "$dir/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg", |
910 | | - |
911 | | - "$dir/0/09/Bad.jpg", |
912 | | - |
913 | | - "$dir/math/f/a/5/fa50b8b616463173474302ca3e63586b.png", |
914 | | - ) |
915 | | - ); |
916 | | - |
917 | | - self::deleteDirs( |
918 | | - array ( |
919 | | - "$dir/3/3a", |
920 | | - "$dir/3", |
921 | | - "$dir/thumb/6/65", |
922 | | - "$dir/thumb/6", |
923 | | - "$dir/thumb/3/3a/Foobar.jpg", |
924 | | - "$dir/thumb/3/3a", |
925 | | - "$dir/thumb/3", |
926 | | - |
927 | | - "$dir/0/09/", |
928 | | - "$dir/0/", |
929 | | - "$dir/thumb", |
930 | | - "$dir/math/f/a/5", |
931 | | - "$dir/math/f/a", |
932 | | - "$dir/math/f", |
933 | | - "$dir/math", |
934 | | - "$dir", |
935 | | - ) |
936 | | - ); |
937 | | - } |
938 | | - |
939 | | - /** |
940 | | - * Delete the specified files, if they exist. |
941 | | - * @param $files Array: full paths to files to delete. |
942 | | - */ |
943 | | - private static function deleteFiles( $files ) { |
944 | | - foreach ( $files as $file ) { |
945 | | - if ( file_exists( $file ) ) { |
946 | | - unlink( $file ); |
947 | | - } |
948 | | - } |
949 | | - } |
950 | | - |
951 | | - /** |
952 | | - * Delete the specified directories, if they exist. Must be empty. |
953 | | - * @param $dirs Array: full paths to directories to delete. |
954 | | - */ |
955 | | - private static function deleteDirs( $dirs ) { |
956 | | - foreach ( $dirs as $dir ) { |
957 | | - if ( is_dir( $dir ) ) { |
958 | | - rmdir( $dir ); |
959 | | - } |
960 | | - } |
961 | | - } |
962 | | - |
963 | | - /** |
964 | | - * "Running test $desc..." |
965 | | - */ |
966 | | - protected function showTesting( $desc ) { |
967 | | - print "Running test $desc... "; |
968 | | - } |
969 | | - |
970 | | - /** |
971 | | - * Print a happy success message. |
972 | | - * |
973 | | - * @param $desc String: the test name |
974 | | - * @return Boolean |
975 | | - */ |
976 | | - protected function showSuccess( $desc ) { |
977 | | - if ( $this->showProgress ) { |
978 | | - print $this->term->color( '1;32' ) . 'PASSED' . $this->term->reset() . "\n"; |
979 | | - } |
980 | | - |
981 | | - return true; |
982 | | - } |
983 | | - |
984 | | - /** |
985 | | - * Print a failure message and provide some explanatory output |
986 | | - * about what went wrong if so configured. |
987 | | - * |
988 | | - * @param $desc String: the test name |
989 | | - * @param $result String: expected HTML output |
990 | | - * @param $html String: actual HTML output |
991 | | - * @return Boolean |
992 | | - */ |
993 | | - protected function showFailure( $desc, $result, $html ) { |
994 | | - if ( $this->showFailure ) { |
995 | | - if ( !$this->showProgress ) { |
996 | | - # In quiet mode we didn't show the 'Testing' message before the |
997 | | - # test, in case it succeeded. Show it now: |
998 | | - $this->showTesting( $desc ); |
999 | | - } |
1000 | | - |
1001 | | - print $this->term->color( '31' ) . 'FAILED!' . $this->term->reset() . "\n"; |
1002 | | - |
1003 | | - if ( $this->showOutput ) { |
1004 | | - print "--- Expected ---\n$result\n--- Actual ---\n$html\n"; |
1005 | | - } |
1006 | | - |
1007 | | - if ( $this->showDiffs ) { |
1008 | | - print $this->quickDiff( $result, $html ); |
1009 | | - if ( !$this->wellFormed( $html ) ) { |
1010 | | - print "XML error: $this->mXmlError\n"; |
1011 | | - } |
1012 | | - } |
1013 | | - } |
1014 | | - |
1015 | | - return false; |
1016 | | - } |
1017 | | - |
1018 | | - /** |
1019 | | - * Run given strings through a diff and return the (colorized) output. |
1020 | | - * Requires writable /tmp directory and a 'diff' command in the PATH. |
1021 | | - * |
1022 | | - * @param $input String |
1023 | | - * @param $output String |
1024 | | - * @param $inFileTail String: tailing for the input file name |
1025 | | - * @param $outFileTail String: tailing for the output file name |
1026 | | - * @return String |
1027 | | - */ |
1028 | | - protected function quickDiff( $input, $output, $inFileTail = 'expected', $outFileTail = 'actual' ) { |
1029 | | - $prefix = wfTempDir() . "/mwParser-" . mt_rand(); |
1030 | | - |
1031 | | - $infile = "$prefix-$inFileTail"; |
1032 | | - $this->dumpToFile( $input, $infile ); |
1033 | | - |
1034 | | - $outfile = "$prefix-$outFileTail"; |
1035 | | - $this->dumpToFile( $output, $outfile ); |
1036 | | - |
1037 | | - $diff = `diff -au $infile $outfile`; |
1038 | | - unlink( $infile ); |
1039 | | - unlink( $outfile ); |
1040 | | - |
1041 | | - return $this->colorDiff( $diff ); |
1042 | | - } |
1043 | | - |
1044 | | - /** |
1045 | | - * Write the given string to a file, adding a final newline. |
1046 | | - * |
1047 | | - * @param $data String |
1048 | | - * @param $filename String |
1049 | | - */ |
1050 | | - private function dumpToFile( $data, $filename ) { |
1051 | | - $file = fopen( $filename, "wt" ); |
1052 | | - fwrite( $file, $data . "\n" ); |
1053 | | - fclose( $file ); |
1054 | | - } |
1055 | | - |
1056 | | - /** |
1057 | | - * Colorize unified diff output if set for ANSI color output. |
1058 | | - * Subtractions are colored blue, additions red. |
1059 | | - * |
1060 | | - * @param $text String |
1061 | | - * @return String |
1062 | | - */ |
1063 | | - protected function colorDiff( $text ) { |
1064 | | - return preg_replace( |
1065 | | - array( '/^(-.*)$/m', '/^(\+.*)$/m' ), |
1066 | | - array( $this->term->color( 34 ) . '$1' . $this->term->reset(), |
1067 | | - $this->term->color( 31 ) . '$1' . $this->term->reset() ), |
1068 | | - $text ); |
1069 | | - } |
1070 | | - |
1071 | | - /** |
1072 | | - * Show "Reading tests from ..." |
1073 | | - * |
1074 | | - * @param $path String |
1075 | | - */ |
1076 | | - public function showRunFile( $path ) { |
1077 | | - print $this->term->color( 1 ) . |
1078 | | - "Reading tests from \"$path\"..." . |
1079 | | - $this->term->reset() . |
1080 | | - "\n"; |
1081 | | - } |
1082 | | - |
1083 | | - /** |
1084 | | - * Insert a temporary test article |
1085 | | - * @param $name String: the title, including any prefix |
1086 | | - * @param $text String: the article text |
1087 | | - * @param $line Integer: the input line number, for reporting errors |
1088 | | - */ |
1089 | | - public function addArticle( $name, $text, $line ) { |
1090 | | - global $wgCapitalLinks; |
1091 | | - $oldCapitalLinks = $wgCapitalLinks; |
1092 | | - $wgCapitalLinks = true; // We only need this from SetupGlobals() See r70917#c8637 |
1093 | | - |
1094 | | - $title = Title::newFromText( $name ); |
1095 | | - |
1096 | | - if ( is_null( $title ) ) { |
1097 | | - wfDie( "invalid title at line $line\n" ); |
1098 | | - } |
1099 | | - |
1100 | | - $aid = $title->getArticleID( GAID_FOR_UPDATE ); |
1101 | | - |
1102 | | - if ( $aid != 0 ) { |
1103 | | - wfDie( "duplicate article '$name' at line $line\n" ); |
1104 | | - } |
1105 | | - |
1106 | | - $art = new Article( $title ); |
1107 | | - $art->insertNewArticle( $text, '', false, false ); |
1108 | | - |
1109 | | - $wgCapitalLinks = $oldCapitalLinks; |
1110 | | - } |
1111 | | - |
1112 | | - /** |
1113 | | - * Steal a callback function from the primary parser, save it for |
1114 | | - * application to our scary parser. If the hook is not installed, |
1115 | | - * abort processing of this file. |
1116 | | - * |
1117 | | - * @param $name String |
1118 | | - * @return Bool true if tag hook is present |
1119 | | - */ |
1120 | | - public function requireHook( $name ) { |
1121 | | - global $wgParser; |
1122 | | - |
1123 | | - $wgParser->firstCallInit( ); // make sure hooks are loaded. |
1124 | | - |
1125 | | - if ( isset( $wgParser->mTagHooks[$name] ) ) { |
1126 | | - $this->hooks[$name] = $wgParser->mTagHooks[$name]; |
1127 | | - } else { |
1128 | | - echo " This test suite requires the '$name' hook extension, skipping.\n"; |
1129 | | - return false; |
1130 | | - } |
1131 | | - |
1132 | | - return true; |
1133 | | - } |
1134 | | - |
1135 | | - /** |
1136 | | - * Steal a callback function from the primary parser, save it for |
1137 | | - * application to our scary parser. If the hook is not installed, |
1138 | | - * abort processing of this file. |
1139 | | - * |
1140 | | - * @param $name String |
1141 | | - * @return Bool true if function hook is present |
1142 | | - */ |
1143 | | - public function requireFunctionHook( $name ) { |
1144 | | - global $wgParser; |
1145 | | - |
1146 | | - $wgParser->firstCallInit( ); // make sure hooks are loaded. |
1147 | | - |
1148 | | - if ( isset( $wgParser->mFunctionHooks[$name] ) ) { |
1149 | | - $this->functionHooks[$name] = $wgParser->mFunctionHooks[$name]; |
1150 | | - } else { |
1151 | | - echo " This test suite requires the '$name' function hook extension, skipping.\n"; |
1152 | | - return false; |
1153 | | - } |
1154 | | - |
1155 | | - return true; |
1156 | | - } |
1157 | | - |
1158 | | - /* |
1159 | | - * Run the "tidy" command on text if the $wgUseTidy |
1160 | | - * global is true |
1161 | | - * |
1162 | | - * @param $text String: the text to tidy |
1163 | | - * @return String |
1164 | | - * @static |
1165 | | - */ |
1166 | | - private function tidy( $text ) { |
1167 | | - global $wgUseTidy; |
1168 | | - |
1169 | | - if ( $wgUseTidy ) { |
1170 | | - $text = MWTidy::tidy( $text ); |
1171 | | - } |
1172 | | - |
1173 | | - return $text; |
1174 | | - } |
1175 | | - |
1176 | | - private function wellFormed( $text ) { |
1177 | | - $html = |
1178 | | - Sanitizer::hackDocType() . |
1179 | | - '<html>' . |
1180 | | - $text . |
1181 | | - '</html>'; |
1182 | | - |
1183 | | - $parser = xml_parser_create( "UTF-8" ); |
1184 | | - |
1185 | | - # case folding violates XML standard, turn it off |
1186 | | - xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false ); |
1187 | | - |
1188 | | - if ( !xml_parse( $parser, $html, true ) ) { |
1189 | | - $err = xml_error_string( xml_get_error_code( $parser ) ); |
1190 | | - $position = xml_get_current_byte_index( $parser ); |
1191 | | - $fragment = $this->extractFragment( $html, $position ); |
1192 | | - $this->mXmlError = "$err at byte $position:\n$fragment"; |
1193 | | - xml_parser_free( $parser ); |
1194 | | - |
1195 | | - return false; |
1196 | | - } |
1197 | | - |
1198 | | - xml_parser_free( $parser ); |
1199 | | - |
1200 | | - return true; |
1201 | | - } |
1202 | | - |
1203 | | - private function extractFragment( $text, $position ) { |
1204 | | - $start = max( 0, $position - 10 ); |
1205 | | - $before = $position - $start; |
1206 | | - $fragment = '...' . |
1207 | | - $this->term->color( 34 ) . |
1208 | | - substr( $text, $start, $before ) . |
1209 | | - $this->term->color( 0 ) . |
1210 | | - $this->term->color( 31 ) . |
1211 | | - $this->term->color( 1 ) . |
1212 | | - substr( $text, $position, 1 ) . |
1213 | | - $this->term->color( 0 ) . |
1214 | | - $this->term->color( 34 ) . |
1215 | | - substr( $text, $position + 1, 9 ) . |
1216 | | - $this->term->color( 0 ) . |
1217 | | - '...'; |
1218 | | - $display = str_replace( "\n", ' ', $fragment ); |
1219 | | - $caret = ' ' . |
1220 | | - str_repeat( ' ', $before ) . |
1221 | | - $this->term->color( 31 ) . |
1222 | | - '^' . |
1223 | | - $this->term->color( 0 ); |
1224 | | - |
1225 | | - return "$display\n$caret"; |
1226 | | - } |
1227 | | - |
1228 | | - static function getFakeTimestamp( &$parser, &$ts ) { |
1229 | | - $ts = 123; |
1230 | | - return true; |
1231 | | - } |
1232 | | -} |
1233 | | - |
1234 | | -class AnsiTermColorer { |
1235 | | - function __construct() { |
1236 | | - } |
1237 | | - |
1238 | | - /** |
1239 | | - * Return ANSI terminal escape code for changing text attribs/color |
1240 | | - * |
1241 | | - * @param $color String: semicolon-separated list of attribute/color codes |
1242 | | - * @return String |
1243 | | - */ |
1244 | | - public function color( $color ) { |
1245 | | - global $wgCommandLineDarkBg; |
1246 | | - |
1247 | | - $light = $wgCommandLineDarkBg ? "1;" : "0;"; |
1248 | | - |
1249 | | - return "\x1b[{$light}{$color}m"; |
1250 | | - } |
1251 | | - |
1252 | | - /** |
1253 | | - * Return ANSI terminal escape code for restoring default text attributes |
1254 | | - * |
1255 | | - * @return String |
1256 | | - */ |
1257 | | - public function reset() { |
1258 | | - return $this->color( 0 ); |
1259 | | - } |
1260 | | -} |
1261 | | - |
1262 | | -/* A colour-less terminal */ |
1263 | | -class DummyTermColorer { |
1264 | | - public function color( $color ) { |
1265 | | - return ''; |
1266 | | - } |
1267 | | - |
1268 | | - public function reset() { |
1269 | | - return ''; |
1270 | | - } |
1271 | | -} |
1272 | | - |
1273 | | -class TestRecorder { |
1274 | | - var $parent; |
1275 | | - var $term; |
1276 | | - |
1277 | | - function __construct( $parent ) { |
1278 | | - $this->parent = $parent; |
1279 | | - $this->term = $parent->term; |
1280 | | - } |
1281 | | - |
1282 | | - function start() { |
1283 | | - $this->total = 0; |
1284 | | - $this->success = 0; |
1285 | | - } |
1286 | | - |
1287 | | - function record( $test, $result ) { |
1288 | | - $this->total++; |
1289 | | - $this->success += ( $result ? 1 : 0 ); |
1290 | | - } |
1291 | | - |
1292 | | - function end() { |
1293 | | - // dummy |
1294 | | - } |
1295 | | - |
1296 | | - function report() { |
1297 | | - if ( $this->total > 0 ) { |
1298 | | - $this->reportPercentage( $this->success, $this->total ); |
1299 | | - } else { |
1300 | | - wfDie( "No tests found.\n" ); |
1301 | | - } |
1302 | | - } |
1303 | | - |
1304 | | - function reportPercentage( $success, $total ) { |
1305 | | - $ratio = wfPercent( 100 * $success / $total ); |
1306 | | - print $this->term->color( 1 ) . "Passed $success of $total tests ($ratio)... "; |
1307 | | - |
1308 | | - if ( $success == $total ) { |
1309 | | - print $this->term->color( 32 ) . "ALL TESTS PASSED!"; |
1310 | | - } else { |
1311 | | - $failed = $total - $success ; |
1312 | | - print $this->term->color( 31 ) . "$failed tests failed!"; |
1313 | | - } |
1314 | | - |
1315 | | - print $this->term->reset() . "\n"; |
1316 | | - |
1317 | | - return ( $success == $total ); |
1318 | | - } |
1319 | | -} |
1320 | | - |
1321 | | -class DbTestPreviewer extends TestRecorder { |
1322 | | - protected $lb; // /< Database load balancer |
1323 | | - protected $db; // /< Database connection to the main DB |
1324 | | - protected $curRun; // /< run ID number for the current run |
1325 | | - protected $prevRun; // /< run ID number for the previous run, if any |
1326 | | - protected $results; // /< Result array |
1327 | | - |
1328 | | - /** |
1329 | | - * This should be called before the table prefix is changed |
1330 | | - */ |
1331 | | - function __construct( $parent ) { |
1332 | | - parent::__construct( $parent ); |
1333 | | - |
1334 | | - $this->lb = wfGetLBFactory()->newMainLB(); |
1335 | | - // This connection will have the wiki's table prefix, not parsertest_ |
1336 | | - $this->db = $this->lb->getConnection( DB_MASTER ); |
1337 | | - } |
1338 | | - |
1339 | | - /** |
1340 | | - * Set up result recording; insert a record for the run with the date |
1341 | | - * and all that fun stuff |
1342 | | - */ |
1343 | | - function start() { |
1344 | | - parent::start(); |
1345 | | - |
1346 | | - if ( ! $this->db->tableExists( 'testrun' ) |
1347 | | - or ! $this->db->tableExists( 'testitem' ) ) |
1348 | | - { |
1349 | | - print "WARNING> `testrun` table not found in database.\n"; |
1350 | | - $this->prevRun = false; |
1351 | | - } else { |
1352 | | - // We'll make comparisons against the previous run later... |
1353 | | - $this->prevRun = $this->db->selectField( 'testrun', 'MAX(tr_id)' ); |
1354 | | - } |
1355 | | - |
1356 | | - $this->results = array(); |
1357 | | - } |
1358 | | - |
1359 | | - function record( $test, $result ) { |
1360 | | - parent::record( $test, $result ); |
1361 | | - $this->results[$test] = $result; |
1362 | | - } |
1363 | | - |
1364 | | - function report() { |
1365 | | - if ( $this->prevRun ) { |
1366 | | - // f = fail, p = pass, n = nonexistent |
1367 | | - // codes show before then after |
1368 | | - $table = array( |
1369 | | - 'fp' => 'previously failing test(s) now PASSING! :)', |
1370 | | - 'pn' => 'previously PASSING test(s) removed o_O', |
1371 | | - 'np' => 'new PASSING test(s) :)', |
1372 | | - |
1373 | | - 'pf' => 'previously passing test(s) now FAILING! :(', |
1374 | | - 'fn' => 'previously FAILING test(s) removed O_o', |
1375 | | - 'nf' => 'new FAILING test(s) :(', |
1376 | | - 'ff' => 'still FAILING test(s) :(', |
1377 | | - ); |
1378 | | - |
1379 | | - $prevResults = array(); |
1380 | | - |
1381 | | - $res = $this->db->select( 'testitem', array( 'ti_name', 'ti_success' ), |
1382 | | - array( 'ti_run' => $this->prevRun ), __METHOD__ ); |
1383 | | - |
1384 | | - foreach ( $res as $row ) { |
1385 | | - if ( !$this->parent->regex |
1386 | | - || preg_match( "/{$this->parent->regex}/i", $row->ti_name ) ) |
1387 | | - { |
1388 | | - $prevResults[$row->ti_name] = $row->ti_success; |
1389 | | - } |
1390 | | - } |
1391 | | - |
1392 | | - $combined = array_keys( $this->results + $prevResults ); |
1393 | | - |
1394 | | - # Determine breakdown by change type |
1395 | | - $breakdown = array(); |
1396 | | - foreach ( $combined as $test ) { |
1397 | | - if ( !isset( $prevResults[$test] ) ) { |
1398 | | - $before = 'n'; |
1399 | | - } elseif ( $prevResults[$test] == 1 ) { |
1400 | | - $before = 'p'; |
1401 | | - } else /* if ( $prevResults[$test] == 0 )*/ { |
1402 | | - $before = 'f'; |
1403 | | - } |
1404 | | - |
1405 | | - if ( !isset( $this->results[$test] ) ) { |
1406 | | - $after = 'n'; |
1407 | | - } elseif ( $this->results[$test] == 1 ) { |
1408 | | - $after = 'p'; |
1409 | | - } else /*if ( $this->results[$test] == 0 ) */ { |
1410 | | - $after = 'f'; |
1411 | | - } |
1412 | | - |
1413 | | - $code = $before . $after; |
1414 | | - |
1415 | | - if ( isset( $table[$code] ) ) { |
1416 | | - $breakdown[$code][$test] = $this->getTestStatusInfo( $test, $after ); |
1417 | | - } |
1418 | | - } |
1419 | | - |
1420 | | - # Write out results |
1421 | | - foreach ( $table as $code => $label ) { |
1422 | | - if ( !empty( $breakdown[$code] ) ) { |
1423 | | - $count = count( $breakdown[$code] ); |
1424 | | - printf( "\n%4d %s\n", $count, $label ); |
1425 | | - |
1426 | | - foreach ( $breakdown[$code] as $differing_test_name => $statusInfo ) { |
1427 | | - print " * $differing_test_name [$statusInfo]\n"; |
1428 | | - } |
1429 | | - } |
1430 | | - } |
1431 | | - } else { |
1432 | | - print "No previous test runs to compare against.\n"; |
1433 | | - } |
1434 | | - |
1435 | | - print "\n"; |
1436 | | - parent::report(); |
1437 | | - } |
1438 | | - |
1439 | | - /** |
1440 | | - * Returns a string giving information about when a test last had a status change. |
1441 | | - * Could help to track down when regressions were introduced, as distinct from tests |
1442 | | - * which have never passed (which are more change requests than regressions). |
1443 | | - */ |
1444 | | - private function getTestStatusInfo( $testname, $after ) { |
1445 | | - // If we're looking at a test that has just been removed, then say when it first appeared. |
1446 | | - if ( $after == 'n' ) { |
1447 | | - $changedRun = $this->db->selectField ( 'testitem', |
1448 | | - 'MIN(ti_run)', |
1449 | | - array( 'ti_name' => $testname ), |
1450 | | - __METHOD__ ); |
1451 | | - $appear = $this->db->selectRow ( 'testrun', |
1452 | | - array( 'tr_date', 'tr_mw_version' ), |
1453 | | - array( 'tr_id' => $changedRun ), |
1454 | | - __METHOD__ ); |
1455 | | - |
1456 | | - return "First recorded appearance: " |
1457 | | - . date( "d-M-Y H:i:s", strtotime ( $appear->tr_date ) ) |
1458 | | - . ", " . $appear->tr_mw_version; |
1459 | | - } |
1460 | | - |
1461 | | - // Otherwise, this test has previous recorded results. |
1462 | | - // See when this test last had a different result to what we're seeing now. |
1463 | | - $conds = array( |
1464 | | - 'ti_name' => $testname, |
1465 | | - 'ti_success' => ( $after == 'f' ? "1" : "0" ) ); |
1466 | | - |
1467 | | - if ( $this->curRun ) { |
1468 | | - $conds[] = "ti_run != " . $this->db->addQuotes ( $this->curRun ); |
1469 | | - } |
1470 | | - |
1471 | | - $changedRun = $this->db->selectField ( 'testitem', 'MAX(ti_run)', $conds, __METHOD__ ); |
1472 | | - |
1473 | | - // If no record of ever having had a different result. |
1474 | | - if ( is_null ( $changedRun ) ) { |
1475 | | - if ( $after == "f" ) { |
1476 | | - return "Has never passed"; |
1477 | | - } else { |
1478 | | - return "Has never failed"; |
1479 | | - } |
1480 | | - } |
1481 | | - |
1482 | | - // Otherwise, we're looking at a test whose status has changed. |
1483 | | - // (i.e. it used to work, but now doesn't; or used to fail, but is now fixed.) |
1484 | | - // In this situation, give as much info as we can as to when it changed status. |
1485 | | - $pre = $this->db->selectRow ( 'testrun', |
1486 | | - array( 'tr_date', 'tr_mw_version' ), |
1487 | | - array( 'tr_id' => $changedRun ), |
1488 | | - __METHOD__ ); |
1489 | | - $post = $this->db->selectRow ( 'testrun', |
1490 | | - array( 'tr_date', 'tr_mw_version' ), |
1491 | | - array( "tr_id > " . $this->db->addQuotes ( $changedRun ) ), |
1492 | | - __METHOD__, |
1493 | | - array( "LIMIT" => 1, "ORDER BY" => 'tr_id' ) |
1494 | | - ); |
1495 | | - |
1496 | | - if ( $post ) { |
1497 | | - $postDate = date( "d-M-Y H:i:s", strtotime ( $post->tr_date ) ) . ", {$post->tr_mw_version}"; |
1498 | | - } else { |
1499 | | - $postDate = 'now'; |
1500 | | - } |
1501 | | - |
1502 | | - return ( $after == "f" ? "Introduced" : "Fixed" ) . " between " |
1503 | | - . date( "d-M-Y H:i:s", strtotime ( $pre->tr_date ) ) . ", " . $pre->tr_mw_version |
1504 | | - . " and $postDate"; |
1505 | | - |
1506 | | - } |
1507 | | - |
1508 | | - /** |
1509 | | - * Commit transaction and clean up for result recording |
1510 | | - */ |
1511 | | - function end() { |
1512 | | - $this->lb->commitMasterChanges(); |
1513 | | - $this->lb->closeAll(); |
1514 | | - parent::end(); |
1515 | | - } |
1516 | | - |
1517 | | -} |
1518 | | - |
1519 | | -class DbTestRecorder extends DbTestPreviewer { |
1520 | | - var $version; |
1521 | | - |
1522 | | - /** |
1523 | | - * Set up result recording; insert a record for the run with the date |
1524 | | - * and all that fun stuff |
1525 | | - */ |
1526 | | - function start() { |
1527 | | - global $wgDBtype; |
1528 | | - $this->db->begin(); |
1529 | | - |
1530 | | - if ( ! $this->db->tableExists( 'testrun' ) |
1531 | | - or ! $this->db->tableExists( 'testitem' ) ) |
1532 | | - { |
1533 | | - print "WARNING> `testrun` table not found in database. Trying to create table.\n"; |
1534 | | - if ( $wgDBtype === 'postgres' ) { |
1535 | | - $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.postgres.sql' ); |
1536 | | - } elseif ( $wgDBtype === 'oracle' ) { |
1537 | | - $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.ora.sql' ); |
1538 | | - } else { |
1539 | | - $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.sql' ); |
1540 | | - } |
1541 | | - |
1542 | | - echo "OK, resuming.\n"; |
1543 | | - } |
1544 | | - |
1545 | | - parent::start(); |
1546 | | - |
1547 | | - $this->db->insert( 'testrun', |
1548 | | - array( |
1549 | | - 'tr_date' => $this->db->timestamp(), |
1550 | | - 'tr_mw_version' => $this->version, |
1551 | | - 'tr_php_version' => phpversion(), |
1552 | | - 'tr_db_version' => $this->db->getServerVersion(), |
1553 | | - 'tr_uname' => php_uname() |
1554 | | - ), |
1555 | | - __METHOD__ ); |
1556 | | - if ( $wgDBtype === 'postgres' ) { |
1557 | | - $this->curRun = $this->db->currentSequenceValue( 'testrun_id_seq' ); |
1558 | | - } else { |
1559 | | - $this->curRun = $this->db->insertId(); |
1560 | | - } |
1561 | | - } |
1562 | | - |
1563 | | - /** |
1564 | | - * Record an individual test item's success or failure to the db |
1565 | | - * |
1566 | | - * @param $test String |
1567 | | - * @param $result Boolean |
1568 | | - */ |
1569 | | - function record( $test, $result ) { |
1570 | | - parent::record( $test, $result ); |
1571 | | - |
1572 | | - $this->db->insert( 'testitem', |
1573 | | - array( |
1574 | | - 'ti_run' => $this->curRun, |
1575 | | - 'ti_name' => $test, |
1576 | | - 'ti_success' => $result ? 1 : 0, |
1577 | | - ), |
1578 | | - __METHOD__ ); |
1579 | | - } |
1580 | | -} |
1581 | | - |
1582 | | -class RemoteTestRecorder extends TestRecorder { |
1583 | | - function start() { |
1584 | | - parent::start(); |
1585 | | - |
1586 | | - $this->results = array(); |
1587 | | - $this->ping( 'running' ); |
1588 | | - } |
1589 | | - |
1590 | | - function record( $test, $result ) { |
1591 | | - parent::record( $test, $result ); |
1592 | | - $this->results[$test] = (bool)$result; |
1593 | | - } |
1594 | | - |
1595 | | - function end() { |
1596 | | - $this->ping( 'complete', $this->results ); |
1597 | | - parent::end(); |
1598 | | - } |
1599 | | - |
1600 | | - /** |
1601 | | - * Inform a CodeReview instance that we've started or completed a test run... |
1602 | | - * |
1603 | | - * @param $status string: "running" - tell it we've started |
1604 | | - * "complete" - provide test results array |
1605 | | - * "abort" - something went horribly awry |
1606 | | - * @param $results array of test name => true/false |
1607 | | - */ |
1608 | | - function ping( $status, $results = false ) { |
1609 | | - global $wgParserTestRemote, $IP; |
1610 | | - |
1611 | | - $remote = $wgParserTestRemote; |
1612 | | - $revId = SpecialVersion::getSvnRevision( $IP ); |
1613 | | - $jsonResults = FormatJson::encode( $results ); |
1614 | | - |
1615 | | - if ( !$remote ) { |
1616 | | - print "Can't do remote upload without configuring \$wgParserTestRemote!\n"; |
1617 | | - exit( 1 ); |
1618 | | - } |
1619 | | - |
1620 | | - // Generate a hash MAC to validate our credentials |
1621 | | - $message = array( |
1622 | | - $remote['repo'], |
1623 | | - $remote['suite'], |
1624 | | - $revId, |
1625 | | - $status, |
1626 | | - ); |
1627 | | - |
1628 | | - if ( $status == "complete" ) { |
1629 | | - $message[] = $jsonResults; |
1630 | | - } |
1631 | | - $hmac = hash_hmac( "sha1", implode( "|", $message ), $remote['secret'] ); |
1632 | | - |
1633 | | - $postData = array( |
1634 | | - 'action' => 'codetestupload', |
1635 | | - 'format' => 'json', |
1636 | | - 'repo' => $remote['repo'], |
1637 | | - 'suite' => $remote['suite'], |
1638 | | - 'rev' => $revId, |
1639 | | - 'status' => $status, |
1640 | | - 'hmac' => $hmac, |
1641 | | - ); |
1642 | | - |
1643 | | - if ( $status == "complete" ) { |
1644 | | - $postData['results'] = $jsonResults; |
1645 | | - } |
1646 | | - |
1647 | | - $response = $this->post( $remote['api-url'], $postData ); |
1648 | | - |
1649 | | - if ( $response === false ) { |
1650 | | - print "CodeReview info upload failed to reach server.\n"; |
1651 | | - exit( 1 ); |
1652 | | - } |
1653 | | - |
1654 | | - $responseData = FormatJson::decode( $response, true ); |
1655 | | - |
1656 | | - if ( !is_array( $responseData ) ) { |
1657 | | - print "CodeReview API response not recognized...\n"; |
1658 | | - wfDebug( "Unrecognized CodeReview API response: $response\n" ); |
1659 | | - exit( 1 ); |
1660 | | - } |
1661 | | - |
1662 | | - if ( isset( $responseData['error'] ) ) { |
1663 | | - $code = $responseData['error']['code']; |
1664 | | - $info = $responseData['error']['info']; |
1665 | | - print "CodeReview info upload failed: $code $info\n"; |
1666 | | - exit( 1 ); |
1667 | | - } |
1668 | | - } |
1669 | | - |
1670 | | - function post( $url, $data ) { |
1671 | | - return Http::post( $url, array( 'postData' => $data ) ); |
1672 | | - } |
1673 | | -} |
1674 | | - |
1675 | | -class TestFileIterator implements Iterator { |
1676 | | - private $file; |
1677 | | - private $fh; |
1678 | | - private $parser; |
1679 | | - private $index = 0; |
1680 | | - private $test; |
1681 | | - private $lineNum; |
1682 | | - private $eof; |
1683 | | - |
1684 | | - function __construct( $file, $parser = null ) { |
1685 | | - global $IP; |
1686 | | - |
1687 | | - $this->file = $file; |
1688 | | - $this->fh = fopen( $this->file, "rt" ); |
1689 | | - |
1690 | | - if ( !$this->fh ) { |
1691 | | - wfDie( "Couldn't open file '$file'\n" ); |
1692 | | - } |
1693 | | - |
1694 | | - $this->parser = $parser; |
1695 | | - |
1696 | | - if ( $this->parser ) { |
1697 | | - $this->parser->showRunFile( wfRelativePath( $this->file, $IP ) ); |
1698 | | - } |
1699 | | - |
1700 | | - $this->lineNum = $this->index = 0; |
1701 | | - } |
1702 | | - |
1703 | | - function setParser( ParserTest $parser ) { |
1704 | | - $this->parser = $parser; |
1705 | | - } |
1706 | | - |
1707 | | - function rewind() { |
1708 | | - if ( fseek( $this->fh, 0 ) ) { |
1709 | | - wfDie( "Couldn't fseek to the start of '$this->file'\n" ); |
1710 | | - } |
1711 | | - |
1712 | | - $this->index = -1; |
1713 | | - $this->lineNum = 0; |
1714 | | - $this->eof = false; |
1715 | | - $this->next(); |
1716 | | - |
1717 | | - return true; |
1718 | | - } |
1719 | | - |
1720 | | - function current() { |
1721 | | - return $this->test; |
1722 | | - } |
1723 | | - |
1724 | | - function key() { |
1725 | | - return $this->index; |
1726 | | - } |
1727 | | - |
1728 | | - function next() { |
1729 | | - if ( $this->readNextTest() ) { |
1730 | | - $this->index++; |
1731 | | - return true; |
1732 | | - } else { |
1733 | | - $this->eof = true; |
1734 | | - } |
1735 | | - } |
1736 | | - |
1737 | | - function valid() { |
1738 | | - return $this->eof != true; |
1739 | | - } |
1740 | | - |
1741 | | - function readNextTest() { |
1742 | | - $data = array(); |
1743 | | - $section = null; |
1744 | | - |
1745 | | - while ( false !== ( $line = fgets( $this->fh ) ) ) { |
1746 | | - $this->lineNum++; |
1747 | | - $matches = array(); |
1748 | | - |
1749 | | - if ( preg_match( '/^!!\s*(\w+)/', $line, $matches ) ) { |
1750 | | - $section = strtolower( $matches[1] ); |
1751 | | - |
1752 | | - if ( $section == 'endarticle' ) { |
1753 | | - if ( !isset( $data['text'] ) ) { |
1754 | | - wfDie( "'endarticle' without 'text' at line {$this->lineNum} of $this->file\n" ); |
1755 | | - } |
1756 | | - |
1757 | | - if ( !isset( $data['article'] ) ) { |
1758 | | - wfDie( "'endarticle' without 'article' at line {$this->lineNum} of $this->file\n" ); |
1759 | | - } |
1760 | | - |
1761 | | - if ( $this->parser ) { |
1762 | | - $this->parser->addArticle( $this->parser->chomp( $data['article'] ), $this->parser->chomp( $data['text'] ), |
1763 | | - $this->lineNum ); |
1764 | | - } |
1765 | | - |
1766 | | - $data = array(); |
1767 | | - $section = null; |
1768 | | - |
1769 | | - continue; |
1770 | | - } |
1771 | | - |
1772 | | - if ( $section == 'endhooks' ) { |
1773 | | - if ( !isset( $data['hooks'] ) ) { |
1774 | | - wfDie( "'endhooks' without 'hooks' at line {$this->lineNum} of $this->file\n" ); |
1775 | | - } |
1776 | | - |
1777 | | - foreach ( explode( "\n", $data['hooks'] ) as $line ) { |
1778 | | - $line = trim( $line ); |
1779 | | - |
1780 | | - if ( $line ) { |
1781 | | - if ( $this->parser && !$this->parser->requireHook( $line ) ) { |
1782 | | - return false; |
1783 | | - } |
1784 | | - } |
1785 | | - } |
1786 | | - |
1787 | | - $data = array(); |
1788 | | - $section = null; |
1789 | | - |
1790 | | - continue; |
1791 | | - } |
1792 | | - |
1793 | | - if ( $section == 'endfunctionhooks' ) { |
1794 | | - if ( !isset( $data['functionhooks'] ) ) { |
1795 | | - wfDie( "'endfunctionhooks' without 'functionhooks' at line {$this->lineNum} of $this->file\n" ); |
1796 | | - } |
1797 | | - |
1798 | | - foreach ( explode( "\n", $data['functionhooks'] ) as $line ) { |
1799 | | - $line = trim( $line ); |
1800 | | - |
1801 | | - if ( $line ) { |
1802 | | - if ( $this->parser && !$this->parser->requireFunctionHook( $line ) ) { |
1803 | | - return false; |
1804 | | - } |
1805 | | - } |
1806 | | - } |
1807 | | - |
1808 | | - $data = array(); |
1809 | | - $section = null; |
1810 | | - |
1811 | | - continue; |
1812 | | - } |
1813 | | - |
1814 | | - if ( $section == 'end' ) { |
1815 | | - if ( !isset( $data['test'] ) ) { |
1816 | | - wfDie( "'end' without 'test' at line {$this->lineNum} of $this->file\n" ); |
1817 | | - } |
1818 | | - |
1819 | | - if ( !isset( $data['input'] ) ) { |
1820 | | - wfDie( "'end' without 'input' at line {$this->lineNum} of $this->file\n" ); |
1821 | | - } |
1822 | | - |
1823 | | - if ( !isset( $data['result'] ) ) { |
1824 | | - wfDie( "'end' without 'result' at line {$this->lineNum} of $this->file\n" ); |
1825 | | - } |
1826 | | - |
1827 | | - if ( !isset( $data['options'] ) ) { |
1828 | | - $data['options'] = ''; |
1829 | | - } |
1830 | | - |
1831 | | - if ( !isset( $data['config'] ) ) |
1832 | | - $data['config'] = ''; |
1833 | | - |
1834 | | - if ( $this->parser |
1835 | | - && ( ( preg_match( '/\\bdisabled\\b/i', $data['options'] ) && !$this->parser->runDisabled ) |
1836 | | - || !preg_match( "/" . $this->parser->regex . "/i", $data['test'] ) ) ) { |
1837 | | - # disabled test |
1838 | | - $data = array(); |
1839 | | - $section = null; |
1840 | | - |
1841 | | - continue; |
1842 | | - } |
1843 | | - |
1844 | | - global $wgUseTeX; |
1845 | | - |
1846 | | - if ( $this->parser && |
1847 | | - preg_match( '/\\bmath\\b/i', $data['options'] ) && !$wgUseTeX ) { |
1848 | | - # don't run math tests if $wgUseTeX is set to false in LocalSettings |
1849 | | - $data = array(); |
1850 | | - $section = null; |
1851 | | - |
1852 | | - continue; |
1853 | | - } |
1854 | | - |
1855 | | - if ( $this->parser ) { |
1856 | | - $this->test = array( |
1857 | | - 'test' => $this->parser->chomp( $data['test'] ), |
1858 | | - 'input' => $this->parser->chomp( $data['input'] ), |
1859 | | - 'result' => $this->parser->chomp( $data['result'] ), |
1860 | | - 'options' => $this->parser->chomp( $data['options'] ), |
1861 | | - 'config' => $this->parser->chomp( $data['config'] ) ); |
1862 | | - } else { |
1863 | | - $this->test['test'] = $data['test']; |
1864 | | - } |
1865 | | - |
1866 | | - return true; |
1867 | | - } |
1868 | | - |
1869 | | - if ( isset ( $data[$section] ) ) { |
1870 | | - wfDie( "duplicate section '$section' at line {$this->lineNum} of $this->file\n" ); |
1871 | | - } |
1872 | | - |
1873 | | - $data[$section] = ''; |
1874 | | - |
1875 | | - continue; |
1876 | | - } |
1877 | | - |
1878 | | - if ( $section ) { |
1879 | | - $data[$section] .= $line; |
1880 | | - } |
1881 | | - } |
1882 | | - |
1883 | | - return false; |
1884 | | - } |
1885 | | -} |
Index: trunk/phase3/maintenance/parserTests.php |
— | — | @@ -1,91 +0,0 @@ |
2 | | -<?php |
3 | | -# Copyright (C) 2004 Brion Vibber <brion@pobox.com> |
4 | | -# http://www.mediawiki.org/ |
5 | | -# |
6 | | -# This program is free software; you can redistribute it and/or modify |
7 | | -# it under the terms of the GNU General Public License as published by |
8 | | -# the Free Software Foundation; either version 2 of the License, or |
9 | | -# (at your option) any later version. |
10 | | -# |
11 | | -# This program is distributed in the hope that it will be useful, |
12 | | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | -# GNU General Public License for more details. |
15 | | -# |
16 | | -# You should have received a copy of the GNU General Public License along |
17 | | -# with this program; if not, write to the Free Software Foundation, Inc., |
18 | | -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | | -# http://www.gnu.org/copyleft/gpl.html |
20 | | - |
21 | | -/** |
22 | | - * @file |
23 | | - * @ingroup Maintenance |
24 | | - */ |
25 | | - |
26 | | -$options = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record', 'run-disabled' ); |
27 | | -$optionsWithArgs = array( 'regex', 'seed', 'setversion' ); |
28 | | - |
29 | | -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); |
30 | | -require_once( dirname( __FILE__ ) . '/parserTests.inc' ); |
31 | | - |
32 | | -if ( isset( $options['help'] ) ) { |
33 | | - echo <<<ENDS |
34 | | -MediaWiki $wgVersion parser test suite |
35 | | -Usage: php parserTests.php [options...] |
36 | | - |
37 | | -Options: |
38 | | - --quick Suppress diff output of failed tests |
39 | | - --quiet Suppress notification of passed tests (shows only failed tests) |
40 | | - --show-output Show expected and actual output |
41 | | - --color[=yes|no] Override terminal detection and force color output on or off |
42 | | - use wgCommandLineDarkBg = true; if your term is dark |
43 | | - --regex Only run tests whose descriptions which match given regex |
44 | | - --file=<testfile> Run test cases from a custom file instead of parserTests.txt |
45 | | - --record Record tests in database |
46 | | - --compare Compare with recorded results, without updating the database. |
47 | | - --setversion When using --record, set the version string to use (useful |
48 | | - with git-svn so that you can get the exact revision) |
49 | | - --keep-uploads Re-use the same upload directory for each test, don't delete it |
50 | | - --fuzz Do a fuzz test instead of a normal test |
51 | | - --seed <n> Start the fuzz test from the specified seed |
52 | | - --help Show this help message |
53 | | - --run-disabled run disabled tests |
54 | | - --upload Upload test results to remote wiki (per \$wgParserTestRemote) |
55 | | - |
56 | | -ENDS; |
57 | | - exit( 0 ); |
58 | | -} |
59 | | - |
60 | | -# Cases of weird db corruption were encountered when running tests on earlyish |
61 | | -# versions of SQLite |
62 | | -if ( $wgDBtype == 'sqlite' ) { |
63 | | - $db = wfGetDB( DB_MASTER ); |
64 | | - $version = $db->getServerVersion(); |
65 | | - if ( version_compare( $version, '3.6' ) < 0 ) { |
66 | | - die( "Parser tests require SQLite version 3.6 or later, you have $version\n" ); |
67 | | - } |
68 | | -} |
69 | | - |
70 | | -# There is a convention that the parser should never |
71 | | -# refer to $wgTitle directly, but instead use the title |
72 | | -# passed to it. |
73 | | -$wgTitle = Title::newFromText( 'Parser test script do not use' ); |
74 | | -$tester = new ParserTest($options); |
75 | | - |
76 | | -if ( isset( $options['file'] ) ) { |
77 | | - $files = array( $options['file'] ); |
78 | | -} else { |
79 | | - // Default parser tests and any set from extensions or local config |
80 | | - $files = $wgParserTestFiles; |
81 | | -} |
82 | | - |
83 | | -# Print out software version to assist with locating regressions |
84 | | -$version = SpecialVersion::getVersion(); |
85 | | -echo( "This is MediaWiki version {$version}.\n\n" ); |
86 | | - |
87 | | -if ( isset( $options['fuzz'] ) ) { |
88 | | - $tester->fuzzTest( $files ); |
89 | | -} else { |
90 | | - $ok = $tester->runTestsFromFiles( $files ); |
91 | | - exit ( $ok ? 0 : 1 ); |
92 | | -} |
Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -1,8224 +0,0 @@ |
2 | | -# MediaWiki Parser test cases |
3 | | -# Some taken from http://meta.wikimedia.org/wiki/Parser_testing |
4 | | -# All (C) their respective authors and released under the GPL |
5 | | -# |
6 | | -# The syntax should be fairly self-explanatory. |
7 | | -# |
8 | | -# Currently supported test options: |
9 | | -# One of the following three: |
10 | | -# |
11 | | -# (default) generate HTML output |
12 | | -# pst apply pre-save transform |
13 | | -# msg apply message transform |
14 | | -# |
15 | | -# Plus any combination of these: |
16 | | -# |
17 | | -# cat add category links |
18 | | -# ill add inter-language links |
19 | | -# subpage enable subpages (disabled by default) |
20 | | -# noxml don't check for XML well formdness |
21 | | -# title=[[XXX]] run test using article title XXX |
22 | | -# language=XXX set content language to XXX for this test |
23 | | -# variant=XXX set the variant of language for this test (eg zh-tw) |
24 | | -# disabled do not run test |
25 | | -# showtitle make the first line the title |
26 | | -# comment run through Linker::formatComment() instead of main parser |
27 | | -# local format section links in edit comment text as local links |
28 | | -# |
29 | | -# For testing purposes, temporary articles can created: |
30 | | -# !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle |
31 | | -# where '/' denotes a newline. |
32 | | - |
33 | | -# This is the standard article assumed to exist. |
34 | | -!! article |
35 | | -Main Page |
36 | | -!! text |
37 | | -blah blah |
38 | | -!! endarticle |
39 | | - |
40 | | -!!article |
41 | | -Template:Foo |
42 | | -!!text |
43 | | -FOO |
44 | | -!!endarticle |
45 | | - |
46 | | -!! article |
47 | | -Template:Blank |
48 | | -!! text |
49 | | -!! endarticle |
50 | | - |
51 | | -!! article |
52 | | -Template:! |
53 | | -!! text |
54 | | -| |
55 | | -!! endarticle |
56 | | - |
57 | | -!!article |
58 | | -MediaWiki:bad image list |
59 | | -!!text |
60 | | -* [[File:Bad.jpg]] except [[Nasty page]] |
61 | | -!!endarticle |
62 | | - |
63 | | -### |
64 | | -### Basic tests |
65 | | -### |
66 | | -!! test |
67 | | -Blank input |
68 | | -!! input |
69 | | -!! result |
70 | | -!! end |
71 | | - |
72 | | - |
73 | | -!! test |
74 | | -Simple paragraph |
75 | | -!! input |
76 | | -This is a simple paragraph. |
77 | | -!! result |
78 | | -<p>This is a simple paragraph. |
79 | | -</p> |
80 | | -!! end |
81 | | - |
82 | | -!! test |
83 | | -Simple list |
84 | | -!! input |
85 | | -* Item 1 |
86 | | -* Item 2 |
87 | | -!! result |
88 | | -<ul><li> Item 1 |
89 | | -</li><li> Item 2 |
90 | | -</li></ul> |
91 | | - |
92 | | -!! end |
93 | | - |
94 | | -!! test |
95 | | -Italics and bold |
96 | | -!! input |
97 | | -* plain |
98 | | -* plain''italic''plain |
99 | | -* plain''italic''plain''italic''plain |
100 | | -* plain'''bold'''plain |
101 | | -* plain'''bold'''plain'''bold'''plain |
102 | | -* plain''italic''plain'''bold'''plain |
103 | | -* plain'''bold'''plain''italic''plain |
104 | | -* plain''italic'''bold-italic'''italic''plain |
105 | | -* plain'''bold''bold-italic''bold'''plain |
106 | | -* plain'''''bold-italic'''italic''plain |
107 | | -* plain'''''bold-italic''bold'''plain |
108 | | -* plain''italic'''bold-italic'''''plain |
109 | | -* plain'''bold''bold-italic'''''plain |
110 | | -* plain l'''italic''plain |
111 | | -* plain l''''bold''' plain |
112 | | -!! result |
113 | | -<ul><li> plain |
114 | | -</li><li> plain<i>italic</i>plain |
115 | | -</li><li> plain<i>italic</i>plain<i>italic</i>plain |
116 | | -</li><li> plain<b>bold</b>plain |
117 | | -</li><li> plain<b>bold</b>plain<b>bold</b>plain |
118 | | -</li><li> plain<i>italic</i>plain<b>bold</b>plain |
119 | | -</li><li> plain<b>bold</b>plain<i>italic</i>plain |
120 | | -</li><li> plain<i>italic<b>bold-italic</b>italic</i>plain |
121 | | -</li><li> plain<b>bold<i>bold-italic</i>bold</b>plain |
122 | | -</li><li> plain<i><b>bold-italic</b>italic</i>plain |
123 | | -</li><li> plain<b><i>bold-italic</i>bold</b>plain |
124 | | -</li><li> plain<i>italic<b>bold-italic</b></i>plain |
125 | | -</li><li> plain<b>bold<i>bold-italic</i></b>plain |
126 | | -</li><li> plain l'<i>italic</i>plain |
127 | | -</li><li> plain l'<b>bold</b> plain |
128 | | -</li></ul> |
129 | | - |
130 | | -!! end |
131 | | - |
132 | | -### |
133 | | -### <nowiki> test cases |
134 | | -### |
135 | | - |
136 | | -!! test |
137 | | -<nowiki> unordered list |
138 | | -!! input |
139 | | -<nowiki>* This is not an unordered list item.</nowiki> |
140 | | -!! result |
141 | | -<p>* This is not an unordered list item. |
142 | | -</p> |
143 | | -!! end |
144 | | - |
145 | | -!! test |
146 | | -<nowiki> spacing |
147 | | -!! input |
148 | | -<nowiki>Lorem ipsum dolor |
149 | | - |
150 | | -sed abit. |
151 | | - sed nullum. |
152 | | - |
153 | | -:and a colon |
154 | | -</nowiki> |
155 | | -!! result |
156 | | -<p>Lorem ipsum dolor |
157 | | - |
158 | | -sed abit. |
159 | | - sed nullum. |
160 | | - |
161 | | -:and a colon |
162 | | - |
163 | | -</p> |
164 | | -!! end |
165 | | - |
166 | | -!! test |
167 | | -nowiki 3 |
168 | | -!! input |
169 | | -:There is not nowiki. |
170 | | -:There is <nowiki>nowiki</nowiki>. |
171 | | - |
172 | | -#There is not nowiki. |
173 | | -#There is <nowiki>nowiki</nowiki>. |
174 | | - |
175 | | -*There is not nowiki. |
176 | | -*There is <nowiki>nowiki</nowiki>. |
177 | | -!! result |
178 | | -<dl><dd>There is not nowiki. |
179 | | -</dd><dd>There is nowiki. |
180 | | -</dd></dl> |
181 | | -<ol><li>There is not nowiki. |
182 | | -</li><li>There is nowiki. |
183 | | -</li></ol> |
184 | | -<ul><li>There is not nowiki. |
185 | | -</li><li>There is nowiki. |
186 | | -</li></ul> |
187 | | - |
188 | | -!! end |
189 | | - |
190 | | - |
191 | | -### |
192 | | -### Comments |
193 | | -### |
194 | | -!! test |
195 | | -Comment test 1 |
196 | | -!! input |
197 | | -<!-- comment 1 --> asdf |
198 | | -<!-- comment 2 --> |
199 | | -!! result |
200 | | -<pre>asdf |
201 | | -</pre> |
202 | | - |
203 | | -!! end |
204 | | - |
205 | | -!! test |
206 | | -Comment test 2 |
207 | | -!! input |
208 | | -asdf |
209 | | -<!-- comment 1 --> |
210 | | -jkl |
211 | | -!! result |
212 | | -<p>asdf |
213 | | -jkl |
214 | | -</p> |
215 | | -!! end |
216 | | - |
217 | | -!! test |
218 | | -Comment test 3 |
219 | | -!! input |
220 | | -asdf |
221 | | -<!-- comment 1 --> |
222 | | -<!-- comment 2 --> |
223 | | -jkl |
224 | | -!! result |
225 | | -<p>asdf |
226 | | -jkl |
227 | | -</p> |
228 | | -!! end |
229 | | - |
230 | | -!! test |
231 | | -Comment test 4 |
232 | | -!! input |
233 | | -asdf<!-- comment 1 -->jkl |
234 | | -!! result |
235 | | -<p>asdfjkl |
236 | | -</p> |
237 | | -!! end |
238 | | - |
239 | | -!! test |
240 | | -Comment spacing |
241 | | -!! input |
242 | | -a |
243 | | - <!-- foo --> b <!-- bar --> |
244 | | -c |
245 | | -!! result |
246 | | -<p>a |
247 | | -</p> |
248 | | -<pre> b |
249 | | -</pre> |
250 | | -<p>c |
251 | | -</p> |
252 | | -!! end |
253 | | - |
254 | | -!! test |
255 | | -Comment whitespace |
256 | | -!! input |
257 | | -<!-- returns a single newline, not nothing, since the newline after > is not stripped --> |
258 | | -!! result |
259 | | - |
260 | | -!! end |
261 | | - |
262 | | -!! test |
263 | | -Comment semantics and delimiters |
264 | | -!! input |
265 | | -<!-- --><!----><!-----><!------> |
266 | | -!! result |
267 | | - |
268 | | -!! end |
269 | | - |
270 | | -!! test |
271 | | -Comment semantics and delimiters, redux |
272 | | -!! input |
273 | | -<!-- In SGML every "foo" here would actually show up in the text -- foo -- bar |
274 | | -!! result |
275 | | - |
276 | | -!! end |
277 | | - |
278 | | -!! test |
279 | | -Comment semantics and delimiters: directors cut |
280 | | -!! input |
281 | | -<!-- ... However we like to keep things simple and somewhat XML-ish so we eat |
282 | | -everything starting with < followed by !-- until the first -- and > we see, |
283 | | -that wouldn't be valid XML however, since in XML -- has to terminate a comment |
284 | | -!! result |
285 | | -<p>--> |
286 | | -</p> |
287 | | -!! end |
288 | | - |
289 | | -!! test |
290 | | -Comment semantics: nesting |
291 | | -!! input |
292 | | -<!--<!-- no, we're not going to do anything fancy here -->--> |
293 | | -!! result |
294 | | -<p>--> |
295 | | -</p> |
296 | | -!! end |
297 | | - |
298 | | -!! test |
299 | | -Comment semantics: unclosed comment at end |
300 | | -!! input |
301 | | -<!--This comment will run out to the end of the document |
302 | | -!! result |
303 | | - |
304 | | -!! end |
305 | | - |
306 | | -!! test |
307 | | -Comment in template title |
308 | | -!! input |
309 | | -{{f<!---->oo}} |
310 | | -!! result |
311 | | -<p>FOO |
312 | | -</p> |
313 | | -!! end |
314 | | - |
315 | | -!! test |
316 | | -Comment on its own line post-expand |
317 | | -!! input |
318 | | -a |
319 | | -{{blank}}<!----> |
320 | | -b |
321 | | -!! result |
322 | | -<p>a |
323 | | -</p><p>b |
324 | | -</p> |
325 | | -!! end |
326 | | - |
327 | | -### |
328 | | -### Preformatted text |
329 | | -### |
330 | | -!! test |
331 | | -Preformatted text |
332 | | -!! input |
333 | | - This is some |
334 | | - Preformatted text |
335 | | - With ''italic'' |
336 | | - And '''bold''' |
337 | | - And a [[Main Page|link]] |
338 | | -!! result |
339 | | -<pre>This is some |
340 | | -Preformatted text |
341 | | -With <i>italic</i> |
342 | | -And <b>bold</b> |
343 | | -And a <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> |
344 | | -</pre> |
345 | | -!! end |
346 | | - |
347 | | -!! test |
348 | | -<pre> with <nowiki> inside (compatibility with 1.6 and earlier) |
349 | | -!! input |
350 | | -<pre><nowiki> |
351 | | -<b> |
352 | | -<cite> |
353 | | -<em> |
354 | | -</nowiki></pre> |
355 | | -!! result |
356 | | -<pre> |
357 | | -<b> |
358 | | -<cite> |
359 | | -<em> |
360 | | -</pre> |
361 | | - |
362 | | -!! end |
363 | | - |
364 | | -!! test |
365 | | -Regression with preformatted in <center> |
366 | | -!! input |
367 | | -<center> |
368 | | - Blah |
369 | | -</center> |
370 | | -!! result |
371 | | -<center> |
372 | | -<pre>Blah |
373 | | -</pre> |
374 | | -</center> |
375 | | - |
376 | | -!! end |
377 | | - |
378 | | -# Expected output in the following test is not really expected (there should be |
379 | | -# <pre> in the output) -- it's only testing for well-formedness. |
380 | | -!! test |
381 | | -Bug 6200: Preformatted in <blockquote> |
382 | | -!! input |
383 | | -<blockquote> |
384 | | - Blah |
385 | | -</blockquote> |
386 | | -!! result |
387 | | -<blockquote> |
388 | | - Blah |
389 | | -</blockquote> |
390 | | - |
391 | | -!! end |
392 | | - |
393 | | -!! test |
394 | | -<pre> with attributes (bug 3202) |
395 | | -!! input |
396 | | -<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre> |
397 | | -!! result |
398 | | -<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre> |
399 | | - |
400 | | -!! end |
401 | | - |
402 | | -!! test |
403 | | -<pre> with width attribute (bug 3202) |
404 | | -!! input |
405 | | -<pre width="8">Narrow screen goodies</pre> |
406 | | -!! result |
407 | | -<pre width="8">Narrow screen goodies</pre> |
408 | | - |
409 | | -!! end |
410 | | - |
411 | | -!! test |
412 | | -<pre> with forbidden attribute (bug 3202) |
413 | | -!! input |
414 | | -<pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre> |
415 | | -!! result |
416 | | -<pre width="8">Narrow screen goodies</pre> |
417 | | - |
418 | | -!! end |
419 | | - |
420 | | -!! test |
421 | | -<pre> with forbidden attribute values (bug 3202) |
422 | | -!! input |
423 | | -<pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre> |
424 | | -!! result |
425 | | -<pre width="8" style="/* insecure input */">Narrow screen goodies</pre> |
426 | | - |
427 | | -!! end |
428 | | - |
429 | | -### |
430 | | -### Definition lists |
431 | | -### |
432 | | -!! test |
433 | | -Simple definition |
434 | | -!! input |
435 | | -; name : Definition |
436 | | -!! result |
437 | | -<dl><dt> name </dt><dd> Definition |
438 | | -</dd></dl> |
439 | | - |
440 | | -!! end |
441 | | - |
442 | | -!! test |
443 | | -Definition list for indentation only |
444 | | -!! input |
445 | | -: Indented text |
446 | | -!! result |
447 | | -<dl><dd> Indented text |
448 | | -</dd></dl> |
449 | | - |
450 | | -!! end |
451 | | - |
452 | | -!! test |
453 | | -Definition list with no space |
454 | | -!! input |
455 | | -;name:Definition |
456 | | -!! result |
457 | | -<dl><dt>name</dt><dd>Definition |
458 | | -</dd></dl> |
459 | | - |
460 | | -!!end |
461 | | - |
462 | | -!! test |
463 | | -Definition list with URL link |
464 | | -!! input |
465 | | -; http://example.com/ : definition |
466 | | -!! result |
467 | | -<dl><dt> <a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> </dt><dd> definition |
468 | | -</dd></dl> |
469 | | - |
470 | | -!! end |
471 | | - |
472 | | -!! test |
473 | | -Definition list with bracketed URL link |
474 | | -!! input |
475 | | -;[http://www.example.com/ Example]:Something about it |
476 | | -!! result |
477 | | -<dl><dt><a href="http://www.example.com/" class="external text" rel="nofollow">Example</a></dt><dd>Something about it |
478 | | -</dd></dl> |
479 | | - |
480 | | -!! end |
481 | | - |
482 | | -!! test |
483 | | -Definition list with wikilink containing colon |
484 | | -!! input |
485 | | -; [[Help:FAQ]]: The least-read page on Wikipedia |
486 | | -!! result |
487 | | -<dl><dt> <a href="https://www.mediawiki.org/index.php?title=Help:FAQ&action=edit&redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia |
488 | | -</dd></dl> |
489 | | - |
490 | | -!! end |
491 | | - |
492 | | -# At Brion's and JeLuF's insistence... :) |
493 | | -!! test |
494 | | -Definition list with news link containing colon |
495 | | -!! input |
496 | | -; news:alt.wikipedia.rox: This isn't even a real newsgroup! |
497 | | -!! result |
498 | | -<dl><dt> <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup! |
499 | | -</dd></dl> |
500 | | - |
501 | | -!! end |
502 | | - |
503 | | -!! test |
504 | | -Malformed definition list with colon |
505 | | -!! input |
506 | | -; news:alt.wikipedia.rox -- don't crash or enter an infinite loop |
507 | | -!! result |
508 | | -<dl><dt> <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop |
509 | | -</dt></dl> |
510 | | - |
511 | | -!! end |
512 | | - |
513 | | -!! test |
514 | | -Definition lists: colon in external link text |
515 | | -!! input |
516 | | -; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up |
517 | | -!! result |
518 | | -<dl><dt> <a href="http://www.wikipedia2.org/" class="external text" rel="nofollow">Wikipedia : The Next Generation</a></dt><dd> OK, I made that up |
519 | | -</dd></dl> |
520 | | - |
521 | | -!! end |
522 | | - |
523 | | -!! test |
524 | | -Definition lists: colon in HTML attribute |
525 | | -!! input |
526 | | -;<b style="display: inline">bold</b> |
527 | | -!! result |
528 | | -<dl><dt><b style="display: inline">bold</b> |
529 | | -</dt></dl> |
530 | | - |
531 | | -!! end |
532 | | - |
533 | | - |
534 | | -!! test |
535 | | -Definition lists: self-closed tag |
536 | | -!! input |
537 | | -;one<br/>two : two-line fun |
538 | | -!! result |
539 | | -<dl><dt>one<br />two </dt><dd> two-line fun |
540 | | -</dd></dl> |
541 | | - |
542 | | -!! end |
543 | | - |
544 | | - |
545 | | -### |
546 | | -### External links |
547 | | -### |
548 | | -!! test |
549 | | -External links: non-bracketed |
550 | | -!! input |
551 | | -Non-bracketed: http://example.com |
552 | | -!! result |
553 | | -<p>Non-bracketed: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> |
554 | | -</p> |
555 | | -!! end |
556 | | - |
557 | | -!! test |
558 | | -External links: numbered |
559 | | -!! input |
560 | | -Numbered: [http://example.com] |
561 | | -Numbered: [http://example.net] |
562 | | -Numbered: [http://example.com] |
563 | | -!! result |
564 | | -<p>Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[1]</a> |
565 | | -Numbered: <a href="http://example.net" class="external autonumber" rel="nofollow">[2]</a> |
566 | | -Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[3]</a> |
567 | | -</p> |
568 | | -!!end |
569 | | - |
570 | | -!! test |
571 | | -External links: specified text |
572 | | -!! input |
573 | | -Specified text: [http://example.com link] |
574 | | -!! result |
575 | | -<p>Specified text: <a href="http://example.com" class="external text" rel="nofollow">link</a> |
576 | | -</p> |
577 | | -!!end |
578 | | - |
579 | | -!! test |
580 | | -External links: trail |
581 | | -!! input |
582 | | -Linktrails should not work for external links: [http://example.com link]s |
583 | | -!! result |
584 | | -<p>Linktrails should not work for external links: <a href="http://example.com" class="external text" rel="nofollow">link</a>s |
585 | | -</p> |
586 | | -!! end |
587 | | - |
588 | | -!! test |
589 | | -External links: dollar sign in URL |
590 | | -!! input |
591 | | -http://example.com/1$2345 |
592 | | -!! result |
593 | | -<p><a href="http://example.com/1$2345" class="external free" rel="nofollow">http://example.com/1$2345</a> |
594 | | -</p> |
595 | | -!! end |
596 | | - |
597 | | -!! test |
598 | | -External links: dollar sign in URL (named) |
599 | | -!! input |
600 | | -[http://example.com/1$2345] |
601 | | -!! result |
602 | | -<p><a href="http://example.com/1$2345" class="external autonumber" rel="nofollow">[1]</a> |
603 | | -</p> |
604 | | -!!end |
605 | | - |
606 | | -!! test |
607 | | -External links: open square bracket forbidden in URL (bug 4377) |
608 | | -!! input |
609 | | -http://example.com/1[2345 |
610 | | -!! result |
611 | | -<p><a href="http://example.com/1" class="external free" rel="nofollow">http://example.com/1</a>[2345 |
612 | | -</p> |
613 | | -!! end |
614 | | - |
615 | | -!! test |
616 | | -External links: open square bracket forbidden in URL (named) (bug 4377) |
617 | | -!! input |
618 | | -[http://example.com/1[2345] |
619 | | -!! result |
620 | | -<p><a href="http://example.com/1" class="external text" rel="nofollow">[2345</a> |
621 | | -</p> |
622 | | -!!end |
623 | | - |
624 | | -!! test |
625 | | -External links: nowiki in URL link text (bug 6230) |
626 | | -!!input |
627 | | -[http://example.com/ <nowiki>''example site''</nowiki>] |
628 | | -!! result |
629 | | -<p><a href="http://example.com/" class="external text" rel="nofollow">''example site''</a> |
630 | | -</p> |
631 | | -!! end |
632 | | - |
633 | | -!! test |
634 | | -External links: newline forbidden in text (bug 6230 regression check) |
635 | | -!! input |
636 | | -[http://example.com/ first |
637 | | -second] |
638 | | -!! result |
639 | | -<p>[<a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> first |
640 | | -second] |
641 | | -</p> |
642 | | -!!end |
643 | | - |
644 | | -!! test |
645 | | -External image |
646 | | -!! input |
647 | | -External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png |
648 | | -!! result |
649 | | -<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /> |
650 | | -</p> |
651 | | -!! end |
652 | | - |
653 | | -!! test |
654 | | -External image from https |
655 | | -!! input |
656 | | -External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png |
657 | | -!! result |
658 | | -<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /> |
659 | | -</p> |
660 | | -!! end |
661 | | - |
662 | | -!! test |
663 | | -Link to non-http image, no img tag |
664 | | -!! input |
665 | | -Link to non-http image, no img tag: ftp://example.com/test.jpg |
666 | | -!! result |
667 | | -<p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" rel="nofollow">ftp://example.com/test.jpg</a> |
668 | | -</p> |
669 | | -!! end |
670 | | - |
671 | | -!! test |
672 | | -External links: terminating separator |
673 | | -!! input |
674 | | -Terminating separator: http://example.com/thing, |
675 | | -!! result |
676 | | -<p>Terminating separator: <a href="http://example.com/thing" class="external free" rel="nofollow">http://example.com/thing</a>, |
677 | | -</p> |
678 | | -!! end |
679 | | - |
680 | | -!! test |
681 | | -External links: intervening separator |
682 | | -!! input |
683 | | -Intervening separator: http://example.com/1,2,3 |
684 | | -!! result |
685 | | -<p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" rel="nofollow">http://example.com/1,2,3</a> |
686 | | -</p> |
687 | | -!! end |
688 | | - |
689 | | -!! test |
690 | | -External links: old bug with URL in query |
691 | | -!! input |
692 | | -Old bug with URL in query: [http://example.com/thing?url=http://example.com link] |
693 | | -!! result |
694 | | -<p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" rel="nofollow">link</a> |
695 | | -</p> |
696 | | -!! end |
697 | | - |
698 | | -!! test |
699 | | -External links: old URL-in-URL bug, mixed protocols |
700 | | -!! input |
701 | | -And again with mixed protocols: [ftp://example.com?url=http://example.com link] |
702 | | -!! result |
703 | | -<p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" rel="nofollow">link</a> |
704 | | -</p> |
705 | | -!!end |
706 | | - |
707 | | -!! test |
708 | | -External links: URL in text |
709 | | -!! input |
710 | | -URL in text: [http://example.com http://example.com] |
711 | | -!! result |
712 | | -<p>URL in text: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> |
713 | | -</p> |
714 | | -!! end |
715 | | - |
716 | | -!! test |
717 | | -External links: Clickable images |
718 | | -!! input |
719 | | -ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] |
720 | | -!! result |
721 | | -<p>ja-style clickable images: <a href="http://example.com" class="external text" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a> |
722 | | -</p> |
723 | | -!!end |
724 | | - |
725 | | -!! test |
726 | | -External links: raw ampersand |
727 | | -!! input |
728 | | -Old & use: http://x&y |
729 | | -!! result |
730 | | -<p>Old & use: <a href="http://x&y" class="external free" rel="nofollow">http://x&y</a> |
731 | | -</p> |
732 | | -!! end |
733 | | - |
734 | | -!! test |
735 | | -External links: encoded ampersand |
736 | | -!! input |
737 | | -Old & use: http://x&y |
738 | | -!! result |
739 | | -<p>Old & use: <a href="http://x&y" class="external free" rel="nofollow">http://x&y</a> |
740 | | -</p> |
741 | | -!! end |
742 | | - |
743 | | -!! test |
744 | | -External links: encoded equals (bug 6102) |
745 | | -!! input |
746 | | -http://example.com/?foo=bar |
747 | | -!! result |
748 | | -<p><a href="http://example.com/?foo=bar" class="external free" rel="nofollow">http://example.com/?foo=bar</a> |
749 | | -</p> |
750 | | -!! end |
751 | | - |
752 | | -!! test |
753 | | -External links: [raw ampersand] |
754 | | -!! input |
755 | | -Old & use: [http://x&y] |
756 | | -!! result |
757 | | -<p>Old & use: <a href="http://x&y" class="external autonumber" rel="nofollow">[1]</a> |
758 | | -</p> |
759 | | -!! end |
760 | | - |
761 | | -!! test |
762 | | -External links: [encoded ampersand] |
763 | | -!! input |
764 | | -Old & use: [http://x&y] |
765 | | -!! result |
766 | | -<p>Old & use: <a href="http://x&y" class="external autonumber" rel="nofollow">[1]</a> |
767 | | -</p> |
768 | | -!! end |
769 | | - |
770 | | -!! test |
771 | | -External links: [encoded equals] (bug 6102) |
772 | | -!! input |
773 | | -[http://example.com/?foo=bar] |
774 | | -!! result |
775 | | -<p><a href="http://example.com/?foo=bar" class="external autonumber" rel="nofollow">[1]</a> |
776 | | -</p> |
777 | | -!! end |
778 | | - |
779 | | -!! test |
780 | | -External links: [IDN ignored character reference in hostname; strip it right off] |
781 | | -!! input |
782 | | -[http://e‌xample.com/] |
783 | | -!! result |
784 | | -<p><a href="http://example.com/" class="external autonumber" rel="nofollow">[1]</a> |
785 | | -</p> |
786 | | -!! end |
787 | | - |
788 | | -!! test |
789 | | -External links: IDN ignored character reference in hostname; strip it right off |
790 | | -!! input |
791 | | -http://e‌xample.com/ |
792 | | -!! result |
793 | | -<p><a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> |
794 | | -</p> |
795 | | -!! end |
796 | | - |
797 | | -!! test |
798 | | -External links: www.jpeg.org (bug 554) |
799 | | -!! input |
800 | | -http://www.jpeg.org |
801 | | -!!result |
802 | | -<p><a href="http://www.jpeg.org" class="external free" rel="nofollow">http://www.jpeg.org</a> |
803 | | -</p> |
804 | | -!! end |
805 | | - |
806 | | -!! test |
807 | | -External links: URL within URL (original bug 2) |
808 | | -!! input |
809 | | -[http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] |
810 | | -!! result |
811 | | -<p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber" rel="nofollow">[1]</a> |
812 | | -</p> |
813 | | -!! end |
814 | | - |
815 | | -!! test |
816 | | -BUG 361: URL inside bracketed URL |
817 | | -!! input |
818 | | -[http://www.example.com/foo http://www.example.com/bar] |
819 | | -!! result |
820 | | -<p><a href="http://www.example.com/foo" class="external text" rel="nofollow">http://www.example.com/bar</a> |
821 | | -</p> |
822 | | -!! end |
823 | | - |
824 | | -!! test |
825 | | -BUG 361: URL within URL, not bracketed |
826 | | -!! input |
827 | | -http://www.example.com/foo?=http://www.example.com/bar |
828 | | -!! result |
829 | | -<p><a href="http://www.example.com/foo?=http://www.example.com/bar" class="external free" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a> |
830 | | -</p> |
831 | | -!! end |
832 | | - |
833 | | -!! test |
834 | | -BUG 289: ">"-token in URL-tail |
835 | | -!! input |
836 | | -http://www.example.com/<hello> |
837 | | -!! result |
838 | | -<p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a><hello> |
839 | | -</p> |
840 | | -!!end |
841 | | - |
842 | | -!! test |
843 | | -BUG 289: literal ">"-token in URL-tail |
844 | | -!! input |
845 | | -http://www.example.com/<b>html</b> |
846 | | -!! result |
847 | | -<p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a><b>html</b> |
848 | | -</p> |
849 | | -!!end |
850 | | - |
851 | | -!! test |
852 | | -BUG 289: ">"-token in bracketed URL |
853 | | -!! input |
854 | | -[http://www.example.com/<hello> stuff] |
855 | | -!! result |
856 | | -<p><a href="http://www.example.com/" class="external text" rel="nofollow"><hello> stuff</a> |
857 | | -</p> |
858 | | -!!end |
859 | | - |
860 | | -!! test |
861 | | -BUG 289: literal ">"-token in bracketed URL |
862 | | -!! input |
863 | | -[http://www.example.com/<b>html</b> stuff] |
864 | | -!! result |
865 | | -<p><a href="http://www.example.com/" class="external text" rel="nofollow"><b>html</b> stuff</a> |
866 | | -</p> |
867 | | -!!end |
868 | | - |
869 | | -!! test |
870 | | -BUG 289: literal double quote at end of URL |
871 | | -!! input |
872 | | -http://www.example.com/"hello" |
873 | | -!! result |
874 | | -<p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a>"hello" |
875 | | -</p> |
876 | | -!!end |
877 | | - |
878 | | -!! test |
879 | | -BUG 289: literal double quote in bracketed URL |
880 | | -!! input |
881 | | -[http://www.example.com/"hello" stuff] |
882 | | -!! result |
883 | | -<p><a href="http://www.example.com/" class="external text" rel="nofollow">"hello" stuff</a> |
884 | | -</p> |
885 | | -!!end |
886 | | - |
887 | | -!! test |
888 | | -External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081) |
889 | | -!! input |
890 | | -[http://www.example.com test] |
891 | | -!! result |
892 | | -<p><a href="http://www.example.com" class="external text" rel="nofollow">test</a> |
893 | | -</p> |
894 | | -!! end |
895 | | - |
896 | | -!! test |
897 | | -External links: wiki links within external link (Bug 3695) |
898 | | -!! input |
899 | | -[http://example.com [[wikilink]] embedded in ext link] |
900 | | -!! result |
901 | | -<p><a href="http://example.com" class="external text" rel="nofollow"></a><a href="https://www.mediawiki.org/index.php?title=Wikilink&action=edit&redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a href="http://example.com" class="external text" rel="nofollow"> embedded in ext link</a> |
902 | | -</p> |
903 | | -!! end |
904 | | - |
905 | | -!! test |
906 | | -BUG 787: Links with one slash after the url protocol are invalid |
907 | | -!! input |
908 | | -http:/example.com |
909 | | - |
910 | | -[http:/example.com title] |
911 | | -!! result |
912 | | -<p>http:/example.com |
913 | | -</p><p>[http:/example.com title] |
914 | | -</p> |
915 | | -!! end |
916 | | - |
917 | | -!! test |
918 | | -Bug 2702: Mismatched <i>, <b> and <a> tags are invalid |
919 | | -!! input |
920 | | -''[http://example.com text''] |
921 | | -[http://example.com '''text]''' |
922 | | -''Something [http://example.com in italic''] |
923 | | -''Something [http://example.com mixed''''', even bold]''' |
924 | | -'''''Now [http://example.com both'''''] |
925 | | -!! result |
926 | | -<p><a href="http://example.com" class="external text" rel="nofollow"><i>text</i></a> |
927 | | -<a href="http://example.com" class="external text" rel="nofollow"><b>text</b></a> |
928 | | -<i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>in italic</i></a> |
929 | | -<i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>mixed</i><b>, even bold</b></a> |
930 | | -<i><b>Now </b></i><a href="http://example.com" class="external text" rel="nofollow"><i><b>both</b></i></a> |
931 | | -</p> |
932 | | -!! end |
933 | | - |
934 | | - |
935 | | -!! test |
936 | | -Bug 4781: %26 in URL |
937 | | -!! input |
938 | | -http://www.example.com/?title=AT%26T |
939 | | -!! result |
940 | | -<p><a href="http://www.example.com/?title=AT%26T" class="external free" rel="nofollow">http://www.example.com/?title=AT%26T</a> |
941 | | -</p> |
942 | | -!! end |
943 | | - |
944 | | -!! test |
945 | | -Bug 4781, 5267: %26 in URL |
946 | | -!! input |
947 | | -http://www.example.com/?title=100%25_Bran |
948 | | -!! result |
949 | | -<p><a href="http://www.example.com/?title=100%25_Bran" class="external free" rel="nofollow">http://www.example.com/?title=100%25_Bran</a> |
950 | | -</p> |
951 | | -!! end |
952 | | - |
953 | | -!! test |
954 | | -Bug 4781, 5267: %28, %29 in URL |
955 | | -!! input |
956 | | -http://www.example.com/?title=Ben-Hur_%281959_film%29 |
957 | | -!! result |
958 | | -<p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a> |
959 | | -</p> |
960 | | -!! end |
961 | | - |
962 | | - |
963 | | -!! test |
964 | | -Bug 4781: %26 in autonumber URL |
965 | | -!! input |
966 | | -[http://www.example.com/?title=AT%26T] |
967 | | -!! result |
968 | | -<p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" rel="nofollow">[1]</a> |
969 | | -</p> |
970 | | -!! end |
971 | | - |
972 | | -!! test |
973 | | -Bug 4781, 5267: %26 in autonumber URL |
974 | | -!! input |
975 | | -[http://www.example.com/?title=100%25_Bran] |
976 | | -!! result |
977 | | -<p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" rel="nofollow">[1]</a> |
978 | | -</p> |
979 | | -!! end |
980 | | - |
981 | | -!! test |
982 | | -Bug 4781, 5267: %28, %29 in autonumber URL |
983 | | -!! input |
984 | | -[http://www.example.com/?title=Ben-Hur_%281959_film%29] |
985 | | -!! result |
986 | | -<p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" rel="nofollow">[1]</a> |
987 | | -</p> |
988 | | -!! end |
989 | | - |
990 | | - |
991 | | -!! test |
992 | | -Bug 4781: %26 in bracketed URL |
993 | | -!! input |
994 | | -[http://www.example.com/?title=AT%26T link] |
995 | | -!! result |
996 | | -<p><a href="http://www.example.com/?title=AT%26T" class="external text" rel="nofollow">link</a> |
997 | | -</p> |
998 | | -!! end |
999 | | - |
1000 | | -!! test |
1001 | | -Bug 4781, 5267: %26 in bracketed URL |
1002 | | -!! input |
1003 | | -[http://www.example.com/?title=100%25_Bran link] |
1004 | | -!! result |
1005 | | -<p><a href="http://www.example.com/?title=100%25_Bran" class="external text" rel="nofollow">link</a> |
1006 | | -</p> |
1007 | | -!! end |
1008 | | - |
1009 | | -!! test |
1010 | | -Bug 4781, 5267: %28, %29 in bracketed URL |
1011 | | -!! input |
1012 | | -[http://www.example.com/?title=Ben-Hur_%281959_film%29 link] |
1013 | | -!! result |
1014 | | -<p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" rel="nofollow">link</a> |
1015 | | -</p> |
1016 | | -!! end |
1017 | | - |
1018 | | -!! test |
1019 | | -External link containing double-single-quotes in text '' (bug 4598 sanity check) |
1020 | | -!! input |
1021 | | -Some [http://example.com/ pretty ''italics'' and stuff]! |
1022 | | -!! result |
1023 | | -<p>Some <a href="http://example.com/" class="external text" rel="nofollow">pretty <i>italics</i> and stuff</a>! |
1024 | | -</p> |
1025 | | -!! end |
1026 | | - |
1027 | | -!! test |
1028 | | -External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check) |
1029 | | -!! input |
1030 | | -''Some [http://example.com/ pretty ''italics'' and stuff]!'' |
1031 | | -!! result |
1032 | | -<p><i>Some </i><a href="http://example.com/" class="external text" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i> |
1033 | | -</p> |
1034 | | -!! end |
1035 | | - |
1036 | | -!! test |
1037 | | -External link containing double-single-quotes with no space separating the url from text in italics |
1038 | | -!! input |
1039 | | -[http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].] |
1040 | | -!! result |
1041 | | -<p><a href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm" class="external text" rel="nofollow"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="https://www.mediawiki.org/index.php?title=Museo_Picasso_(Par%C3%ADs)&action=edit&redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a> |
1042 | | -</p> |
1043 | | -!! end |
1044 | | - |
1045 | | -!! test |
1046 | | -URL-encoding in URL functions (single parameter) |
1047 | | -!! input |
1048 | | -{{localurl:Some page|amp=&}} |
1049 | | -!! result |
1050 | | -<p>/index.php?title=Some_page&amp=& |
1051 | | -</p> |
1052 | | -!! end |
1053 | | - |
1054 | | -!! test |
1055 | | -URL-encoding in URL functions (multiple parameters) |
1056 | | -!! input |
1057 | | -{{localurl:Some page|q=?&=&}} |
1058 | | -!! result |
1059 | | -<p>/index.php?title=Some_page&q=?&amp=& |
1060 | | -</p> |
1061 | | -!! end |
1062 | | - |
1063 | | -### |
1064 | | -### Quotes |
1065 | | -### |
1066 | | - |
1067 | | -!! test |
1068 | | -Quotes |
1069 | | -!! input |
1070 | | -Normal text. '''Bold text.''' Normal text. ''Italic text.'' |
1071 | | - |
1072 | | -Normal text. '''''Bold italic text.''''' Normal text. |
1073 | | -!!result |
1074 | | -<p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i> |
1075 | | -</p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text. |
1076 | | -</p> |
1077 | | -!! end |
1078 | | - |
1079 | | - |
1080 | | -!! test |
1081 | | -Unclosed and unmatched quotes |
1082 | | -!! input |
1083 | | -'''''Bold italic text '''with bold deactivated''' in between.''''' |
1084 | | - |
1085 | | -'''''Bold italic text ''with italic deactivated'' in between.''''' |
1086 | | - |
1087 | | -'''Bold text.. |
1088 | | - |
1089 | | -..spanning two paragraphs (should not work).''' |
1090 | | - |
1091 | | -'''Bold tag left open |
1092 | | - |
1093 | | -''Italic tag left open |
1094 | | - |
1095 | | -Normal text. |
1096 | | - |
1097 | | -<!-- Unmatching number of opening, closing tags: --> |
1098 | | -'''This year''''s election ''should'' beat '''last year''''s. |
1099 | | - |
1100 | | -''Tom'''s car is bigger than ''Susan'''s. |
1101 | | -!! result |
1102 | | -<p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i> |
1103 | | -</p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b> |
1104 | | -</p><p><b>Bold text..</b> |
1105 | | -</p><p>..spanning two paragraphs (should not work). |
1106 | | -</p><p><b>Bold tag left open</b> |
1107 | | -</p><p><i>Italic tag left open</i> |
1108 | | -</p><p>Normal text. |
1109 | | -</p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s. |
1110 | | -</p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s. |
1111 | | -</p> |
1112 | | -!! end |
1113 | | - |
1114 | | -### |
1115 | | -### Tables |
1116 | | -### |
1117 | | -### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables |
1118 | | -### |
1119 | | - |
1120 | | -# This should not produce <table></table> as <table><tr><td></td></tr></table> |
1121 | | -# is the bare minimun required by the spec, see: |
1122 | | -# http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables |
1123 | | -!! test |
1124 | | -A table with no data. |
1125 | | -!! input |
1126 | | -{||} |
1127 | | -!! result |
1128 | | -!! end |
1129 | | - |
1130 | | -# A table with nothing but a caption is invalid XHTML, we might want to render |
1131 | | -# this as <p>caption</p> |
1132 | | -!! test |
1133 | | -A table with nothing but a caption |
1134 | | -!! input |
1135 | | -{| |
1136 | | -|+ caption |
1137 | | -|} |
1138 | | -!! result |
1139 | | -<table> |
1140 | | -<caption> caption |
1141 | | -</caption><tr><td></td></tr></table> |
1142 | | - |
1143 | | -!! end |
1144 | | - |
1145 | | -!! test |
1146 | | -Simple table |
1147 | | -!! input |
1148 | | -{| |
1149 | | -| 1 || 2 |
1150 | | -|- |
1151 | | -| 3 || 4 |
1152 | | -|} |
1153 | | -!! result |
1154 | | -<table> |
1155 | | -<tr> |
1156 | | -<td> 1 </td> |
1157 | | -<td> 2 |
1158 | | -</td></tr> |
1159 | | -<tr> |
1160 | | -<td> 3 </td> |
1161 | | -<td> 4 |
1162 | | -</td></tr></table> |
1163 | | - |
1164 | | -!! end |
1165 | | - |
1166 | | -!! test |
1167 | | -Multiplication table |
1168 | | -!! input |
1169 | | -{| border="1" cellpadding="2" |
1170 | | -|+Multiplication table |
1171 | | -|- |
1172 | | -! × !! 1 !! 2 !! 3 |
1173 | | -|- |
1174 | | -! 1 |
1175 | | -| 1 || 2 || 3 |
1176 | | -|- |
1177 | | -! 2 |
1178 | | -| 2 || 4 || 6 |
1179 | | -|- |
1180 | | -! 3 |
1181 | | -| 3 || 6 || 9 |
1182 | | -|- |
1183 | | -! 4 |
1184 | | -| 4 || 8 || 12 |
1185 | | -|- |
1186 | | -! 5 |
1187 | | -| 5 || 10 || 15 |
1188 | | -|} |
1189 | | -!! result |
1190 | | -<table border="1" cellpadding="2"> |
1191 | | -<caption>Multiplication table |
1192 | | -</caption> |
1193 | | -<tr> |
1194 | | -<th> × </th> |
1195 | | -<th> 1 </th> |
1196 | | -<th> 2 </th> |
1197 | | -<th> 3 |
1198 | | -</th></tr> |
1199 | | -<tr> |
1200 | | -<th> 1 |
1201 | | -</th> |
1202 | | -<td> 1 </td> |
1203 | | -<td> 2 </td> |
1204 | | -<td> 3 |
1205 | | -</td></tr> |
1206 | | -<tr> |
1207 | | -<th> 2 |
1208 | | -</th> |
1209 | | -<td> 2 </td> |
1210 | | -<td> 4 </td> |
1211 | | -<td> 6 |
1212 | | -</td></tr> |
1213 | | -<tr> |
1214 | | -<th> 3 |
1215 | | -</th> |
1216 | | -<td> 3 </td> |
1217 | | -<td> 6 </td> |
1218 | | -<td> 9 |
1219 | | -</td></tr> |
1220 | | -<tr> |
1221 | | -<th> 4 |
1222 | | -</th> |
1223 | | -<td> 4 </td> |
1224 | | -<td> 8 </td> |
1225 | | -<td> 12 |
1226 | | -</td></tr> |
1227 | | -<tr> |
1228 | | -<th> 5 |
1229 | | -</th> |
1230 | | -<td> 5 </td> |
1231 | | -<td> 10 </td> |
1232 | | -<td> 15 |
1233 | | -</td></tr></table> |
1234 | | - |
1235 | | -!! end |
1236 | | - |
1237 | | -!! test |
1238 | | -Table rowspan |
1239 | | -!! input |
1240 | | -{| align=right border=1 |
1241 | | -| Cell 1, row 1 |
1242 | | -|rowspan=2| Cell 2, row 1 (and 2) |
1243 | | -| Cell 3, row 1 |
1244 | | -|- |
1245 | | -| Cell 1, row 2 |
1246 | | -| Cell 3, row 2 |
1247 | | -|} |
1248 | | -!! result |
1249 | | -<table align="right" border="1"> |
1250 | | -<tr> |
1251 | | -<td> Cell 1, row 1 |
1252 | | -</td> |
1253 | | -<td rowspan="2"> Cell 2, row 1 (and 2) |
1254 | | -</td> |
1255 | | -<td> Cell 3, row 1 |
1256 | | -</td></tr> |
1257 | | -<tr> |
1258 | | -<td> Cell 1, row 2 |
1259 | | -</td> |
1260 | | -<td> Cell 3, row 2 |
1261 | | -</td></tr></table> |
1262 | | - |
1263 | | -!! end |
1264 | | - |
1265 | | -!! test |
1266 | | -Nested table |
1267 | | -!! input |
1268 | | -{| border=1 |
1269 | | -| α |
1270 | | -| |
1271 | | -{| bgcolor=#ABCDEF border=2 |
1272 | | -|nested |
1273 | | -|- |
1274 | | -|table |
1275 | | -|} |
1276 | | -|the original table again |
1277 | | -|} |
1278 | | -!! result |
1279 | | -<table border="1"> |
1280 | | -<tr> |
1281 | | -<td> α |
1282 | | -</td> |
1283 | | -<td> |
1284 | | -<table bgcolor="#ABCDEF" border="2"> |
1285 | | -<tr> |
1286 | | -<td>nested |
1287 | | -</td></tr> |
1288 | | -<tr> |
1289 | | -<td>table |
1290 | | -</td></tr></table> |
1291 | | -</td> |
1292 | | -<td>the original table again |
1293 | | -</td></tr></table> |
1294 | | - |
1295 | | -!! end |
1296 | | - |
1297 | | -!! test |
1298 | | -Invalid attributes in table cell (bug 1830) |
1299 | | -!! input |
1300 | | -{| |
1301 | | -|Cell:|broken |
1302 | | -|} |
1303 | | -!! result |
1304 | | -<table> |
1305 | | -<tr> |
1306 | | -<td>broken |
1307 | | -</td></tr></table> |
1308 | | - |
1309 | | -!! end |
1310 | | - |
1311 | | - |
1312 | | -!! test |
1313 | | -Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html) |
1314 | | -!! input |
1315 | | -{| |
1316 | | -| |[ftp://|x||]" onmouseover="alert(document.cookie)">test |
1317 | | -!! result |
1318 | | -<table> |
1319 | | -<tr> |
1320 | | -<td>[<a href="ftp://%7Cx" class="external free" rel="nofollow">ftp://%7Cx</a></td> |
1321 | | -<td>]" onmouseover="alert(document.cookie)">test |
1322 | | -</td> |
1323 | | -</tr> |
1324 | | -</table> |
1325 | | - |
1326 | | -!! end |
1327 | | - |
1328 | | - |
1329 | | -### |
1330 | | -### Internal links |
1331 | | -### |
1332 | | -!! test |
1333 | | -Plain link, capitalized |
1334 | | -!! input |
1335 | | -[[Main Page]] |
1336 | | -!! result |
1337 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
1338 | | -</p> |
1339 | | -!! end |
1340 | | - |
1341 | | -!! test |
1342 | | -Plain link, uncapitalized |
1343 | | -!! input |
1344 | | -[[main Page]] |
1345 | | -!! result |
1346 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a> |
1347 | | -</p> |
1348 | | -!! end |
1349 | | - |
1350 | | -!! test |
1351 | | -Piped link |
1352 | | -!! input |
1353 | | -[[Main Page|The Main Page]] |
1354 | | -!! result |
1355 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">The Main Page</a> |
1356 | | -</p> |
1357 | | -!! end |
1358 | | - |
1359 | | -!! test |
1360 | | -Broken link |
1361 | | -!! input |
1362 | | -[[Zigzagzogzagzig]] |
1363 | | -!! result |
1364 | | -<p><a href="https://www.mediawiki.org/index.php?title=Zigzagzogzagzig&action=edit&redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a> |
1365 | | -</p> |
1366 | | -!! end |
1367 | | - |
1368 | | -!! test |
1369 | | -Broken link with fragment |
1370 | | -!! input |
1371 | | -[[Zigzagzogzagzig#zug]] |
1372 | | -!! result |
1373 | | -<p><a href="https://www.mediawiki.org/index.php?title=Zigzagzogzagzig&action=edit&redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a> |
1374 | | -</p> |
1375 | | -!! end |
1376 | | - |
1377 | | -!! test |
1378 | | -Special page link with fragment |
1379 | | -!! input |
1380 | | -[[Special:Version#anchor]] |
1381 | | -!! result |
1382 | | -<p><a href="https://www.mediawiki.org/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a> |
1383 | | -</p> |
1384 | | -!! end |
1385 | | - |
1386 | | -!! test |
1387 | | -Nonexistent special page link with fragment |
1388 | | -!! input |
1389 | | -[[Special:ThisNameWillHopefullyNeverBeUsed#anchor]] |
1390 | | -!! result |
1391 | | -<p><a href="https://www.mediawiki.org/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a> |
1392 | | -</p> |
1393 | | -!! end |
1394 | | - |
1395 | | -!! test |
1396 | | -Link with prefix |
1397 | | -!! input |
1398 | | -xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]] |
1399 | | -!! result |
1400 | | -<p>xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
1401 | | -</p> |
1402 | | -!! end |
1403 | | - |
1404 | | -!! test |
1405 | | -Link with suffix |
1406 | | -!! input |
1407 | | -[[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!! |
1408 | | -!! result |
1409 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>!!! |
1410 | | -</p> |
1411 | | -!! end |
1412 | | - |
1413 | | -!! test |
1414 | | -Link with 3 brackets |
1415 | | -!! input |
1416 | | -[[[main page]]] |
1417 | | -!! result |
1418 | | -<p>[[[main page]]] |
1419 | | -</p> |
1420 | | -!! end |
1421 | | - |
1422 | | -!! test |
1423 | | -Piped link with 3 brackets |
1424 | | -!! input |
1425 | | -[[[main page|the main page]]] |
1426 | | -!! result |
1427 | | -<p>[[[main page|the main page]]] |
1428 | | -</p> |
1429 | | -!! end |
1430 | | - |
1431 | | -!! test |
1432 | | -Link with multiple pipes |
1433 | | -!! input |
1434 | | -[[Main Page|The|Main|Page]] |
1435 | | -!! result |
1436 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">The|Main|Page</a> |
1437 | | -</p> |
1438 | | -!! end |
1439 | | - |
1440 | | -!! test |
1441 | | -Link to namespaces |
1442 | | -!! input |
1443 | | -[[Talk:Parser testing]], [[Meta:Disclaimers]] |
1444 | | -!! result |
1445 | | -<p><a href="https://www.mediawiki.org/index.php?title=Talk:Parser_testing&action=edit&redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="https://www.mediawiki.org/index.php?title=Meta:Disclaimers&action=edit&redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a> |
1446 | | -</p> |
1447 | | -!! end |
1448 | | - |
1449 | | -!! test |
1450 | | -Piped link to namespace |
1451 | | -!! input |
1452 | | -[[Meta:Disclaimers|The disclaimers]] |
1453 | | -!! result |
1454 | | -<p><a href="https://www.mediawiki.org/index.php?title=Meta:Disclaimers&action=edit&redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a> |
1455 | | -</p> |
1456 | | -!! end |
1457 | | - |
1458 | | -!! test |
1459 | | -Link containing } |
1460 | | -!! input |
1461 | | -[[Usually caused by a typo (oops}]] |
1462 | | -!! result |
1463 | | -<p>[[Usually caused by a typo (oops}]] |
1464 | | -</p> |
1465 | | -!! end |
1466 | | - |
1467 | | -!! test |
1468 | | -Link containing % (not as a hex sequence) |
1469 | | -!! input |
1470 | | -[[7% Solution]] |
1471 | | -!! result |
1472 | | -<p><a href="https://www.mediawiki.org/index.php?title=7%25_Solution&action=edit&redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a> |
1473 | | -</p> |
1474 | | -!! end |
1475 | | - |
1476 | | -!! test |
1477 | | -Link containing % as a single hex sequence interpreted to char |
1478 | | -!! input |
1479 | | -[[7%25 Solution]] |
1480 | | -!! result |
1481 | | -<p><a href="https://www.mediawiki.org/index.php?title=7%25_Solution&action=edit&redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a> |
1482 | | -</p> |
1483 | | -!!end |
1484 | | - |
1485 | | -!! test |
1486 | | -Link containing % as a double hex sequence interpreted to hex sequence |
1487 | | -!! input |
1488 | | -[[7%2525 Solution]] |
1489 | | -!! result |
1490 | | -<p>[[7%2525 Solution]] |
1491 | | -</p> |
1492 | | -!!end |
1493 | | - |
1494 | | -!! test |
1495 | | -Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors |
1496 | | -Example for such a section: == < == |
1497 | | -!! input |
1498 | | -[[%23%3c]][[%23%3e]] |
1499 | | -!! result |
1500 | | -<p><a href="#.3C">#<</a><a href="#.3E">#></a> |
1501 | | -</p> |
1502 | | -!! end |
1503 | | - |
1504 | | -!! test |
1505 | | -Link containing "<#" and ">#" as a hex sequences |
1506 | | -!! input |
1507 | | -[[%3c%23]][[%3e%23]] |
1508 | | -!! result |
1509 | | -<p>[[%3c%23]][[%3e%23]] |
1510 | | -</p> |
1511 | | -!! end |
1512 | | - |
1513 | | -!! test |
1514 | | -Link containing double-single-quotes '' (bug 4598) |
1515 | | -!! input |
1516 | | -[[Lista d''e paise d''o munno]] |
1517 | | -!! result |
1518 | | -<p><a href="https://www.mediawiki.org/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&action=edit&redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a> |
1519 | | -</p> |
1520 | | -!! end |
1521 | | - |
1522 | | -!! test |
1523 | | -Link containing double-single-quotes '' in text (bug 4598 sanity check) |
1524 | | -!! input |
1525 | | -Some [[Link|pretty ''italics'' and stuff]]! |
1526 | | -!! result |
1527 | | -<p>Some <a href="https://www.mediawiki.org/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>! |
1528 | | -</p> |
1529 | | -!! end |
1530 | | - |
1531 | | -!! test |
1532 | | -Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check) |
1533 | | -!! input |
1534 | | -''Some [[Link|pretty ''italics'' and stuff]]! |
1535 | | -!! result |
1536 | | -<p><i>Some <a href="https://www.mediawiki.org/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i> |
1537 | | -</p> |
1538 | | -!! end |
1539 | | - |
1540 | | -!! test |
1541 | | -Link with double quotes in title part (literal) and alternate part (interpreted) |
1542 | | -!! input |
1543 | | -[[File:Denys Savchenko ''Pentecoste''.jpg]] |
1544 | | - |
1545 | | -[[''Pentecoste'']] |
1546 | | - |
1547 | | -[[''Pentecoste''|Pentecoste]] |
1548 | | - |
1549 | | -[[''Pentecoste''|''Pentecoste'']] |
1550 | | -!! result |
1551 | | -<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko ''Pentecoste''.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a> |
1552 | | -</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a> |
1553 | | -</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a> |
1554 | | -</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a> |
1555 | | -</p> |
1556 | | -!! end |
1557 | | - |
1558 | | -!! test |
1559 | | -Plain link to URL |
1560 | | -!! input |
1561 | | -[[http://www.example.com]] |
1562 | | -!! result |
1563 | | -<p>[<a href="http://www.example.com" class="external autonumber" rel="nofollow">[1]</a>] |
1564 | | -</p> |
1565 | | -!! end |
1566 | | - |
1567 | | -# I'm fairly sure the expected result here is wrong. |
1568 | | -# We want these to be URL links, not pseudo-pages with URLs for titles.... |
1569 | | -# However the current output is also pretty screwy. |
1570 | | -# |
1571 | | -# ---- |
1572 | | -# I'm changing it to match the current output--it arguably makes more |
1573 | | -# sense in the light of the test above. Old expected result was: |
1574 | | -#<p>Piped link to URL: <a href="https://www.mediawiki.org/index.php?title=Http://www.example.com&action=edit" class="new">an example URL</a> |
1575 | | -#</p> |
1576 | | -# But I think this test is bordering on "garbage in, garbage out" anyway. |
1577 | | -# -- wtm |
1578 | | -!! test |
1579 | | -Piped link to URL |
1580 | | -!! input |
1581 | | -Piped link to URL: [[http://www.example.com|an example URL]] |
1582 | | -!! result |
1583 | | -<p>Piped link to URL: [<a href="http://www.example.com%7Can" class="external text" rel="nofollow">example URL</a>] |
1584 | | -</p> |
1585 | | -!! end |
1586 | | - |
1587 | | -!! test |
1588 | | -BUG 2: [[page|http://url/]] should link to page, not http://url/ |
1589 | | -!! input |
1590 | | -[[Main Page|http://url/]] |
1591 | | -!! result |
1592 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">http://url/</a> |
1593 | | -</p> |
1594 | | -!! end |
1595 | | - |
1596 | | -!! test |
1597 | | -BUG 337: Escaped self-links should be bold |
1598 | | -!! options |
1599 | | -title=[[Bug462]] |
1600 | | -!! input |
1601 | | -[[Bug462]] [[Bug462]] |
1602 | | -!! result |
1603 | | -<p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong> |
1604 | | -</p> |
1605 | | -!! end |
1606 | | - |
1607 | | -!! test |
1608 | | -Self-link to section should not be bold |
1609 | | -!! options |
1610 | | -title=[[Main Page]] |
1611 | | -!! input |
1612 | | -[[Main Page#section]] |
1613 | | -!! result |
1614 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page#section" title="Main Page">Main Page#section</a> |
1615 | | -</p> |
1616 | | -!! end |
1617 | | - |
1618 | | -!! article |
1619 | | -00 |
1620 | | -!! text |
1621 | | -This is 00. |
1622 | | -!! endarticle |
1623 | | - |
1624 | | -!!test |
1625 | | -Self-link to numeric title |
1626 | | -!!options |
1627 | | -title=[[0]] |
1628 | | -!!input |
1629 | | -[[0]] |
1630 | | -!!result |
1631 | | -<p><strong class="selflink">0</strong> |
1632 | | -</p> |
1633 | | -!!end |
1634 | | - |
1635 | | -!!test |
1636 | | -Link to numeric-equivalent title |
1637 | | -!!options |
1638 | | -title=[[0]] |
1639 | | -!!input |
1640 | | -[[00]] |
1641 | | -!!result |
1642 | | -<p><a href="https://www.mediawiki.org/wiki/00" title="00">00</a> |
1643 | | -</p> |
1644 | | -!!end |
1645 | | - |
1646 | | -!! test |
1647 | | -<nowiki> inside a link |
1648 | | -!! input |
1649 | | -[[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]] |
1650 | | -!! result |
1651 | | -<p>[[Main Page]] <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a> |
1652 | | -</p> |
1653 | | -!! end |
1654 | | - |
1655 | | -!! test |
1656 | | -Non-breaking spaces in title |
1657 | | -!! input |
1658 | | -[[ Main Page ]] |
1659 | | -!! result |
1660 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page"> Main Page </a> |
1661 | | -</p> |
1662 | | -!!end |
1663 | | - |
1664 | | - |
1665 | | -### |
1666 | | -### Interwiki links (see maintenance/interwiki.sql) |
1667 | | -### |
1668 | | - |
1669 | | -!! test |
1670 | | -Inline interwiki link |
1671 | | -!! input |
1672 | | -[[MeatBall:SoftSecurity]] |
1673 | | -!! result |
1674 | | -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a> |
1675 | | -</p> |
1676 | | -!! end |
1677 | | - |
1678 | | -!! test |
1679 | | -Inline interwiki link with empty title (bug 2372) |
1680 | | -!! input |
1681 | | -[[MeatBall:]] |
1682 | | -!! result |
1683 | | -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a> |
1684 | | -</p> |
1685 | | -!! end |
1686 | | - |
1687 | | -!! test |
1688 | | -Interwiki link encoding conversion (bug 1636) |
1689 | | -!! input |
1690 | | -*[[Wikipedia:ro:Olteniţa]] |
1691 | | -*[[Wikipedia:ro:Olteniţa]] |
1692 | | -!! result |
1693 | | -<ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a> |
1694 | | -</li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a> |
1695 | | -</li></ul> |
1696 | | - |
1697 | | -!! end |
1698 | | - |
1699 | | -!! test |
1700 | | -Interwiki link with fragment (bug 2130) |
1701 | | -!! input |
1702 | | -[[MeatBall:SoftSecurity#foo]] |
1703 | | -!! result |
1704 | | -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a> |
1705 | | -</p> |
1706 | | -!! end |
1707 | | - |
1708 | | -!! test |
1709 | | -Interlanguage link |
1710 | | -!! input |
1711 | | -Blah blah blah |
1712 | | -[[zh:Chinese]] |
1713 | | -!!result |
1714 | | -<p>Blah blah blah |
1715 | | -</p> |
1716 | | -!! end |
1717 | | - |
1718 | | -!! test |
1719 | | -Double interlanguage link |
1720 | | -!! input |
1721 | | -Blah blah blah |
1722 | | -[[es:Spanish]] |
1723 | | -[[zh:Chinese]] |
1724 | | -!!result |
1725 | | -<p>Blah blah blah |
1726 | | -</p> |
1727 | | -!! end |
1728 | | - |
1729 | | -!! test |
1730 | | -Interlanguage link, with prefix links |
1731 | | -!! options |
1732 | | -language=ln |
1733 | | -!! input |
1734 | | -Blah blah blah |
1735 | | -[[zh:Chinese]] |
1736 | | -!!result |
1737 | | -<p>Blah blah blah |
1738 | | -</p> |
1739 | | -!! end |
1740 | | - |
1741 | | -!! test |
1742 | | -Double interlanguage link, with prefix links (bug 8897) |
1743 | | -!! options |
1744 | | -language=ln |
1745 | | -!! input |
1746 | | -Blah blah blah |
1747 | | -[[es:Spanish]] |
1748 | | -[[zh:Chinese]] |
1749 | | -!!result |
1750 | | -<p>Blah blah blah |
1751 | | -</p> |
1752 | | -!! end |
1753 | | - |
1754 | | - |
1755 | | -## |
1756 | | -## XHTML tidiness |
1757 | | -### |
1758 | | - |
1759 | | -!! test |
1760 | | -<br> to <br /> |
1761 | | -!! input |
1762 | | -1<br>2<br />3 |
1763 | | -!! result |
1764 | | -<p>1<br />2<br />3 |
1765 | | -</p> |
1766 | | -!! end |
1767 | | - |
1768 | | -!! test |
1769 | | -Incorrecly removing closing slashes from correctly formed XHTML |
1770 | | -!! input |
1771 | | -<br style="clear:both;" /> |
1772 | | -!! result |
1773 | | -<p><br style="clear:both;" /> |
1774 | | -</p> |
1775 | | -!! end |
1776 | | - |
1777 | | -!! test |
1778 | | -Failing to transform badly formed HTML into correct XHTML |
1779 | | -!! input |
1780 | | -<br clear=left> |
1781 | | -<br clear=right> |
1782 | | -<br clear=all> |
1783 | | -!! result |
1784 | | -<p><br clear="left" /> |
1785 | | -<br clear="right" /> |
1786 | | -<br clear="all" /> |
1787 | | -</p> |
1788 | | -!!end |
1789 | | - |
1790 | | -!! test |
1791 | | -Horizontal ruler (should it add that extra space?) |
1792 | | -!! input |
1793 | | -<hr> |
1794 | | -<hr > |
1795 | | -foo <hr |
1796 | | -> bar |
1797 | | -!! result |
1798 | | -<hr /> |
1799 | | -<hr /> |
1800 | | -foo <hr /> bar |
1801 | | - |
1802 | | -!! end |
1803 | | - |
1804 | | -### |
1805 | | -### Block-level elements |
1806 | | -### |
1807 | | -!! test |
1808 | | -Common list |
1809 | | -!! input |
1810 | | -*Common list |
1811 | | -* item 2 |
1812 | | -*item 3 |
1813 | | -!! result |
1814 | | -<ul><li>Common list |
1815 | | -</li><li> item 2 |
1816 | | -</li><li>item 3 |
1817 | | -</li></ul> |
1818 | | - |
1819 | | -!! end |
1820 | | - |
1821 | | -!! test |
1822 | | -Numbered list |
1823 | | -!! input |
1824 | | -#Numbered list |
1825 | | -#item 2 |
1826 | | -# item 3 |
1827 | | -!! result |
1828 | | -<ol><li>Numbered list |
1829 | | -</li><li>item 2 |
1830 | | -</li><li> item 3 |
1831 | | -</li></ol> |
1832 | | - |
1833 | | -!! end |
1834 | | - |
1835 | | -!! test |
1836 | | -Mixed list |
1837 | | -!! input |
1838 | | -*Mixed list |
1839 | | -*# with numbers |
1840 | | -** and bullets |
1841 | | -*# and numbers |
1842 | | -*bullets again |
1843 | | -**bullet level 2 |
1844 | | -***bullet level 3 |
1845 | | -***#Number on level 4 |
1846 | | -**bullet level 2 |
1847 | | -**#Number on level 3 |
1848 | | -**#Number on level 3 |
1849 | | -*#number level 2 |
1850 | | -*Level 1 |
1851 | | -!! result |
1852 | | -<ul><li>Mixed list |
1853 | | -<ol><li> with numbers |
1854 | | -</li></ol> |
1855 | | -<ul><li> and bullets |
1856 | | -</li></ul> |
1857 | | -<ol><li> and numbers |
1858 | | -</li></ol> |
1859 | | -</li><li>bullets again |
1860 | | -<ul><li>bullet level 2 |
1861 | | -<ul><li>bullet level 3 |
1862 | | -<ol><li>Number on level 4 |
1863 | | -</li></ol> |
1864 | | -</li></ul> |
1865 | | -</li><li>bullet level 2 |
1866 | | -<ol><li>Number on level 3 |
1867 | | -</li><li>Number on level 3 |
1868 | | -</li></ol> |
1869 | | -</li></ul> |
1870 | | -<ol><li>number level 2 |
1871 | | -</li></ol> |
1872 | | -</li><li>Level 1 |
1873 | | -</li></ul> |
1874 | | - |
1875 | | -!! end |
1876 | | - |
1877 | | -!! test |
1878 | | -List items are not parsed correctly following a <pre> block (bug 785) |
1879 | | -!! input |
1880 | | -* <pre>foo</pre> |
1881 | | -* <pre>bar</pre> |
1882 | | -* zar |
1883 | | -!! result |
1884 | | -<ul><li> <pre>foo</pre> |
1885 | | -</li><li> <pre>bar</pre> |
1886 | | -</li><li> zar |
1887 | | -</li></ul> |
1888 | | - |
1889 | | -!! end |
1890 | | - |
1891 | | -### |
1892 | | -### Magic Words |
1893 | | -### |
1894 | | - |
1895 | | -!! test |
1896 | | -Magic Word: {{CURRENTDAY}} |
1897 | | -!! input |
1898 | | -{{CURRENTDAY}} |
1899 | | -!! result |
1900 | | -<p>1 |
1901 | | -</p> |
1902 | | -!! end |
1903 | | - |
1904 | | -!! test |
1905 | | -Magic Word: {{CURRENTDAY2}} |
1906 | | -!! input |
1907 | | -{{CURRENTDAY2}} |
1908 | | -!! result |
1909 | | -<p>01 |
1910 | | -</p> |
1911 | | -!! end |
1912 | | - |
1913 | | -!! test |
1914 | | -Magic Word: {{CURRENTDAYNAME}} |
1915 | | -!! input |
1916 | | -{{CURRENTDAYNAME}} |
1917 | | -!! result |
1918 | | -<p>Thursday |
1919 | | -</p> |
1920 | | -!! end |
1921 | | - |
1922 | | -!! test |
1923 | | -Magic Word: {{CURRENTDOW}} |
1924 | | -!! input |
1925 | | -{{CURRENTDOW}} |
1926 | | -!! result |
1927 | | -<p>4 |
1928 | | -</p> |
1929 | | -!! end |
1930 | | - |
1931 | | -!! test |
1932 | | -Magic Word: {{CURRENTMONTH}} |
1933 | | -!! input |
1934 | | -{{CURRENTMONTH}} |
1935 | | -!! result |
1936 | | -<p>01 |
1937 | | -</p> |
1938 | | -!! end |
1939 | | - |
1940 | | -!! test |
1941 | | -Magic Word: {{CURRENTMONTHABBREV}} |
1942 | | -!! input |
1943 | | -{{CURRENTMONTHABBREV}} |
1944 | | -!! result |
1945 | | -<p>Jan |
1946 | | -</p> |
1947 | | -!! end |
1948 | | - |
1949 | | -!! test |
1950 | | -Magic Word: {{CURRENTMONTHNAME}} |
1951 | | -!! input |
1952 | | -{{CURRENTMONTHNAME}} |
1953 | | -!! result |
1954 | | -<p>January |
1955 | | -</p> |
1956 | | -!! end |
1957 | | - |
1958 | | -!! test |
1959 | | -Magic Word: {{CURRENTMONTHNAMEGEN}} |
1960 | | -!! input |
1961 | | -{{CURRENTMONTHNAMEGEN}} |
1962 | | -!! result |
1963 | | -<p>January |
1964 | | -</p> |
1965 | | -!! end |
1966 | | - |
1967 | | -!! test |
1968 | | -Magic Word: {{CURRENTTIME}} |
1969 | | -!! input |
1970 | | -{{CURRENTTIME}} |
1971 | | -!! result |
1972 | | -<p>00:02 |
1973 | | -</p> |
1974 | | -!! end |
1975 | | - |
1976 | | -!! test |
1977 | | -Magic Word: {{CURRENTWEEK}} (@bug 4594) |
1978 | | -!! input |
1979 | | -{{CURRENTWEEK}} |
1980 | | -!! result |
1981 | | -<p>1 |
1982 | | -</p> |
1983 | | -!! end |
1984 | | - |
1985 | | -!! test |
1986 | | -Magic Word: {{CURRENTYEAR}} |
1987 | | -!! input |
1988 | | -{{CURRENTYEAR}} |
1989 | | -!! result |
1990 | | -<p>1970 |
1991 | | -</p> |
1992 | | -!! end |
1993 | | - |
1994 | | -!! test |
1995 | | -Magic Word: {{FULLPAGENAME}} |
1996 | | -!! options |
1997 | | -title=[[User:Ævar Arnfjörð Bjarmason]] |
1998 | | -!! input |
1999 | | -{{FULLPAGENAME}} |
2000 | | -!! result |
2001 | | -<p>User:Ævar Arnfjörð Bjarmason |
2002 | | -</p> |
2003 | | -!! end |
2004 | | - |
2005 | | -!! test |
2006 | | -Magic Word: {{FULLPAGENAMEE}} |
2007 | | -!! options |
2008 | | -title=[[User:Ævar Arnfjörð Bjarmason]] |
2009 | | -!! input |
2010 | | -{{FULLPAGENAMEE}} |
2011 | | -!! result |
2012 | | -<p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason |
2013 | | -</p> |
2014 | | -!! end |
2015 | | - |
2016 | | -!! test |
2017 | | -Magic Word: {{NAMESPACE}} |
2018 | | -!! options |
2019 | | -title=[[User:Ævar Arnfjörð Bjarmason]] |
2020 | | -!! input |
2021 | | -{{NAMESPACE}} |
2022 | | -!! result |
2023 | | -<p>User |
2024 | | -</p> |
2025 | | -!! end |
2026 | | - |
2027 | | -!! test |
2028 | | -Magic Word: {{NAMESPACEE}} |
2029 | | -!! options |
2030 | | -title=[[User:Ævar Arnfjörð Bjarmason]] |
2031 | | -!! input |
2032 | | -{{NAMESPACEE}} |
2033 | | -!! result |
2034 | | -<p>User |
2035 | | -</p> |
2036 | | -!! end |
2037 | | - |
2038 | | -!! test |
2039 | | -Magic Word: {{NUMBEROFFILES}} |
2040 | | -!! input |
2041 | | -{{NUMBEROFFILES}} |
2042 | | -!! result |
2043 | | -<p>2 |
2044 | | -</p> |
2045 | | -!! end |
2046 | | - |
2047 | | -!! test |
2048 | | -Magic Word: {{PAGENAME}} |
2049 | | -!! options |
2050 | | -title=[[User:Ævar Arnfjörð Bjarmason]] |
2051 | | -!! input |
2052 | | -{{PAGENAME}} |
2053 | | -!! result |
2054 | | -<p>Ævar Arnfjörð Bjarmason |
2055 | | -</p> |
2056 | | -!! end |
2057 | | - |
2058 | | -!! test |
2059 | | -Magic Word: {{PAGENAMEE}} |
2060 | | -!! options |
2061 | | -title=[[User:Ævar Arnfjörð Bjarmason]] |
2062 | | -!! input |
2063 | | -{{PAGENAMEE}} |
2064 | | -!! result |
2065 | | -<p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason |
2066 | | -</p> |
2067 | | -!! end |
2068 | | - |
2069 | | -!! test |
2070 | | -Magic Word: {{REVISIONID}} |
2071 | | -!! input |
2072 | | -{{REVISIONID}} |
2073 | | -!! result |
2074 | | -<p>1337 |
2075 | | -</p> |
2076 | | -!! end |
2077 | | - |
2078 | | -!! test |
2079 | | -Magic Word: {{SCRIPTPATH}} |
2080 | | -!! input |
2081 | | -{{SCRIPTPATH}} |
2082 | | -!! result |
2083 | | -<p>/ |
2084 | | -</p> |
2085 | | -!! end |
2086 | | - |
2087 | | -!! test |
2088 | | -Magic Word: {{SERVER}} |
2089 | | -!! input |
2090 | | -{{SERVER}} |
2091 | | -!! result |
2092 | | -<p><a href="http://localhost" class="external free" rel="nofollow">http://localhost</a> |
2093 | | -</p> |
2094 | | -!! end |
2095 | | - |
2096 | | -!! test |
2097 | | -Magic Word: {{SERVERNAME}} |
2098 | | -!! input |
2099 | | -{{SERVERNAME}} |
2100 | | -!! result |
2101 | | -<p>Britney-Spears |
2102 | | -</p> |
2103 | | -!! end |
2104 | | - |
2105 | | -!! test |
2106 | | -Magic Word: {{SITENAME}} |
2107 | | -!! input |
2108 | | -{{SITENAME}} |
2109 | | -!! result |
2110 | | -<p>MediaWiki |
2111 | | -</p> |
2112 | | -!! end |
2113 | | - |
2114 | | -!! test |
2115 | | -Namespace 1 {{ns:1}} |
2116 | | -!! input |
2117 | | -{{ns:1}} |
2118 | | -!! result |
2119 | | -<p>Talk |
2120 | | -</p> |
2121 | | -!! end |
2122 | | - |
2123 | | -!! test |
2124 | | -Namespace 1 {{ns:01}} |
2125 | | -!! input |
2126 | | -{{ns:01}} |
2127 | | -!! result |
2128 | | -<p>Talk |
2129 | | -</p> |
2130 | | -!! end |
2131 | | - |
2132 | | -!! test |
2133 | | -Namespace 0 {{ns:0}} (bug 4783) |
2134 | | -!! input |
2135 | | -{{ns:0}} |
2136 | | -!! result |
2137 | | - |
2138 | | -!! end |
2139 | | - |
2140 | | -!! test |
2141 | | -Namespace 0 {{ns:00}} (bug 4783) |
2142 | | -!! input |
2143 | | -{{ns:00}} |
2144 | | -!! result |
2145 | | - |
2146 | | -!! end |
2147 | | - |
2148 | | -!! test |
2149 | | -Namespace -1 {{ns:-1}} |
2150 | | -!! input |
2151 | | -{{ns:-1}} |
2152 | | -!! result |
2153 | | -<p>Special |
2154 | | -</p> |
2155 | | -!! end |
2156 | | - |
2157 | | -!! test |
2158 | | -Namespace User {{ns:User}} |
2159 | | -!! input |
2160 | | -{{ns:User}} |
2161 | | -!! result |
2162 | | -<p>User |
2163 | | -</p> |
2164 | | -!! end |
2165 | | - |
2166 | | -!! test |
2167 | | -Namespace User talk {{ns:User_talk}} |
2168 | | -!! input |
2169 | | -{{ns:User_talk}} |
2170 | | -!! result |
2171 | | -<p>User talk |
2172 | | -</p> |
2173 | | -!! end |
2174 | | - |
2175 | | -!! test |
2176 | | -Namespace User talk {{ns:uSeR tAlK}} |
2177 | | -!! input |
2178 | | -{{ns:uSeR tAlK}} |
2179 | | -!! result |
2180 | | -<p>User talk |
2181 | | -</p> |
2182 | | -!! end |
2183 | | - |
2184 | | -!! test |
2185 | | -Namespace File {{ns:File}} |
2186 | | -!! input |
2187 | | -{{ns:File}} |
2188 | | -!! result |
2189 | | -<p>File |
2190 | | -</p> |
2191 | | -!! end |
2192 | | - |
2193 | | -!! test |
2194 | | -Namespace File {{ns:Image}} |
2195 | | -!! input |
2196 | | -{{ns:Image}} |
2197 | | -!! result |
2198 | | -<p>File |
2199 | | -</p> |
2200 | | -!! end |
2201 | | - |
2202 | | -!! test |
2203 | | -Namespace (lang=de) Benutzer {{ns:User}} |
2204 | | -!! options |
2205 | | -language=de |
2206 | | -!! input |
2207 | | -{{ns:User}} |
2208 | | -!! result |
2209 | | -<p>Benutzer |
2210 | | -</p> |
2211 | | -!! end |
2212 | | - |
2213 | | -!! test |
2214 | | -Namespace (lang=de) Benutzer Diskussion {{ns:3}} |
2215 | | -!! options |
2216 | | -language=de |
2217 | | -!! input |
2218 | | -{{ns:3}} |
2219 | | -!! result |
2220 | | -<p>Benutzer Diskussion |
2221 | | -</p> |
2222 | | -!! end |
2223 | | - |
2224 | | - |
2225 | | -!! test |
2226 | | -Urlencode |
2227 | | -!! input |
2228 | | -{{urlencode:hi world?!}} |
2229 | | -{{urlencode:hi world?!|WIKI}} |
2230 | | -{{urlencode:hi world?!|PATH}} |
2231 | | -{{urlencode:hi world?!|QUERY}} |
2232 | | -!! result |
2233 | | -<p>hi+world%3F%21 |
2234 | | -hi_world%3F! |
2235 | | -hi%20world%3F%21 |
2236 | | -hi+world%3F%21 |
2237 | | -</p> |
2238 | | -!! end |
2239 | | - |
2240 | | -### |
2241 | | -### Magic links |
2242 | | -### |
2243 | | -!! test |
2244 | | -Magic links: internal link to RFC (bug 479) |
2245 | | -!! input |
2246 | | -[[RFC 123]] |
2247 | | -!! result |
2248 | | -<p><a href="https://www.mediawiki.org/index.php?title=RFC_123&action=edit&redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a> |
2249 | | -</p> |
2250 | | -!! end |
2251 | | - |
2252 | | -!! test |
2253 | | -Magic links: RFC (bug 479) |
2254 | | -!! input |
2255 | | -RFC 822 |
2256 | | -!! result |
2257 | | -<p><a href="http://tools.ietf.org/html/rfc822" class="external mw-magiclink-rfc">RFC 822</a> |
2258 | | -</p> |
2259 | | -!! end |
2260 | | - |
2261 | | -!! test |
2262 | | -Magic links: ISBN (bug 1937) |
2263 | | -!! input |
2264 | | -ISBN 0-306-40615-2 |
2265 | | -!! result |
2266 | | -<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a> |
2267 | | -</p> |
2268 | | -!! end |
2269 | | - |
2270 | | -!! test |
2271 | | -Magic links: PMID incorrectly converts space to underscore |
2272 | | -!! input |
2273 | | -PMID 1234 |
2274 | | -!! result |
2275 | | -<p><a href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" class="external mw-magiclink-pmid">PMID 1234</a> |
2276 | | -</p> |
2277 | | -!! end |
2278 | | - |
2279 | | -### |
2280 | | -### Templates |
2281 | | -#### |
2282 | | - |
2283 | | -!! test |
2284 | | -Nonexistent template |
2285 | | -!! input |
2286 | | -{{thistemplatedoesnotexist}} |
2287 | | -!! result |
2288 | | -<p><a href="https://www.mediawiki.org/index.php?title=Template:Thistemplatedoesnotexist&action=edit&redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a> |
2289 | | -</p> |
2290 | | -!! end |
2291 | | - |
2292 | | -!! article |
2293 | | -Template:test |
2294 | | -!! text |
2295 | | -This is a test template |
2296 | | -!! endarticle |
2297 | | - |
2298 | | -!! test |
2299 | | -Simple template |
2300 | | -!! input |
2301 | | -{{test}} |
2302 | | -!! result |
2303 | | -<p>This is a test template |
2304 | | -</p> |
2305 | | -!! end |
2306 | | - |
2307 | | -!! test |
2308 | | -Template with explicit namespace |
2309 | | -!! input |
2310 | | -{{Template:test}} |
2311 | | -!! result |
2312 | | -<p>This is a test template |
2313 | | -</p> |
2314 | | -!! end |
2315 | | - |
2316 | | - |
2317 | | -!! article |
2318 | | -Template:paramtest |
2319 | | -!! text |
2320 | | -This is a test template with parameter {{{param}}} |
2321 | | -!! endarticle |
2322 | | - |
2323 | | -!! test |
2324 | | -Template parameter |
2325 | | -!! input |
2326 | | -{{paramtest|param=foo}} |
2327 | | -!! result |
2328 | | -<p>This is a test template with parameter foo |
2329 | | -</p> |
2330 | | -!! end |
2331 | | - |
2332 | | -!! article |
2333 | | -Template:paramtestnum |
2334 | | -!! text |
2335 | | -[[{{{1}}}|{{{2}}}]] |
2336 | | -!! endarticle |
2337 | | - |
2338 | | -!! test |
2339 | | -Template unnamed parameter |
2340 | | -!! input |
2341 | | -{{paramtestnum|Main Page|the main page}} |
2342 | | -!! result |
2343 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">the main page</a> |
2344 | | -</p> |
2345 | | -!! end |
2346 | | - |
2347 | | -!! article |
2348 | | -Template:templatesimple |
2349 | | -!! text |
2350 | | -(test) |
2351 | | -!! endarticle |
2352 | | - |
2353 | | -!! article |
2354 | | -Template:templateredirect |
2355 | | -!! text |
2356 | | -#redirect [[Template:templatesimple]] |
2357 | | -!! endarticle |
2358 | | - |
2359 | | -!! article |
2360 | | -Template:templateasargtestnum |
2361 | | -!! text |
2362 | | -{{{{{1}}}}} |
2363 | | -!! endarticle |
2364 | | - |
2365 | | -!! article |
2366 | | -Template:templateasargtest |
2367 | | -!! text |
2368 | | -{{template{{{templ}}}}} |
2369 | | -!! endarticle |
2370 | | - |
2371 | | -!! article |
2372 | | -Template:templateasargtest2 |
2373 | | -!! text |
2374 | | -{{{{{templ}}}}} |
2375 | | -!! endarticle |
2376 | | - |
2377 | | -!! test |
2378 | | -Template with template name as unnamed argument |
2379 | | -!! input |
2380 | | -{{templateasargtestnum|templatesimple}} |
2381 | | -!! result |
2382 | | -<p>(test) |
2383 | | -</p> |
2384 | | -!! end |
2385 | | - |
2386 | | -!! test |
2387 | | -Template with template name as argument |
2388 | | -!! input |
2389 | | -{{templateasargtest|templ=simple}} |
2390 | | -!! result |
2391 | | -<p>(test) |
2392 | | -</p> |
2393 | | -!! end |
2394 | | - |
2395 | | -!! test |
2396 | | -Template with template name as argument (2) |
2397 | | -!! input |
2398 | | -{{templateasargtest2|templ=templatesimple}} |
2399 | | -!! result |
2400 | | -<p>(test) |
2401 | | -</p> |
2402 | | -!! end |
2403 | | - |
2404 | | -!! article |
2405 | | -Template:templateasargtestdefault |
2406 | | -!! text |
2407 | | -{{{{{templ|templatesimple}}}}} |
2408 | | -!! endarticle |
2409 | | - |
2410 | | -!! article |
2411 | | -Template:templa |
2412 | | -!! text |
2413 | | -'''templ''' |
2414 | | -!! endarticle |
2415 | | - |
2416 | | -!! test |
2417 | | -Template with default value |
2418 | | -!! input |
2419 | | -{{templateasargtestdefault}} |
2420 | | -!! result |
2421 | | -<p>(test) |
2422 | | -</p> |
2423 | | -!! end |
2424 | | - |
2425 | | -!! test |
2426 | | -Template with default value (value set) |
2427 | | -!! input |
2428 | | -{{templateasargtestdefault|templ=templa}} |
2429 | | -!! result |
2430 | | -<p><b>templ</b> |
2431 | | -</p> |
2432 | | -!! end |
2433 | | - |
2434 | | -!! test |
2435 | | -Template redirect |
2436 | | -!! input |
2437 | | -{{templateredirect}} |
2438 | | -!! result |
2439 | | -<p>(test) |
2440 | | -</p> |
2441 | | -!! end |
2442 | | - |
2443 | | -!! test |
2444 | | -Template with argument in separate line |
2445 | | -!! input |
2446 | | -{{ templateasargtest | |
2447 | | - templ = simple }} |
2448 | | -!! result |
2449 | | -<p>(test) |
2450 | | -</p> |
2451 | | -!! end |
2452 | | - |
2453 | | -!! test |
2454 | | -Template with complex template as argument |
2455 | | -!! input |
2456 | | -{{paramtest| |
2457 | | - param ={{ templateasargtest | |
2458 | | - templ = simple }}}} |
2459 | | -!! result |
2460 | | -<p>This is a test template with parameter (test) |
2461 | | -</p> |
2462 | | -!! end |
2463 | | - |
2464 | | -!! test |
2465 | | -Template with thumb image (with link in description) |
2466 | | -!! input |
2467 | | -{{paramtest| |
2468 | | - param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} |
2469 | | -!! result |
2470 | | -This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="https://www.mediawiki.org/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="https://www.mediawiki.org/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div> |
2471 | | - |
2472 | | -!! end |
2473 | | - |
2474 | | -!! article |
2475 | | -Template:complextemplate |
2476 | | -!! text |
2477 | | -{{{1}}} {{paramtest| |
2478 | | - param ={{{param}}}}} |
2479 | | -!! endarticle |
2480 | | - |
2481 | | -!! test |
2482 | | -Template with complex arguments |
2483 | | -!! input |
2484 | | -{{complextemplate| |
2485 | | - param ={{ templateasargtest | |
2486 | | - templ = simple }}|[[Template:complextemplate|link]]}} |
2487 | | -!! result |
2488 | | -<p><a href="https://www.mediawiki.org/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test) |
2489 | | -</p> |
2490 | | -!! end |
2491 | | - |
2492 | | -!! test |
2493 | | -BUG 553: link with two variables in a piped link |
2494 | | -!! input |
2495 | | -{| |
2496 | | -|[[{{{1}}}|{{{2}}}]] |
2497 | | -|} |
2498 | | -!! result |
2499 | | -<table> |
2500 | | -<tr> |
2501 | | -<td>[[{{{1}}}|{{{2}}}]] |
2502 | | -</td></tr></table> |
2503 | | - |
2504 | | -!! end |
2505 | | - |
2506 | | -!! test |
2507 | | -Magic variable as template parameter |
2508 | | -!! input |
2509 | | -{{paramtest|param={{SITENAME}}}} |
2510 | | -!! result |
2511 | | -<p>This is a test template with parameter MediaWiki |
2512 | | -</p> |
2513 | | -!! end |
2514 | | - |
2515 | | -!! article |
2516 | | -Template:linktest |
2517 | | -!! text |
2518 | | -[[{{{param}}}|link]] |
2519 | | -!! endarticle |
2520 | | - |
2521 | | -!! test |
2522 | | -Template parameter as link source |
2523 | | -!! input |
2524 | | -{{linktest|param=Main Page}} |
2525 | | -!! result |
2526 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> |
2527 | | -</p> |
2528 | | -!! end |
2529 | | - |
2530 | | - |
2531 | | -!!article |
2532 | | -Template:paramtest2 |
2533 | | -!! text |
2534 | | -including another template, {{paramtest|param={{{arg}}}}} |
2535 | | -!! endarticle |
2536 | | - |
2537 | | -!! test |
2538 | | -Template passing argument to another template |
2539 | | -!! input |
2540 | | -{{paramtest2|arg='hmm'}} |
2541 | | -!! result |
2542 | | -<p>including another template, This is a test template with parameter 'hmm' |
2543 | | -</p> |
2544 | | -!! end |
2545 | | - |
2546 | | -!! article |
2547 | | -Template:Linktest2 |
2548 | | -!! text |
2549 | | -Main Page |
2550 | | -!! endarticle |
2551 | | - |
2552 | | -!! test |
2553 | | -Template as link source |
2554 | | -!! input |
2555 | | -[[{{linktest2}}]] |
2556 | | -!! result |
2557 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
2558 | | -</p> |
2559 | | -!! end |
2560 | | - |
2561 | | - |
2562 | | -!! article |
2563 | | -Template:loop1 |
2564 | | -!! text |
2565 | | -{{loop2}} |
2566 | | -!! endarticle |
2567 | | - |
2568 | | -!! article |
2569 | | -Template:loop2 |
2570 | | -!! text |
2571 | | -{{loop1}} |
2572 | | -!! endarticle |
2573 | | - |
2574 | | -!! test |
2575 | | -Template infinite loop |
2576 | | -!! input |
2577 | | -{{loop1}} |
2578 | | -!! result |
2579 | | -<p><span class="error">Template loop detected: <a href="https://www.mediawiki.org/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span> |
2580 | | -</p> |
2581 | | -!! end |
2582 | | - |
2583 | | -!! test |
2584 | | -Template from main namespace |
2585 | | -!! input |
2586 | | -{{:Main Page}} |
2587 | | -!! result |
2588 | | -<p>blah blah |
2589 | | -</p> |
2590 | | -!! end |
2591 | | - |
2592 | | -!! article |
2593 | | -Template:table |
2594 | | -!! text |
2595 | | -{| |
2596 | | -| 1 || 2 |
2597 | | -|- |
2598 | | -| 3 || 4 |
2599 | | -|} |
2600 | | -!! endarticle |
2601 | | - |
2602 | | -!! test |
2603 | | -BUG 529: Template with table, not included at beginning of line |
2604 | | -!! input |
2605 | | -foo {{table}} |
2606 | | -!! result |
2607 | | -<p>foo |
2608 | | -</p> |
2609 | | -<table> |
2610 | | -<tr> |
2611 | | -<td> 1 </td> |
2612 | | -<td> 2 |
2613 | | -</td></tr> |
2614 | | -<tr> |
2615 | | -<td> 3 </td> |
2616 | | -<td> 4 |
2617 | | -</td></tr></table> |
2618 | | - |
2619 | | -!! end |
2620 | | - |
2621 | | -!! test |
2622 | | -BUG 523: Template shouldn't eat newline (or add an extra one before table) |
2623 | | -!! input |
2624 | | -foo |
2625 | | -{{table}} |
2626 | | -!! result |
2627 | | -<p>foo |
2628 | | -</p> |
2629 | | -<table> |
2630 | | -<tr> |
2631 | | -<td> 1 </td> |
2632 | | -<td> 2 |
2633 | | -</td></tr> |
2634 | | -<tr> |
2635 | | -<td> 3 </td> |
2636 | | -<td> 4 |
2637 | | -</td></tr></table> |
2638 | | - |
2639 | | -!! end |
2640 | | - |
2641 | | -!! test |
2642 | | -BUG 41: Template parameters shown as broken links |
2643 | | -!! input |
2644 | | -{{{parameter}}} |
2645 | | -!! result |
2646 | | -<p>{{{parameter}}} |
2647 | | -</p> |
2648 | | -!! end |
2649 | | - |
2650 | | - |
2651 | | -!! article |
2652 | | -Template:MSGNW test |
2653 | | -!! text |
2654 | | -''None'' of '''this''' should be |
2655 | | -* interpreted |
2656 | | - but rather passed unmodified |
2657 | | -{{test}} |
2658 | | -!! endarticle |
2659 | | - |
2660 | | -# hmm, fix this or just deprecate msgnw and document its behavior? |
2661 | | -!! test |
2662 | | -msgnw keyword |
2663 | | -!! options |
2664 | | -disabled |
2665 | | -!! input |
2666 | | -{{msgnw:MSGNW test}} |
2667 | | -!! result |
2668 | | -<p>''None'' of '''this''' should be |
2669 | | -* interpreted |
2670 | | - but rather passed unmodified |
2671 | | -{{test}} |
2672 | | -</p> |
2673 | | -!! end |
2674 | | - |
2675 | | -!! test |
2676 | | -int keyword |
2677 | | -!! input |
2678 | | -{{int:youhavenewmessages|lots of money|not!}} |
2679 | | -!! result |
2680 | | -<p>You have lots of money (not!). |
2681 | | -</p> |
2682 | | -!! end |
2683 | | - |
2684 | | -!! article |
2685 | | -Template:Includes |
2686 | | -!! text |
2687 | | -Foo<noinclude>zar</noinclude><includeonly>bar</includeonly> |
2688 | | -!! endarticle |
2689 | | - |
2690 | | -!! test |
2691 | | -<includeonly> and <noinclude> being included |
2692 | | -!! input |
2693 | | -{{Includes}} |
2694 | | -!! result |
2695 | | -<p>Foobar |
2696 | | -</p> |
2697 | | -!! end |
2698 | | - |
2699 | | -!! article |
2700 | | -Template:Includes2 |
2701 | | -!! text |
2702 | | -<onlyinclude>Foo</onlyinclude>bar |
2703 | | -!! endarticle |
2704 | | - |
2705 | | -!! test |
2706 | | -<onlyinclude> being included |
2707 | | -!! input |
2708 | | -{{Includes2}} |
2709 | | -!! result |
2710 | | -<p>Foo |
2711 | | -</p> |
2712 | | -!! end |
2713 | | - |
2714 | | - |
2715 | | -!! article |
2716 | | -Template:Includes3 |
2717 | | -!! text |
2718 | | -<onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly> |
2719 | | -!! endarticle |
2720 | | - |
2721 | | -!! test |
2722 | | -<onlyinclude> and <includeonly> being included |
2723 | | -!! input |
2724 | | -{{Includes3}} |
2725 | | -!! result |
2726 | | -<p>Foo |
2727 | | -</p> |
2728 | | -!! end |
2729 | | - |
2730 | | -!! test |
2731 | | -<includeonly> and <noinclude> on a page |
2732 | | -!! input |
2733 | | -Foo<noinclude>zar</noinclude><includeonly>bar</includeonly> |
2734 | | -!! result |
2735 | | -<p>Foozar |
2736 | | -</p> |
2737 | | -!! end |
2738 | | - |
2739 | | -!! test |
2740 | | -<onlyinclude> on a page |
2741 | | -!! input |
2742 | | -<onlyinclude>Foo</onlyinclude>bar |
2743 | | -!! result |
2744 | | -<p>Foobar |
2745 | | -</p> |
2746 | | -!! end |
2747 | | - |
2748 | | -!! article |
2749 | | -Template:Includeonly section |
2750 | | -!! text |
2751 | | -<includeonly> |
2752 | | -==Includeonly section== |
2753 | | -</includeonly> |
2754 | | -==Section T-1== |
2755 | | -!!endarticle |
2756 | | - |
2757 | | -!! test |
2758 | | -Bug 6563: Edit link generation for section shown by <includeonly> |
2759 | | -!! input |
2760 | | -{{includeonly section}} |
2761 | | -!! result |
2762 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&action=edit&section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2> |
2763 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&action=edit&section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2> |
2764 | | - |
2765 | | -!! end |
2766 | | - |
2767 | | -# Uses same input as the contents of [[Template:Includeonly section]] |
2768 | | -!! test |
2769 | | -Bug 6563: Section extraction for section shown by <includeonly> |
2770 | | -!! options |
2771 | | -section=T-2 |
2772 | | -!! input |
2773 | | -<includeonly> |
2774 | | -==Includeonly section== |
2775 | | -</includeonly> |
2776 | | -==Section T-2== |
2777 | | -!! result |
2778 | | -==Section T-2== |
2779 | | -!! end |
2780 | | - |
2781 | | -!! test |
2782 | | -Bug 6563: Edit link generation for section suppressed by <includeonly> |
2783 | | -!! input |
2784 | | -<includeonly> |
2785 | | -==Includeonly section== |
2786 | | -</includeonly> |
2787 | | -==Section 1== |
2788 | | -!! result |
2789 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2> |
2790 | | - |
2791 | | -!! end |
2792 | | - |
2793 | | -!! test |
2794 | | -Bug 6563: Section extraction for section suppressed by <includeonly> |
2795 | | -!! options |
2796 | | -section=1 |
2797 | | -!! input |
2798 | | -<includeonly> |
2799 | | -==Includeonly section== |
2800 | | -</includeonly> |
2801 | | -==Section 1== |
2802 | | -!! result |
2803 | | -==Section 1== |
2804 | | -!! end |
2805 | | - |
2806 | | -### |
2807 | | -### Pre-save transform tests |
2808 | | -### |
2809 | | -!! test |
2810 | | -pre-save transform: subst: |
2811 | | -!! options |
2812 | | -PST |
2813 | | -!! input |
2814 | | -{{subst:test}} |
2815 | | -!! result |
2816 | | -This is a test template |
2817 | | -!! end |
2818 | | - |
2819 | | -!! test |
2820 | | -pre-save transform: normal template |
2821 | | -!! options |
2822 | | -PST |
2823 | | -!! input |
2824 | | -{{test}} |
2825 | | -!! result |
2826 | | -{{test}} |
2827 | | -!! end |
2828 | | - |
2829 | | -!! test |
2830 | | -pre-save transform: nonexistent template |
2831 | | -!! options |
2832 | | -PST |
2833 | | -!! input |
2834 | | -{{thistemplatedoesnotexist}} |
2835 | | -!! result |
2836 | | -{{thistemplatedoesnotexist}} |
2837 | | -!! end |
2838 | | - |
2839 | | - |
2840 | | -!! test |
2841 | | -pre-save transform: subst magic variables |
2842 | | -!! options |
2843 | | -PST |
2844 | | -!! input |
2845 | | -{{subst:SITENAME}} |
2846 | | -!! result |
2847 | | -MediaWiki |
2848 | | -!! end |
2849 | | - |
2850 | | -# This is bug 89, which I fixed. -- wtm |
2851 | | -!! test |
2852 | | -pre-save transform: subst: templates with parameters |
2853 | | -!! options |
2854 | | -pst |
2855 | | -!! input |
2856 | | -{{subst:paramtest|param="something else"}} |
2857 | | -!! result |
2858 | | -This is a test template with parameter "something else" |
2859 | | -!! end |
2860 | | - |
2861 | | -!! article |
2862 | | -Template:nowikitest |
2863 | | -!! text |
2864 | | -<nowiki>'''not wiki'''</nowiki> |
2865 | | -!! endarticle |
2866 | | - |
2867 | | -!! test |
2868 | | -pre-save transform: nowiki in subst (bug 1188) |
2869 | | -!! options |
2870 | | -pst |
2871 | | -!! input |
2872 | | -{{subst:nowikitest}} |
2873 | | -!! result |
2874 | | -<nowiki>'''not wiki'''</nowiki> |
2875 | | -!! end |
2876 | | - |
2877 | | - |
2878 | | -!! article |
2879 | | -Template:commenttest |
2880 | | -!! text |
2881 | | -This template has <!-- a comment --> in it. |
2882 | | -!! endarticle |
2883 | | - |
2884 | | -!! test |
2885 | | -pre-save transform: comment in subst (bug 1936) |
2886 | | -!! options |
2887 | | -pst |
2888 | | -!! input |
2889 | | -{{subst:commenttest}} |
2890 | | -!! result |
2891 | | -This template has <!-- a comment --> in it. |
2892 | | -!! end |
2893 | | - |
2894 | | -!! test |
2895 | | -pre-save transform: unclosed tag |
2896 | | -!! options |
2897 | | -pst noxml |
2898 | | -!! input |
2899 | | -<nowiki>'''not wiki''' |
2900 | | -!! result |
2901 | | -<nowiki>'''not wiki''' |
2902 | | -!! end |
2903 | | - |
2904 | | -!! test |
2905 | | -pre-save transform: mixed tag case |
2906 | | -!! options |
2907 | | -pst noxml |
2908 | | -!! input |
2909 | | -<NOwiki>'''not wiki'''</noWIKI> |
2910 | | -!! result |
2911 | | -<NOwiki>'''not wiki'''</noWIKI> |
2912 | | -!! end |
2913 | | - |
2914 | | -!! test |
2915 | | -pre-save transform: unclosed comment in <nowiki> |
2916 | | -!! options |
2917 | | -pst noxml |
2918 | | -!! input |
2919 | | -wiki<nowiki>nowiki<!--nowiki</nowiki>wiki |
2920 | | -!! result |
2921 | | -wiki<nowiki>nowiki<!--nowiki</nowiki>wiki |
2922 | | -!!end |
2923 | | - |
2924 | | -!! article |
2925 | | -Template:dangerous |
2926 | | -!!text |
2927 | | -<span onmouseover="alert('crap')">Oh no</span> |
2928 | | -!!endarticle |
2929 | | - |
2930 | | -!!test |
2931 | | -(confirming safety of fix for subst bug 1936) |
2932 | | -!! input |
2933 | | -{{Template:dangerous}} |
2934 | | -!! result |
2935 | | -<p><span>Oh no</span> |
2936 | | -</p> |
2937 | | -!! end |
2938 | | - |
2939 | | -!! test |
2940 | | -pre-save transform: comment containing gallery (bug 5024) |
2941 | | -!! options |
2942 | | -pst |
2943 | | -!! input |
2944 | | -<!-- <gallery>data</gallery> --> |
2945 | | -!!result |
2946 | | -<!-- <gallery>data</gallery> --> |
2947 | | -!!end |
2948 | | - |
2949 | | -!! test |
2950 | | -pre-save transform: comment containing extension |
2951 | | -!! options |
2952 | | -pst |
2953 | | -!! input |
2954 | | -<!-- <tag>data</tag> --> |
2955 | | -!!result |
2956 | | -<!-- <tag>data</tag> --> |
2957 | | -!!end |
2958 | | - |
2959 | | -!! test |
2960 | | -pre-save transform: comment containing nowiki |
2961 | | -!! options |
2962 | | -pst |
2963 | | -!! input |
2964 | | -<!-- <nowiki>data</nowiki> --> |
2965 | | -!!result |
2966 | | -<!-- <nowiki>data</nowiki> --> |
2967 | | -!!end |
2968 | | - |
2969 | | -!! test |
2970 | | -pre-save transform: comment containing math |
2971 | | -!! options |
2972 | | -pst |
2973 | | -!! input |
2974 | | -<!-- <math>data</math> --> |
2975 | | -!!result |
2976 | | -<!-- <math>data</math> --> |
2977 | | -!!end |
2978 | | - |
2979 | | -!! test |
2980 | | -pre-save transform: <noinclude> in subst (bug 3298) |
2981 | | -!! options |
2982 | | -pst |
2983 | | -!! input |
2984 | | -{{subst:Includes}} |
2985 | | -!! result |
2986 | | -Foobar |
2987 | | -!! end |
2988 | | - |
2989 | | -!! test |
2990 | | -pre-save transform: <onlyinclude> in subst (bug 3298) |
2991 | | -!! options |
2992 | | -pst |
2993 | | -!! input |
2994 | | -{{subst:Includes2}} |
2995 | | -!! result |
2996 | | -Foo |
2997 | | -!! end |
2998 | | - |
2999 | | -!! article |
3000 | | -Template:SubstTest |
3001 | | -!!text |
3002 | | -{{<includeonly>subst:</includeonly>Includes}} |
3003 | | -!! endarticle |
3004 | | - |
3005 | | -!! article |
3006 | | -Template:SafeSubstTest |
3007 | | -!! text |
3008 | | -{{<includeonly>safesubst:</includeonly>Includes}} |
3009 | | -!! endarticle |
3010 | | - |
3011 | | -!! test |
3012 | | -bug 22297: safesubst: works during PST |
3013 | | -!! options |
3014 | | -pst |
3015 | | -!! input |
3016 | | -{{subst:SafeSubstTest}}{{safesubst:SubstTest}} |
3017 | | -!! result |
3018 | | -FoobarFoobar |
3019 | | -!! end |
3020 | | - |
3021 | | -!! test |
3022 | | -bug 22297: safesubst: works during normal parse |
3023 | | -!! input |
3024 | | -{{SafeSubstTest}} |
3025 | | -!! result |
3026 | | -<p>Foobar |
3027 | | -</p> |
3028 | | -!! end |
3029 | | - |
3030 | | -!! test: |
3031 | | -subst: does not work during normal parse |
3032 | | -!! input |
3033 | | -{{SubstTest}} |
3034 | | -!! result |
3035 | | -<p>{{subst:Includes}} |
3036 | | -</p> |
3037 | | -!! end |
3038 | | - |
3039 | | -!! test |
3040 | | -pre-save transform: context links ("pipe trick") |
3041 | | -!! options |
3042 | | -pst |
3043 | | -!! input |
3044 | | -[[Article (context)|]] |
3045 | | -[[Bar:Article|]] |
3046 | | -[[:Bar:Article|]] |
3047 | | -[[Bar:Article (context)|]] |
3048 | | -[[:Bar:Article (context)|]] |
3049 | | -[[|Article]] |
3050 | | -[[|Article (context)]] |
3051 | | -[[Bar:X (Y) Z|]] |
3052 | | -[[:Bar:X (Y) Z|]] |
3053 | | -!! result |
3054 | | -[[Article (context)|Article]] |
3055 | | -[[Bar:Article|Article]] |
3056 | | -[[:Bar:Article|Article]] |
3057 | | -[[Bar:Article (context)|Article]] |
3058 | | -[[:Bar:Article (context)|Article]] |
3059 | | -[[Article]] |
3060 | | -[[Article (context)]] |
3061 | | -[[Bar:X (Y) Z|X (Y) Z]] |
3062 | | -[[:Bar:X (Y) Z|X (Y) Z]] |
3063 | | -!! end |
3064 | | - |
3065 | | -!! test |
3066 | | -pre-save transform: context links ("pipe trick") with interwiki prefix |
3067 | | -!! options |
3068 | | -pst |
3069 | | -!! input |
3070 | | -[[interwiki:Article|]] |
3071 | | -[[:interwiki:Article|]] |
3072 | | -[[interwiki:Bar:Article|]] |
3073 | | -[[:interwiki:Bar:Article|]] |
3074 | | -!! result |
3075 | | -[[interwiki:Article|Article]] |
3076 | | -[[:interwiki:Article|Article]] |
3077 | | -[[interwiki:Bar:Article|Bar:Article]] |
3078 | | -[[:interwiki:Bar:Article|Bar:Article]] |
3079 | | -!! end |
3080 | | - |
3081 | | -!! test |
3082 | | -pre-save transform: context links ("pipe trick") with parens in title |
3083 | | -!! options |
3084 | | -pst title=[[Somearticle (context)]] |
3085 | | -!! input |
3086 | | -[[|Article]] |
3087 | | -!! result |
3088 | | -[[Article (context)|Article]] |
3089 | | -!! end |
3090 | | - |
3091 | | -!! test |
3092 | | -pre-save transform: context links ("pipe trick") with comma in title |
3093 | | -!! options |
3094 | | -pst title=[[Someplace, Somewhere]] |
3095 | | -!! input |
3096 | | -[[|Otherplace]] |
3097 | | -[[Otherplace, Elsewhere|]] |
3098 | | -[[Otherplace, Elsewhere, Anywhere|]] |
3099 | | -!! result |
3100 | | -[[Otherplace, Somewhere|Otherplace]] |
3101 | | -[[Otherplace, Elsewhere|Otherplace]] |
3102 | | -[[Otherplace, Elsewhere, Anywhere|Otherplace]] |
3103 | | -!! end |
3104 | | - |
3105 | | -!! test |
3106 | | -pre-save transform: context links ("pipe trick") with parens and comma |
3107 | | -!! options |
3108 | | -pst title=[[Someplace (IGNORED), Somewhere]] |
3109 | | -!! input |
3110 | | -[[|Otherplace]] |
3111 | | -[[Otherplace (place), Elsewhere|]] |
3112 | | -!! result |
3113 | | -[[Otherplace, Somewhere|Otherplace]] |
3114 | | -[[Otherplace (place), Elsewhere|Otherplace]] |
3115 | | -!! end |
3116 | | - |
3117 | | -!! test |
3118 | | -pre-save transform: context links ("pipe trick") with comma and parens |
3119 | | -!! options |
3120 | | -pst title=[[Who, me? (context)]] |
3121 | | -!! input |
3122 | | -[[|Yes, you.]] |
3123 | | -[[Me, Myself, and I (1937 song)|]] |
3124 | | -!! result |
3125 | | -[[Yes, you. (context)|Yes, you.]] |
3126 | | -[[Me, Myself, and I (1937 song)|Me, Myself, and I]] |
3127 | | -!! end |
3128 | | - |
3129 | | -!! test |
3130 | | -pre-save transform: context links ("pipe trick") with namespace |
3131 | | -!! options |
3132 | | -pst title=[[Ns:Somearticle]] |
3133 | | -!! input |
3134 | | -[[|Article]] |
3135 | | -!! result |
3136 | | -[[Ns:Article|Article]] |
3137 | | -!! end |
3138 | | - |
3139 | | -!! test |
3140 | | -pre-save transform: context links ("pipe trick") with namespace and parens |
3141 | | -!! options |
3142 | | -pst title=[[Ns:Somearticle (context)]] |
3143 | | -!! input |
3144 | | -[[|Article]] |
3145 | | -!! result |
3146 | | -[[Ns:Article (context)|Article]] |
3147 | | -!! end |
3148 | | - |
3149 | | -!! test |
3150 | | -pre-save transform: context links ("pipe trick") with namespace and comma |
3151 | | -!! options |
3152 | | -pst title=[[Ns:Somearticle, Context, Whatever]] |
3153 | | -!! input |
3154 | | -[[|Article]] |
3155 | | -!! result |
3156 | | -[[Ns:Article, Context, Whatever|Article]] |
3157 | | -!! end |
3158 | | - |
3159 | | -!! test |
3160 | | -pre-save transform: context links ("pipe trick") with namespace, comma and parens |
3161 | | -!! options |
3162 | | -pst title=[[Ns:Somearticle, Context (context)]] |
3163 | | -!! input |
3164 | | -[[|Article]] |
3165 | | -!! result |
3166 | | -[[Ns:Article (context)|Article]] |
3167 | | -!! end |
3168 | | - |
3169 | | -!! test |
3170 | | -pre-save transform: context links ("pipe trick") with namespace, parens and comma |
3171 | | -!! options |
3172 | | -pst title=[[Ns:Somearticle (IGNORED), Context]] |
3173 | | -!! input |
3174 | | -[[|Article]] |
3175 | | -!! result |
3176 | | -[[Ns:Article, Context|Article]] |
3177 | | -!! end |
3178 | | - |
3179 | | - |
3180 | | -### |
3181 | | -### Message transform tests |
3182 | | -### |
3183 | | -!! test |
3184 | | -message transform: magic variables |
3185 | | -!! options |
3186 | | -msg |
3187 | | -!! input |
3188 | | -{{SITENAME}} |
3189 | | -!! result |
3190 | | -MediaWiki |
3191 | | -!! end |
3192 | | - |
3193 | | -!! test |
3194 | | -message transform: should not transform wiki markup |
3195 | | -!! options |
3196 | | -msg |
3197 | | -!! input |
3198 | | -''test'' |
3199 | | -!! result |
3200 | | -''test'' |
3201 | | -!! end |
3202 | | - |
3203 | | -!! test |
3204 | | -message transform: <noinclude> in transcluded template (bug 4926) |
3205 | | -!! options |
3206 | | -msg |
3207 | | -!! input |
3208 | | -{{Includes}} |
3209 | | -!! result |
3210 | | -Foobar |
3211 | | -!! end |
3212 | | - |
3213 | | -!! test |
3214 | | -message transform: <onlyinclude> in transcluded template (bug 4926) |
3215 | | -!! options |
3216 | | -msg |
3217 | | -!! input |
3218 | | -{{Includes2}} |
3219 | | -!! result |
3220 | | -Foo |
3221 | | -!! end |
3222 | | - |
3223 | | -!! test |
3224 | | -{{#special:}} page name, known |
3225 | | -!! options |
3226 | | -msg |
3227 | | -!! input |
3228 | | -{{#special:Recentchanges}} |
3229 | | -!! result |
3230 | | -Special:RecentChanges |
3231 | | -!! end |
3232 | | - |
3233 | | -!! test |
3234 | | -{{#special:}} page name with subpage, known |
3235 | | -!! options |
3236 | | -msg |
3237 | | -!! input |
3238 | | -{{#special:Recentchanges/param}} |
3239 | | -!! result |
3240 | | -Special:RecentChanges/param |
3241 | | -!! end |
3242 | | - |
3243 | | -!! test |
3244 | | -{{#special:}} page name, unknown |
3245 | | -!! options |
3246 | | -msg |
3247 | | -!! input |
3248 | | -{{#special:foobarnonexistent}} |
3249 | | -!! result |
3250 | | -No such special page |
3251 | | -!! end |
3252 | | - |
3253 | | -### |
3254 | | -### Images |
3255 | | -### |
3256 | | -!! test |
3257 | | -Simple image |
3258 | | -!! input |
3259 | | -[[Image:foobar.jpg]] |
3260 | | -!! result |
3261 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3262 | | -</p> |
3263 | | -!! end |
3264 | | - |
3265 | | -!! test |
3266 | | -Right-aligned image |
3267 | | -!! input |
3268 | | -[[Image:foobar.jpg|right]] |
3269 | | -!! result |
3270 | | -<div class="floatright"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> |
3271 | | - |
3272 | | -!! end |
3273 | | - |
3274 | | -!! test |
3275 | | -Simple image (using File: namespace, now canonical) |
3276 | | -!! input |
3277 | | -[[File:foobar.jpg]] |
3278 | | -!! result |
3279 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3280 | | -</p> |
3281 | | -!! end |
3282 | | - |
3283 | | -!! test |
3284 | | -Image with caption |
3285 | | -!! input |
3286 | | -[[Image:foobar.jpg|right|Caption text]] |
3287 | | -!! result |
3288 | | -<div class="floatright"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> |
3289 | | - |
3290 | | -!! end |
3291 | | - |
3292 | | -!! test |
3293 | | -Image with link parameter, wiki target |
3294 | | -!! input |
3295 | | -[[Image:foobar.jpg|link=Target page]] |
3296 | | -!! result |
3297 | | -<p><a href="https://www.mediawiki.org/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3298 | | -</p> |
3299 | | -!! end |
3300 | | - |
3301 | | -!! test |
3302 | | -Image with link parameter, URL target |
3303 | | -!! input |
3304 | | -[[Image:foobar.jpg|link=http://example.com/]] |
3305 | | -!! result |
3306 | | -<p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3307 | | -</p> |
3308 | | -!! end |
3309 | | - |
3310 | | -!! test |
3311 | | -Image with empty link parameter |
3312 | | -!! input |
3313 | | -[[Image:foobar.jpg|link=]] |
3314 | | -!! result |
3315 | | -<p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /> |
3316 | | -</p> |
3317 | | -!! end |
3318 | | - |
3319 | | -!! test |
3320 | | -Image with link parameter (wiki target) and unnamed parameter |
3321 | | -!! input |
3322 | | -[[Image:foobar.jpg|link=Target page|Title]] |
3323 | | -!! result |
3324 | | -<p><a href="https://www.mediawiki.org/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3325 | | -</p> |
3326 | | -!! end |
3327 | | - |
3328 | | -!! test |
3329 | | -Image with link parameter (URL target) and unnamed parameter |
3330 | | -!! input |
3331 | | -[[Image:foobar.jpg|link=http://example.com/|Title]] |
3332 | | -!! result |
3333 | | -<p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3334 | | -</p> |
3335 | | -!! end |
3336 | | - |
3337 | | -!! test |
3338 | | -Thumbnail image with link parameter |
3339 | | -!! input |
3340 | | -[[Image:foobar.jpg|thumb|link=http://example.com/|Title]] |
3341 | | -!! result |
3342 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div> |
3343 | | - |
3344 | | -!! end |
3345 | | - |
3346 | | -!! test |
3347 | | -Image with frame and link |
3348 | | -!! input |
3349 | | -[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] |
3350 | | -!! result |
3351 | | -<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
3352 | | - |
3353 | | -!! end |
3354 | | - |
3355 | | -!! test |
3356 | | -Image with frame and link and explicit alt |
3357 | | -!! input |
3358 | | -[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]] |
3359 | | -!! result |
3360 | | -<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
3361 | | - |
3362 | | -!! end |
3363 | | - |
3364 | | -!! test |
3365 | | -Image with wiki markup in implicit alt |
3366 | | -!! input |
3367 | | -[[Image:Foobar.jpg|testing '''bold''' in alt]] |
3368 | | -!! result |
3369 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3370 | | -</p> |
3371 | | -!! end |
3372 | | - |
3373 | | -!! test |
3374 | | -Image with wiki markup in explicit alt |
3375 | | -!! input |
3376 | | -[[Image:Foobar.jpg|alt=testing '''bold''' in alt]] |
3377 | | -!! result |
3378 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3379 | | -</p> |
3380 | | -!! end |
3381 | | - |
3382 | | -!! test |
3383 | | -Link to image page- image page normally doesn't exists, hence edit link |
3384 | | -Add test with existing image page |
3385 | | -#<p><a href="https://www.mediawiki.org/wiki/File:Test" title="Image:Test">Image:test</a> |
3386 | | -!! input |
3387 | | -[[:Image:test]] |
3388 | | -!! result |
3389 | | -<p><a href="https://www.mediawiki.org/index.php?title=File:Test&action=edit&redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a> |
3390 | | -</p> |
3391 | | -!! end |
3392 | | - |
3393 | | -!! test |
3394 | | -bug 18784 Link to non-existent image page with caption should use caption as link text |
3395 | | -!! input |
3396 | | -[[:Image:test|caption]] |
3397 | | -!! result |
3398 | | -<p><a href="https://www.mediawiki.org/index.php?title=File:Test&action=edit&redlink=1" class="new" title="File:Test (page does not exist)">caption</a> |
3399 | | -</p> |
3400 | | -!! end |
3401 | | - |
3402 | | -!! test |
3403 | | -Frameless image caption with a free URL |
3404 | | -!! input |
3405 | | -[[Image:foobar.jpg|http://example.com]] |
3406 | | -!! result |
3407 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3408 | | -</p> |
3409 | | -!! end |
3410 | | - |
3411 | | -!! test |
3412 | | -Thumbnail image caption with a free URL |
3413 | | -!! input |
3414 | | -[[Image:foobar.jpg|thumb|http://example.com]] |
3415 | | -!! result |
3416 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div> |
3417 | | - |
3418 | | -!! end |
3419 | | - |
3420 | | -!! test |
3421 | | -Thumbnail image caption with a free URL and explicit alt |
3422 | | -!! input |
3423 | | -[[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]] |
3424 | | -!! result |
3425 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div> |
3426 | | - |
3427 | | -!! end |
3428 | | - |
3429 | | -!! test |
3430 | | -BUG 1887: A ISBN with a thumbnail |
3431 | | -!! input |
3432 | | -[[Image:foobar.jpg|thumb|ISBN 1235467890]] |
3433 | | -!! result |
3434 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="https://www.mediawiki.org/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div> |
3435 | | - |
3436 | | -!! end |
3437 | | - |
3438 | | -!! test |
3439 | | -BUG 1887: A RFC with a thumbnail |
3440 | | -!! input |
3441 | | -[[Image:foobar.jpg|thumb|This is RFC 12354]] |
3442 | | -!! result |
3443 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external mw-magiclink-rfc">RFC 12354</a></div></div></div> |
3444 | | - |
3445 | | -!! end |
3446 | | - |
3447 | | -!! test |
3448 | | -BUG 1887: A mailto link with a thumbnail |
3449 | | -!! input |
3450 | | -[[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]] |
3451 | | -!! result |
3452 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" rel="nofollow">mailto:nobody@example.com</a></div></div></div> |
3453 | | - |
3454 | | -!! end |
3455 | | - |
3456 | | -!! test |
3457 | | -BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default, |
3458 | | -so math is not stripped and turns up as escaped <math> tags. |
3459 | | -!! input |
3460 | | -[[Image:foobar.jpg|thumb|<math>2+2</math>]] |
3461 | | -!! result |
3462 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><math>2+2</math></div></div></div> |
3463 | | - |
3464 | | -!! end |
3465 | | - |
3466 | | -!! test |
3467 | | -BUG 1887, part 2: A <math> with a thumbnail- math enabled |
3468 | | -!! options |
3469 | | -math |
3470 | | -!! input |
3471 | | -[[Image:foobar.jpg|thumb|<math>2+2</math>]] |
3472 | | -!! result |
3473 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div> |
3474 | | - |
3475 | | -!! end |
3476 | | - |
3477 | | -# Pending resolution to bug 368 |
3478 | | -!! test |
3479 | | -BUG 648: Frameless image caption with a link |
3480 | | -!! input |
3481 | | -[[Image:foobar.jpg|text with a [[link]] in it]] |
3482 | | -!! result |
3483 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3484 | | -</p> |
3485 | | -!! end |
3486 | | - |
3487 | | -!! test |
3488 | | -BUG 648: Frameless image caption with a link (suffix) |
3489 | | -!! input |
3490 | | -[[Image:foobar.jpg|text with a [[link]]foo in it]] |
3491 | | -!! result |
3492 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3493 | | -</p> |
3494 | | -!! end |
3495 | | - |
3496 | | -!! test |
3497 | | -BUG 648: Frameless image caption with an interwiki link |
3498 | | -!! input |
3499 | | -[[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]] |
3500 | | -!! result |
3501 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3502 | | -</p> |
3503 | | -!! end |
3504 | | - |
3505 | | -!! test |
3506 | | -BUG 648: Frameless image caption with a piped interwiki link |
3507 | | -!! input |
3508 | | -[[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]] |
3509 | | -!! result |
3510 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3511 | | -</p> |
3512 | | -!! end |
3513 | | - |
3514 | | -!! test |
3515 | | -Escape HTML special chars in image alt text |
3516 | | -!! input |
3517 | | -[[Image:foobar.jpg|& < > "]] |
3518 | | -!! result |
3519 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="& < > ""><img alt="& < > "" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3520 | | -</p> |
3521 | | -!! end |
3522 | | - |
3523 | | -!! test |
3524 | | -BUG 499: Alt text should have Ӓ, not &1234; |
3525 | | -!! input |
3526 | | -[[Image:foobar.jpg|♀]] |
3527 | | -!! result |
3528 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3529 | | -</p> |
3530 | | -!! end |
3531 | | - |
3532 | | -!! test |
3533 | | -Broken image caption with link |
3534 | | -!! input |
3535 | | -[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link. |
3536 | | -!! result |
3537 | | -<p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link. |
3538 | | -</p> |
3539 | | -!! end |
3540 | | - |
3541 | | -!! test |
3542 | | -Image caption containing another image |
3543 | | -!! input |
3544 | | -[[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] |
3545 | | -!! result |
3546 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div> |
3547 | | - |
3548 | | -!! end |
3549 | | - |
3550 | | -!! test |
3551 | | -Image caption containing a newline |
3552 | | -!! input |
3553 | | -[[Image:Foobar.jpg|This |
3554 | | -*is some text]] |
3555 | | -!! result |
3556 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
3557 | | -</p> |
3558 | | -!!end |
3559 | | - |
3560 | | - |
3561 | | -!! test |
3562 | | -Bug 3090: External links other than http: in image captions |
3563 | | -!! input |
3564 | | -[[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] |
3565 | | -!! result |
3566 | | -<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="200" height="23" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" rel="nofollow">Secure</a> ext links in it.</div></div></div> |
3567 | | - |
3568 | | -!! end |
3569 | | - |
3570 | | -!! article |
3571 | | -File:Barfoo.jpg |
3572 | | -!! text |
3573 | | -#REDIRECT [[File:Barfoo.jpg]] |
3574 | | -!! endarticle |
3575 | | - |
3576 | | -!! test |
3577 | | -Redirected image |
3578 | | -!! input |
3579 | | -[[Image:Barfoo.jpg]] |
3580 | | -!! result |
3581 | | -<p><a href="https://www.mediawiki.org/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a> |
3582 | | -</p> |
3583 | | -!! end |
3584 | | - |
3585 | | -!! test |
3586 | | -Missing image with uploads disabled |
3587 | | -!! options |
3588 | | -wgEnableUploads=0 |
3589 | | -!! input |
3590 | | -[[Image:Foobaz.jpg]] |
3591 | | -!! result |
3592 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a> |
3593 | | -</p> |
3594 | | -!! end |
3595 | | - |
3596 | | - |
3597 | | -### |
3598 | | -### Subpages |
3599 | | -### |
3600 | | -!! article |
3601 | | -Subpage test/subpage |
3602 | | -!! text |
3603 | | -foo |
3604 | | -!! endarticle |
3605 | | - |
3606 | | -!! test |
3607 | | -Subpage link |
3608 | | -!! options |
3609 | | -subpage title=[[Subpage test]] |
3610 | | -!! input |
3611 | | -[[/subpage]] |
3612 | | -!! result |
3613 | | -<p><a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> |
3614 | | -</p> |
3615 | | -!! end |
3616 | | - |
3617 | | -!! test |
3618 | | -Subpage noslash link |
3619 | | -!! options |
3620 | | -subpage title=[[Subpage test]] |
3621 | | -!!input |
3622 | | -[[/subpage/]] |
3623 | | -!! result |
3624 | | -<p><a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a> |
3625 | | -</p> |
3626 | | -!! end |
3627 | | - |
3628 | | -!! test |
3629 | | -Disabled subpages |
3630 | | -!! input |
3631 | | -[[/subpage]] |
3632 | | -!! result |
3633 | | -<p><a href="https://www.mediawiki.org/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> |
3634 | | -</p> |
3635 | | -!! end |
3636 | | - |
3637 | | -!! test |
3638 | | -BUG 561: {{/Subpage}} |
3639 | | -!! options |
3640 | | -subpage title=[[Page]] |
3641 | | -!! input |
3642 | | -{{/Subpage}} |
3643 | | -!! result |
3644 | | -<p><a href="https://www.mediawiki.org/index.php?title=Page/Subpage&action=edit&redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a> |
3645 | | -</p> |
3646 | | -!! end |
3647 | | - |
3648 | | -### |
3649 | | -### Categories |
3650 | | -### |
3651 | | -!! article |
3652 | | -Category:MediaWiki User's Guide |
3653 | | -!! text |
3654 | | -blah |
3655 | | -!! endarticle |
3656 | | - |
3657 | | -!! test |
3658 | | -Link to category |
3659 | | -!! input |
3660 | | -[[:Category:MediaWiki User's Guide]] |
3661 | | -!! result |
3662 | | -<p><a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a> |
3663 | | -</p> |
3664 | | -!! end |
3665 | | - |
3666 | | -!! test |
3667 | | -Simple category |
3668 | | -!! options |
3669 | | -cat |
3670 | | -!! input |
3671 | | -[[Category:MediaWiki User's Guide]] |
3672 | | -!! result |
3673 | | -<a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a> |
3674 | | -!! end |
3675 | | - |
3676 | | -!! test |
3677 | | -PAGESINCATEGORY invalid title fatal (r33546 fix) |
3678 | | -!! input |
3679 | | -{{PAGESINCATEGORY:<bogus>}} |
3680 | | -!! result |
3681 | | -<p>0 |
3682 | | -</p> |
3683 | | -!! end |
3684 | | - |
3685 | | -### |
3686 | | -### Inter-language links |
3687 | | -### |
3688 | | -!! test |
3689 | | -Inter-language links |
3690 | | -!! options |
3691 | | -ill |
3692 | | -!! input |
3693 | | -[[es:Alimento]] |
3694 | | -[[fr:Nourriture]] |
3695 | | -[[zh:食品]] |
3696 | | -!! result |
3697 | | -es:Alimento fr:Nourriture zh:食品 |
3698 | | -!! end |
3699 | | - |
3700 | | -### |
3701 | | -### Sections |
3702 | | -### |
3703 | | -!! test |
3704 | | -Basic section headings |
3705 | | -!! input |
3706 | | -== Headline 1 == |
3707 | | -Some text |
3708 | | - |
3709 | | -==Headline 2== |
3710 | | -More |
3711 | | -===Smaller headline=== |
3712 | | -Blah blah |
3713 | | -!! result |
3714 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2> |
3715 | | -<p>Some text |
3716 | | -</p> |
3717 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2> |
3718 | | -<p>More |
3719 | | -</p> |
3720 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3> |
3721 | | -<p>Blah blah |
3722 | | -</p> |
3723 | | -!! end |
3724 | | - |
3725 | | -!! test |
3726 | | -Section headings with TOC |
3727 | | -!! input |
3728 | | -== Headline 1 == |
3729 | | -=== Subheadline 1 === |
3730 | | -===== Skipping a level ===== |
3731 | | -====== Skipping a level ====== |
3732 | | - |
3733 | | -== Headline 2 == |
3734 | | -Some text |
3735 | | -===Another headline=== |
3736 | | -!! result |
3737 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
3738 | | -<ul> |
3739 | | -<li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a> |
3740 | | -<ul> |
3741 | | -<li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a> |
3742 | | -<ul> |
3743 | | -<li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a> |
3744 | | -<ul> |
3745 | | -<li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li> |
3746 | | -</ul> |
3747 | | -</li> |
3748 | | -</ul> |
3749 | | -</li> |
3750 | | -</ul> |
3751 | | -</li> |
3752 | | -<li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a> |
3753 | | -<ul> |
3754 | | -<li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li> |
3755 | | -</ul> |
3756 | | -</li> |
3757 | | -</ul> |
3758 | | -</td></tr></table> |
3759 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2> |
3760 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3> |
3761 | | -<h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5> |
3762 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6> |
3763 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2> |
3764 | | -<p>Some text |
3765 | | -</p> |
3766 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3> |
3767 | | - |
3768 | | -!! end |
3769 | | - |
3770 | | -# perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' |
3771 | | -!! test |
3772 | | -Handling of sections up to level 6 and beyond |
3773 | | -!! input |
3774 | | -= Level 1 Heading= |
3775 | | -== Level 2 Heading== |
3776 | | -=== Level 3 Heading=== |
3777 | | -==== Level 4 Heading==== |
3778 | | -===== Level 5 Heading===== |
3779 | | -====== Level 6 Heading====== |
3780 | | -======= Level 7 Heading======= |
3781 | | -======== Level 8 Heading======== |
3782 | | -========= Level 9 Heading========= |
3783 | | -========== Level 10 Heading========== |
3784 | | -!! result |
3785 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
3786 | | -<ul> |
3787 | | -<li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a> |
3788 | | -<ul> |
3789 | | -<li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a> |
3790 | | -<ul> |
3791 | | -<li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a> |
3792 | | -<ul> |
3793 | | -<li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a> |
3794 | | -<ul> |
3795 | | -<li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a> |
3796 | | -<ul> |
3797 | | -<li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li> |
3798 | | -<li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li> |
3799 | | -<li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li> |
3800 | | -<li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li> |
3801 | | -<li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li> |
3802 | | -</ul> |
3803 | | -</li> |
3804 | | -</ul> |
3805 | | -</li> |
3806 | | -</ul> |
3807 | | -</li> |
3808 | | -</ul> |
3809 | | -</li> |
3810 | | -</ul> |
3811 | | -</li> |
3812 | | -</ul> |
3813 | | -</td></tr></table> |
3814 | | -<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1> |
3815 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2> |
3816 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3> |
3817 | | -<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4> |
3818 | | -<h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5> |
3819 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6> |
3820 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6> |
3821 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6> |
3822 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6> |
3823 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6> |
3824 | | - |
3825 | | -!! end |
3826 | | - |
3827 | | -!! test |
3828 | | -TOC regression (bug 9764) |
3829 | | -!! input |
3830 | | -== title 1 == |
3831 | | -=== title 1.1 === |
3832 | | -==== title 1.1.1 ==== |
3833 | | -=== title 1.2 === |
3834 | | -== title 2 == |
3835 | | -=== title 2.1 === |
3836 | | -!! result |
3837 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
3838 | | -<ul> |
3839 | | -<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a> |
3840 | | -<ul> |
3841 | | -<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a> |
3842 | | -<ul> |
3843 | | -<li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li> |
3844 | | -</ul> |
3845 | | -</li> |
3846 | | -<li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li> |
3847 | | -</ul> |
3848 | | -</li> |
3849 | | -<li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a> |
3850 | | -<ul> |
3851 | | -<li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li> |
3852 | | -</ul> |
3853 | | -</li> |
3854 | | -</ul> |
3855 | | -</td></tr></table> |
3856 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2> |
3857 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3> |
3858 | | -<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4> |
3859 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3> |
3860 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2> |
3861 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3> |
3862 | | - |
3863 | | -!! end |
3864 | | - |
3865 | | -!! test |
3866 | | -TOC with wgMaxTocLevel=3 (bug 6204) |
3867 | | -!! options |
3868 | | -wgMaxTocLevel=3 |
3869 | | -!! input |
3870 | | -== title 1 == |
3871 | | -=== title 1.1 === |
3872 | | -==== title 1.1.1 ==== |
3873 | | -=== title 1.2 === |
3874 | | -== title 2 == |
3875 | | -=== title 2.1 === |
3876 | | -!! result |
3877 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
3878 | | -<ul> |
3879 | | -<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a> |
3880 | | -<ul> |
3881 | | -<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li> |
3882 | | -<li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li> |
3883 | | -</ul> |
3884 | | -</li> |
3885 | | -<li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a> |
3886 | | -<ul> |
3887 | | -<li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li> |
3888 | | -</ul> |
3889 | | -</li> |
3890 | | -</ul> |
3891 | | -</td></tr></table> |
3892 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2> |
3893 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3> |
3894 | | -<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4> |
3895 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3> |
3896 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2> |
3897 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3> |
3898 | | - |
3899 | | -!! end |
3900 | | - |
3901 | | -!! test |
3902 | | -TOC with wgMaxTocLevel=3 and two level four headings (bug 6204) |
3903 | | -!! options |
3904 | | -wgMaxTocLevel=3 |
3905 | | -!! input |
3906 | | -==Section 1== |
3907 | | -===Section 1.1=== |
3908 | | -====Section 1.1.1==== |
3909 | | -====Section 1.1.1.1==== |
3910 | | -==Section 2== |
3911 | | -!! result |
3912 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
3913 | | -<ul> |
3914 | | -<li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a> |
3915 | | -<ul> |
3916 | | -<li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li> |
3917 | | -</ul> |
3918 | | -</li> |
3919 | | -<li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li> |
3920 | | -</ul> |
3921 | | -</td></tr></table> |
3922 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2> |
3923 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3> |
3924 | | -<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4> |
3925 | | -<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4> |
3926 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2> |
3927 | | - |
3928 | | -!! end |
3929 | | - |
3930 | | - |
3931 | | -!! test |
3932 | | -Resolving duplicate section names |
3933 | | -!! input |
3934 | | -== Foo bar == |
3935 | | -== Foo bar == |
3936 | | -!! result |
3937 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2> |
3938 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2> |
3939 | | - |
3940 | | -!! end |
3941 | | - |
3942 | | -!! test |
3943 | | -Resolving duplicate section names with differing case (bug 10721) |
3944 | | -!! input |
3945 | | -== Foo bar == |
3946 | | -== Foo Bar == |
3947 | | -!! result |
3948 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2> |
3949 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2> |
3950 | | - |
3951 | | -!! end |
3952 | | - |
3953 | | -!! article |
3954 | | -Template:sections |
3955 | | -!! text |
3956 | | -===Section 1=== |
3957 | | -==Section 2== |
3958 | | -!! endarticle |
3959 | | - |
3960 | | -!! test |
3961 | | -Template with sections, __NOTOC__ |
3962 | | -!! input |
3963 | | -__NOTOC__ |
3964 | | -==Section 0== |
3965 | | -{{sections}} |
3966 | | -==Section 4== |
3967 | | -!! result |
3968 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2> |
3969 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&action=edit&section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3> |
3970 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&action=edit&section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2> |
3971 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2> |
3972 | | - |
3973 | | -!! end |
3974 | | - |
3975 | | -!! test |
3976 | | -__NOEDITSECTION__ keyword |
3977 | | -!! input |
3978 | | -__NOEDITSECTION__ |
3979 | | -==Section 1== |
3980 | | -==Section 2== |
3981 | | -!! result |
3982 | | -<h2> <span class="mw-headline" id="Section_1">Section 1</span></h2> |
3983 | | -<h2> <span class="mw-headline" id="Section_2">Section 2</span></h2> |
3984 | | - |
3985 | | -!! end |
3986 | | - |
3987 | | -!! test |
3988 | | -Link inside a section heading |
3989 | | -!! input |
3990 | | -==Section with a [[Main Page|link]] in it== |
3991 | | -!! result |
3992 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> in it</span></h2> |
3993 | | - |
3994 | | -!! end |
3995 | | - |
3996 | | -!! test |
3997 | | -TOC regression (bug 12077) |
3998 | | -!! input |
3999 | | -__TOC__ |
4000 | | -== title 1 == |
4001 | | -=== title 1.1 === |
4002 | | -== title 2 == |
4003 | | -!! result |
4004 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
4005 | | -<ul> |
4006 | | -<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a> |
4007 | | -<ul> |
4008 | | -<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li> |
4009 | | -</ul> |
4010 | | -</li> |
4011 | | -<li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li> |
4012 | | -</ul> |
4013 | | -</td></tr></table> |
4014 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2> |
4015 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3> |
4016 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2> |
4017 | | - |
4018 | | -!! end |
4019 | | - |
4020 | | -!! test |
4021 | | -BUG 1219 URL next to image (good) |
4022 | | -!! input |
4023 | | -http://example.com [[Image:foobar.jpg]] |
4024 | | -!! result |
4025 | | -<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> <a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
4026 | | -</p> |
4027 | | -!!end |
4028 | | - |
4029 | | -!! test |
4030 | | -Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910) |
4031 | | -!! input |
4032 | | -=== |
4033 | | -The line above must have a trailing space! |
4034 | | -=== <!-- |
4035 | | -But just in case it doesn't... |
4036 | | -!! result |
4037 | | -<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1> |
4038 | | -<p>The line above must have a trailing space! |
4039 | | -</p> |
4040 | | -<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1> |
4041 | | -<p>But just in case it doesn't... |
4042 | | -</p> |
4043 | | -!! end |
4044 | | - |
4045 | | -!! test |
4046 | | -BUG 1219 URL next to image (broken) |
4047 | | -!! input |
4048 | | -http://example.com[[Image:foobar.jpg]] |
4049 | | -!! result |
4050 | | -<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
4051 | | -</p> |
4052 | | -!!end |
4053 | | - |
4054 | | -!! test |
4055 | | -Bug 1186 news: in the middle of text |
4056 | | -!! input |
4057 | | -http://en.wikinews.org/wiki/Wikinews:Workplace |
4058 | | -!! result |
4059 | | -<p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a> |
4060 | | -</p> |
4061 | | -!!end |
4062 | | - |
4063 | | - |
4064 | | -!! test |
4065 | | -Namespaced link must have a title |
4066 | | -!! input |
4067 | | -[[Project:]] |
4068 | | -!! result |
4069 | | -<p>[[Project:]] |
4070 | | -</p> |
4071 | | -!!end |
4072 | | - |
4073 | | -!! test |
4074 | | -Namespaced link must have a title (bad fragment version) |
4075 | | -!! input |
4076 | | -[[Project:#fragment]] |
4077 | | -!! result |
4078 | | -<p>[[Project:#fragment]] |
4079 | | -</p> |
4080 | | -!!end |
4081 | | - |
4082 | | - |
4083 | | -!! test |
4084 | | -div with no attributes |
4085 | | -!! input |
4086 | | -<div>HTML rocks</div> |
4087 | | -!! result |
4088 | | -<div>HTML rocks</div> |
4089 | | - |
4090 | | -!! end |
4091 | | - |
4092 | | -!! test |
4093 | | -div with double-quoted attribute |
4094 | | -!! input |
4095 | | -<div id="rock">HTML rocks</div> |
4096 | | -!! result |
4097 | | -<div id="rock">HTML rocks</div> |
4098 | | - |
4099 | | -!! end |
4100 | | - |
4101 | | -!! test |
4102 | | -div with single-quoted attribute |
4103 | | -!! input |
4104 | | -<div id='rock'>HTML rocks</div> |
4105 | | -!! result |
4106 | | -<div id="rock">HTML rocks</div> |
4107 | | - |
4108 | | -!! end |
4109 | | - |
4110 | | -!! test |
4111 | | -div with unquoted attribute |
4112 | | -!! input |
4113 | | -<div id=rock>HTML rocks</div> |
4114 | | -!! result |
4115 | | -<div id="rock">HTML rocks</div> |
4116 | | - |
4117 | | -!! end |
4118 | | - |
4119 | | -!! test |
4120 | | -div with illegal double attributes |
4121 | | -!! input |
4122 | | -<div align="center" align="right">HTML rocks</div> |
4123 | | -!! result |
4124 | | -<div align="right">HTML rocks</div> |
4125 | | - |
4126 | | -!!end |
4127 | | - |
4128 | | -!! test |
4129 | | -HTML multiple attributes correction |
4130 | | -!! input |
4131 | | -<p class="error" class="awesome">Awesome!</p> |
4132 | | -!! result |
4133 | | -<p class="awesome">Awesome!</p> |
4134 | | - |
4135 | | -!!end |
4136 | | - |
4137 | | -!! test |
4138 | | -Table multiple attributes correction |
4139 | | -!! input |
4140 | | -{| |
4141 | | -!+ class="error" class="awesome"| status |
4142 | | -|} |
4143 | | -!! result |
4144 | | -<table> |
4145 | | -<tr> |
4146 | | -<th class="awesome"> status |
4147 | | -</th></tr></table> |
4148 | | - |
4149 | | -!!end |
4150 | | - |
4151 | | -!! test |
4152 | | -DIV IN UPPERCASE |
4153 | | -!! input |
4154 | | -<DIV ALIGN="center">HTML ROCKS</DIV> |
4155 | | -!! result |
4156 | | -<div align="center">HTML ROCKS</div> |
4157 | | - |
4158 | | -!!end |
4159 | | - |
4160 | | - |
4161 | | -!! test |
4162 | | -text with amp in the middle of nowhere |
4163 | | -!! input |
4164 | | -Remember AT&T? |
4165 | | -!!result |
4166 | | -<p>Remember AT&T? |
4167 | | -</p> |
4168 | | -!! end |
4169 | | - |
4170 | | -!! test |
4171 | | -text with character entity: eacute |
4172 | | -!! input |
4173 | | -I always thought é was a cute letter. |
4174 | | -!! result |
4175 | | -<p>I always thought é was a cute letter. |
4176 | | -</p> |
4177 | | -!! end |
4178 | | - |
4179 | | -!! test |
4180 | | -text with undefined character entity: xacute |
4181 | | -!! input |
4182 | | -I always thought &xacute; was a cute letter. |
4183 | | -!! result |
4184 | | -<p>I always thought &xacute; was a cute letter. |
4185 | | -</p> |
4186 | | -!! end |
4187 | | - |
4188 | | - |
4189 | | -### |
4190 | | -### Media links |
4191 | | -### |
4192 | | - |
4193 | | -!! test |
4194 | | -Media link |
4195 | | -!! input |
4196 | | -[[Media:Foobar.jpg]] |
4197 | | -!! result |
4198 | | -<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a> |
4199 | | -</p> |
4200 | | -!! end |
4201 | | - |
4202 | | -!! test |
4203 | | -Media link with text |
4204 | | -!! input |
4205 | | -[[Media:Foobar.jpg|A neat file to look at]] |
4206 | | -!! result |
4207 | | -<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a> |
4208 | | -</p> |
4209 | | -!! end |
4210 | | - |
4211 | | -# FIXME: this is still bad HTML tag nesting |
4212 | | -!! test |
4213 | | -Media link with nasty text |
4214 | | -fixme: doBlockLevels won't wrap this in a paragraph because it contains a div |
4215 | | -!! input |
4216 | | -[[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]] |
4217 | | -!! result |
4218 | | -<a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a> |
4219 | | - |
4220 | | -!! end |
4221 | | - |
4222 | | -!! test |
4223 | | -Media link to nonexistent file (bug 1702) |
4224 | | -!! input |
4225 | | -[[Media:No such.jpg]] |
4226 | | -!! result |
4227 | | -<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a> |
4228 | | -</p> |
4229 | | -!! end |
4230 | | - |
4231 | | -!! test |
4232 | | -Image link to nonexistent file (bug 1850 - good) |
4233 | | -!! input |
4234 | | -[[Image:No such.jpg]] |
4235 | | -!! result |
4236 | | -<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a> |
4237 | | -</p> |
4238 | | -!! end |
4239 | | - |
4240 | | -!! test |
4241 | | -:Image link to nonexistent file (bug 1850 - bad) |
4242 | | -!! input |
4243 | | -[[:Image:No such.jpg]] |
4244 | | -!! result |
4245 | | -<p><a href="https://www.mediawiki.org/index.php?title=File:No_such.jpg&action=edit&redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a> |
4246 | | -</p> |
4247 | | -!! end |
4248 | | - |
4249 | | - |
4250 | | - |
4251 | | -!! test |
4252 | | -Character reference normalization in link text (bug 1938) |
4253 | | -!! input |
4254 | | -[[Main Page|this&that]] |
4255 | | -!! result |
4256 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">this&that</a> |
4257 | | -</p> |
4258 | | -!!end |
4259 | | - |
4260 | | -!! article |
4261 | | -אַ |
4262 | | -!! text |
4263 | | -Test for unicode normalization |
4264 | | - |
4265 | | -The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E |
4266 | | -!! endarticle |
4267 | | - |
4268 | | -!! test |
4269 | | -(bug 19451) Links should refer to the normalized form. |
4270 | | -!! input |
4271 | | -[[אַ]] |
4272 | | -[[אַ]] |
4273 | | -[[אַ]] |
4274 | | -[[אַ]] |
4275 | | -[[אַ]] |
4276 | | -!! result |
4277 | | -<p><a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
4278 | | -<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
4279 | | -<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
4280 | | -<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
4281 | | -<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
4282 | | -</p> |
4283 | | -!! end |
4284 | | - |
4285 | | -!! test |
4286 | | -Empty attribute crash test (bug 2067) |
4287 | | -!! input |
4288 | | -<font color="">foo</font> |
4289 | | -!! result |
4290 | | -<p><font color="">foo</font> |
4291 | | -</p> |
4292 | | -!! end |
4293 | | - |
4294 | | -!! test |
4295 | | -Empty attribute crash test single-quotes (bug 2067) |
4296 | | -!! input |
4297 | | -<font color=''>foo</font> |
4298 | | -!! result |
4299 | | -<p><font color="">foo</font> |
4300 | | -</p> |
4301 | | -!! end |
4302 | | - |
4303 | | -!! test |
4304 | | -Attribute test: equals, then nothing |
4305 | | -!! input |
4306 | | -<font color=>foo</font> |
4307 | | -!! result |
4308 | | -<p><font>foo</font> |
4309 | | -</p> |
4310 | | -!! end |
4311 | | - |
4312 | | -!! test |
4313 | | -Attribute test: unquoted value |
4314 | | -!! input |
4315 | | -<font color=x>foo</font> |
4316 | | -!! result |
4317 | | -<p><font color="x">foo</font> |
4318 | | -</p> |
4319 | | -!! end |
4320 | | - |
4321 | | -!! test |
4322 | | -Attribute test: unquoted but illegal value (hash) |
4323 | | -!! input |
4324 | | -<font color=#x>foo</font> |
4325 | | -!! result |
4326 | | -<p><font color="#x">foo</font> |
4327 | | -</p> |
4328 | | -!! end |
4329 | | - |
4330 | | -!! test |
4331 | | -Attribute test: no value |
4332 | | -!! input |
4333 | | -<font color>foo</font> |
4334 | | -!! result |
4335 | | -<p><font color="color">foo</font> |
4336 | | -</p> |
4337 | | -!! end |
4338 | | - |
4339 | | -!! test |
4340 | | -Bug 2095: link with three closing brackets |
4341 | | -!! input |
4342 | | -[[Main Page]]] |
4343 | | -!! result |
4344 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>] |
4345 | | -</p> |
4346 | | -!! end |
4347 | | - |
4348 | | -!! test |
4349 | | -Bug 2095: link with pipe and three closing brackets |
4350 | | -!! input |
4351 | | -[[Main Page|link]]] |
4352 | | -!! result |
4353 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a>] |
4354 | | -</p> |
4355 | | -!! end |
4356 | | - |
4357 | | -!! test |
4358 | | -Bug 2095: link with pipe and three closing brackets, version 2 |
4359 | | -!! input |
4360 | | -[[Main Page|[http://example.com/]]] |
4361 | | -!! result |
4362 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">[http://example.com/]</a> |
4363 | | -</p> |
4364 | | -!! end |
4365 | | - |
4366 | | - |
4367 | | -### |
4368 | | -### Safety |
4369 | | -### |
4370 | | - |
4371 | | -!! article |
4372 | | -Template:Dangerous attribute |
4373 | | -!! text |
4374 | | -" onmouseover="alert(document.cookie) |
4375 | | -!! endarticle |
4376 | | - |
4377 | | -!! article |
4378 | | -Template:Dangerous style attribute |
4379 | | -!! text |
4380 | | -border-size: expression(alert(document.cookie)) |
4381 | | -!! endarticle |
4382 | | - |
4383 | | -!! article |
4384 | | -Template:Div style |
4385 | | -!! text |
4386 | | -<div style="float: right; {{{1}}}">Magic div</div> |
4387 | | -!! endarticle |
4388 | | - |
4389 | | -!! test |
4390 | | -Bug 2304: HTML attribute safety (safe template; regression bug 2309) |
4391 | | -!! input |
4392 | | -<div title="{{test}}"></div> |
4393 | | -!! result |
4394 | | -<div title="This is a test template"></div> |
4395 | | - |
4396 | | -!! end |
4397 | | - |
4398 | | -!! test |
4399 | | -Bug 2304: HTML attribute safety (dangerous template; 2309) |
4400 | | -!! input |
4401 | | -<div title="{{dangerous attribute}}"></div> |
4402 | | -!! result |
4403 | | -<div title=""></div> |
4404 | | - |
4405 | | -!! end |
4406 | | - |
4407 | | -!! test |
4408 | | -Bug 2304: HTML attribute safety (dangerous style template; 2309) |
4409 | | -!! input |
4410 | | -<div style="{{dangerous style attribute}}"></div> |
4411 | | -!! result |
4412 | | -<div style="/* insecure input */"></div> |
4413 | | - |
4414 | | -!! end |
4415 | | - |
4416 | | -!! test |
4417 | | -Bug 2304: HTML attribute safety (safe parameter; 2309) |
4418 | | -!! input |
4419 | | -{{div style|width: 200px}} |
4420 | | -!! result |
4421 | | -<div style="float: right; width: 200px">Magic div</div> |
4422 | | - |
4423 | | -!! end |
4424 | | - |
4425 | | -!! test |
4426 | | -Bug 2304: HTML attribute safety (unsafe parameter; 2309) |
4427 | | -!! input |
4428 | | -{{div style|width: expression(alert(document.cookie))}} |
4429 | | -!! result |
4430 | | -<div style="/* insecure input */">Magic div</div> |
4431 | | - |
4432 | | -!! end |
4433 | | - |
4434 | | -!! test |
4435 | | -Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309) |
4436 | | -!! input |
4437 | | -{{div style|"><script>alert(document.cookie)</script>}} |
4438 | | -!! result |
4439 | | -<div style="float: right;"><script>alert(document.cookie)</script>">Magic div</div> |
4440 | | - |
4441 | | -!! end |
4442 | | - |
4443 | | -!! test |
4444 | | -Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309) |
4445 | | -!! input |
4446 | | -{{div style|" ><script>alert(document.cookie)</script>}} |
4447 | | -!! result |
4448 | | -<div style="float: right;"><script>alert(document.cookie)</script>">Magic div</div> |
4449 | | - |
4450 | | -!! end |
4451 | | - |
4452 | | -!! test |
4453 | | -Bug 2304: HTML attribute safety (link) |
4454 | | -!! input |
4455 | | -<div title="[[Main Page]]"></div> |
4456 | | -!! result |
4457 | | -<div title="[[Main Page]]"></div> |
4458 | | - |
4459 | | -!! end |
4460 | | - |
4461 | | -!! test |
4462 | | -Bug 2304: HTML attribute safety (italics) |
4463 | | -!! input |
4464 | | -<div title="''foobar''"></div> |
4465 | | -!! result |
4466 | | -<div title="''foobar''"></div> |
4467 | | - |
4468 | | -!! end |
4469 | | - |
4470 | | -!! test |
4471 | | -Bug 2304: HTML attribute safety (bold) |
4472 | | -!! input |
4473 | | -<div title="'''foobar'''"></div> |
4474 | | -!! result |
4475 | | -<div title="'''foobar'''"></div> |
4476 | | - |
4477 | | -!! end |
4478 | | - |
4479 | | - |
4480 | | -!! test |
4481 | | -Bug 2304: HTML attribute safety (ISBN) |
4482 | | -!! input |
4483 | | -<div title="ISBN 1234567890"></div> |
4484 | | -!! result |
4485 | | -<div title="ISBN 1234567890"></div> |
4486 | | - |
4487 | | -!! end |
4488 | | - |
4489 | | -!! test |
4490 | | -Bug 2304: HTML attribute safety (RFC) |
4491 | | -!! input |
4492 | | -<div title="RFC 1234"></div> |
4493 | | -!! result |
4494 | | -<div title="RFC 1234"></div> |
4495 | | - |
4496 | | -!! end |
4497 | | - |
4498 | | -!! test |
4499 | | -Bug 2304: HTML attribute safety (PMID) |
4500 | | -!! input |
4501 | | -<div title="PMID 1234567890"></div> |
4502 | | -!! result |
4503 | | -<div title="PMID 1234567890"></div> |
4504 | | - |
4505 | | -!! end |
4506 | | - |
4507 | | -!! test |
4508 | | -Bug 2304: HTML attribute safety (web link) |
4509 | | -!! input |
4510 | | -<div title="http://example.com/"></div> |
4511 | | -!! result |
4512 | | -<div title="http://example.com/"></div> |
4513 | | - |
4514 | | -!! end |
4515 | | - |
4516 | | -!! test |
4517 | | -Bug 2304: HTML attribute safety (named web link) |
4518 | | -!! input |
4519 | | -<div title="[http://example.com/ link]"></div> |
4520 | | -!! result |
4521 | | -<div title="[http://example.com/ link]"></div> |
4522 | | - |
4523 | | -!! end |
4524 | | - |
4525 | | -!! test |
4526 | | -Bug 3244: HTML attribute safety (extension; safe) |
4527 | | -!! input |
4528 | | -<div style="<nowiki>background:blue</nowiki>"></div> |
4529 | | -!! result |
4530 | | -<div style="background:blue"></div> |
4531 | | - |
4532 | | -!! end |
4533 | | - |
4534 | | -!! test |
4535 | | -Bug 3244: HTML attribute safety (extension; unsafe) |
4536 | | -!! input |
4537 | | -<div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div> |
4538 | | -!! result |
4539 | | -<div style="/* insecure input */"></div> |
4540 | | - |
4541 | | -!! end |
4542 | | - |
4543 | | -!! test |
4544 | | -Math section safety when disabled |
4545 | | -!! input |
4546 | | -<math><script>alert(document.cookies);</script></math> |
4547 | | -!! result |
4548 | | -<p><math><script>alert(document.cookies);</script></math> |
4549 | | -</p> |
4550 | | -!! end |
4551 | | - |
4552 | | -# More MSIE fun discovered by Tom Gilder |
4553 | | - |
4554 | | -!! test |
4555 | | -MSIE CSS safety test: spurious slash |
4556 | | -!! input |
4557 | | -<div style="background-image:u\rl(javascript:alert('boo'))">evil</div> |
4558 | | -!! result |
4559 | | -<div style="/* insecure input */">evil</div> |
4560 | | - |
4561 | | -!! end |
4562 | | - |
4563 | | -!! test |
4564 | | -MSIE CSS safety test: hex code |
4565 | | -!! input |
4566 | | -<div style="background-image:u\72l(javascript:alert('boo'))">evil</div> |
4567 | | -!! result |
4568 | | -<div style="/* insecure input */">evil</div> |
4569 | | - |
4570 | | -!! end |
4571 | | - |
4572 | | -!! test |
4573 | | -MSIE CSS safety test: comment in url |
4574 | | -!! input |
4575 | | -<div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div> |
4576 | | -!! result |
4577 | | -<div style="background-image:u rl(javascript:alert('boo'))">evil</div> |
4578 | | - |
4579 | | -!! end |
4580 | | - |
4581 | | -!! test |
4582 | | -MSIE CSS safety test: comment in expression |
4583 | | -!! input |
4584 | | -<div style="background-image:expres/**/sion(alert('boo4'))">evil4</div> |
4585 | | -!! result |
4586 | | -<div style="background-image:expres sion(alert('boo4'))">evil4</div> |
4587 | | - |
4588 | | -!! end |
4589 | | - |
4590 | | - |
4591 | | -!! test |
4592 | | -Table attribute legitimate extension |
4593 | | -!! input |
4594 | | -{| |
4595 | | -!+ style="<nowiki>color:blue</nowiki>"| status |
4596 | | -|} |
4597 | | -!! result |
4598 | | -<table> |
4599 | | -<tr> |
4600 | | -<th style="color:blue"> status |
4601 | | -</th></tr></table> |
4602 | | - |
4603 | | -!!end |
4604 | | - |
4605 | | -!! test |
4606 | | -Table attribute safety |
4607 | | -!! input |
4608 | | -{| |
4609 | | -!+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status |
4610 | | -|} |
4611 | | -!! result |
4612 | | -<table> |
4613 | | -<tr> |
4614 | | -<th style="/* insecure input */"> status |
4615 | | -</th></tr></table> |
4616 | | - |
4617 | | -!! end |
4618 | | - |
4619 | | -!! test |
4620 | | -CSS line continuation 1 |
4621 | | -!! input |
4622 | | -<div style="background-image: u\ rl(test.jpg);"></div> |
4623 | | -!! result |
4624 | | -<div style="/* insecure input */"></div> |
4625 | | - |
4626 | | -!! end |
4627 | | - |
4628 | | -!! test |
4629 | | -CSS line continuation 2 |
4630 | | -!! input |
4631 | | -<div style="background-image: u\ rl(test.jpg); "></div> |
4632 | | -!! result |
4633 | | -<div style="/* insecure input */"></div> |
4634 | | - |
4635 | | -!! end |
4636 | | - |
4637 | | -!! article |
4638 | | -Template:Identity |
4639 | | -!! text |
4640 | | -{{{1}}} |
4641 | | -!! endarticle |
4642 | | - |
4643 | | -!! test |
4644 | | -Expansion of multi-line templates in attribute values (bug 6255) |
4645 | | -!! input |
4646 | | -<div style="background: {{identity|#00FF00}}">-</div> |
4647 | | -!! result |
4648 | | -<div style="background: #00FF00">-</div> |
4649 | | - |
4650 | | -!! end |
4651 | | - |
4652 | | - |
4653 | | -!! test |
4654 | | -Expansion of multi-line templates in attribute values (bug 6255 sanity check) |
4655 | | -!! input |
4656 | | -<div style="background: |
4657 | | -#00FF00">-</div> |
4658 | | -!! result |
4659 | | -<div style="background: #00FF00">-</div> |
4660 | | - |
4661 | | -!! end |
4662 | | - |
4663 | | -!! test |
4664 | | -Expansion of multi-line templates in attribute values (bug 6255 sanity check 2) |
4665 | | -!! input |
4666 | | -<div style="background: #00FF00">-</div> |
4667 | | -!! result |
4668 | | -<div style="background: #00FF00">-</div> |
4669 | | - |
4670 | | -!! end |
4671 | | - |
4672 | | -### |
4673 | | -### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension) |
4674 | | -### |
4675 | | -!! test |
4676 | | -Parser hook: empty input |
4677 | | -!! input |
4678 | | -<tag></tag> |
4679 | | -!! result |
4680 | | -<pre> |
4681 | | -string(0) "" |
4682 | | -array(0) { |
4683 | | -} |
4684 | | -</pre> |
4685 | | - |
4686 | | -!! end |
4687 | | - |
4688 | | -!! test |
4689 | | -Parser hook: empty input using terminated empty elements |
4690 | | -!! input |
4691 | | -<tag/> |
4692 | | -!! result |
4693 | | -<pre> |
4694 | | -NULL |
4695 | | -array(0) { |
4696 | | -} |
4697 | | -</pre> |
4698 | | - |
4699 | | -!! end |
4700 | | - |
4701 | | -!! test |
4702 | | -Parser hook: empty input using terminated empty elements (space before) |
4703 | | -!! input |
4704 | | -<tag /> |
4705 | | -!! result |
4706 | | -<pre> |
4707 | | -NULL |
4708 | | -array(0) { |
4709 | | -} |
4710 | | -</pre> |
4711 | | - |
4712 | | -!! end |
4713 | | - |
4714 | | -!! test |
4715 | | -Parser hook: basic input |
4716 | | -!! input |
4717 | | -<tag>input</tag> |
4718 | | -!! result |
4719 | | -<pre> |
4720 | | -string(5) "input" |
4721 | | -array(0) { |
4722 | | -} |
4723 | | -</pre> |
4724 | | - |
4725 | | -!! end |
4726 | | - |
4727 | | - |
4728 | | -!! test |
4729 | | -Parser hook: case insensitive |
4730 | | -!! input |
4731 | | -<TAG>input</TAG> |
4732 | | -!! result |
4733 | | -<pre> |
4734 | | -string(5) "input" |
4735 | | -array(0) { |
4736 | | -} |
4737 | | -</pre> |
4738 | | - |
4739 | | -!! end |
4740 | | - |
4741 | | - |
4742 | | -!! test |
4743 | | -Parser hook: case insensitive, redux |
4744 | | -!! input |
4745 | | -<TaG>input</TAg> |
4746 | | -!! result |
4747 | | -<pre> |
4748 | | -string(5) "input" |
4749 | | -array(0) { |
4750 | | -} |
4751 | | -</pre> |
4752 | | - |
4753 | | -!! end |
4754 | | - |
4755 | | -!! test |
4756 | | -Parser hook: nested tags |
4757 | | -!! options |
4758 | | -noxml |
4759 | | -!! input |
4760 | | -<tag><tag></tag></tag> |
4761 | | -!! result |
4762 | | -<pre> |
4763 | | -string(5) "<tag>" |
4764 | | -array(0) { |
4765 | | -} |
4766 | | -</pre></tag> |
4767 | | - |
4768 | | -!! end |
4769 | | - |
4770 | | -!! test |
4771 | | -Parser hook: basic arguments |
4772 | | -!! input |
4773 | | -<tag width=200 height = "100" depth = '50' square></tag> |
4774 | | -!! result |
4775 | | -<pre> |
4776 | | -string(0) "" |
4777 | | -array(4) { |
4778 | | - ["width"]=> |
4779 | | - string(3) "200" |
4780 | | - ["height"]=> |
4781 | | - string(3) "100" |
4782 | | - ["depth"]=> |
4783 | | - string(2) "50" |
4784 | | - ["square"]=> |
4785 | | - string(6) "square" |
4786 | | -} |
4787 | | -</pre> |
4788 | | - |
4789 | | -!! end |
4790 | | - |
4791 | | -!! test |
4792 | | -Parser hook: argument containing a forward slash (bug 5344) |
4793 | | -!! input |
4794 | | -<tag filename='/tmp/bla'></tag> |
4795 | | -!! result |
4796 | | -<pre> |
4797 | | -string(0) "" |
4798 | | -array(1) { |
4799 | | - ["filename"]=> |
4800 | | - string(8) "/tmp/bla" |
4801 | | -} |
4802 | | -</pre> |
4803 | | - |
4804 | | -!! end |
4805 | | - |
4806 | | -!! test |
4807 | | -Parser hook: empty input using terminated empty elements (bug 2374) |
4808 | | -!! input |
4809 | | -<tag foo=bar/>text |
4810 | | -!! result |
4811 | | -<pre> |
4812 | | -NULL |
4813 | | -array(1) { |
4814 | | - ["foo"]=> |
4815 | | - string(3) "bar" |
4816 | | -} |
4817 | | -</pre>text |
4818 | | - |
4819 | | -!! end |
4820 | | - |
4821 | | -# </tag> should be output literally since there is no matching tag that begins it |
4822 | | -!! test |
4823 | | -Parser hook: basic arguments using terminated empty elements (bug 2374) |
4824 | | -!! input |
4825 | | -<tag width=200 height = "100" depth = '50' square/> |
4826 | | -other stuff |
4827 | | -</tag> |
4828 | | -!! result |
4829 | | -<pre> |
4830 | | -NULL |
4831 | | -array(4) { |
4832 | | - ["width"]=> |
4833 | | - string(3) "200" |
4834 | | - ["height"]=> |
4835 | | - string(3) "100" |
4836 | | - ["depth"]=> |
4837 | | - string(2) "50" |
4838 | | - ["square"]=> |
4839 | | - string(6) "square" |
4840 | | -} |
4841 | | -</pre> |
4842 | | -<p>other stuff |
4843 | | -</tag> |
4844 | | -</p> |
4845 | | -!! end |
4846 | | - |
4847 | | -### |
4848 | | -### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension) |
4849 | | -### |
4850 | | - |
4851 | | -!! test |
4852 | | -Parser hook: static parser hook not inside a comment |
4853 | | -!! input |
4854 | | -<statictag>hello, world</statictag> |
4855 | | -<statictag action=flush/> |
4856 | | -!! result |
4857 | | -<p>hello, world |
4858 | | -</p> |
4859 | | -!! end |
4860 | | - |
4861 | | - |
4862 | | -!! test |
4863 | | -Parser hook: static parser hook inside a comment |
4864 | | -!! input |
4865 | | -<!-- <statictag>hello, world</statictag> --> |
4866 | | -<statictag action=flush/> |
4867 | | -!! result |
4868 | | -<p><br /> |
4869 | | -</p> |
4870 | | -!! end |
4871 | | - |
4872 | | -# Nested template calls; this case was broken by Parser.php rev 1.506, |
4873 | | -# since reverted. |
4874 | | - |
4875 | | -!! article |
4876 | | -Template:One-parameter |
4877 | | -!! text |
4878 | | -(My parameter is: {{{1}}}) |
4879 | | -!! endarticle |
4880 | | - |
4881 | | -!! article |
4882 | | -Template:Map-one-parameter |
4883 | | -!! text |
4884 | | -{{{{{1}}}|{{{2}}}}} |
4885 | | -!! endarticle |
4886 | | - |
4887 | | -!! test |
4888 | | -Nested template calls |
4889 | | -!! input |
4890 | | -{{Map-one-parameter|One-parameter|param}} |
4891 | | -!! result |
4892 | | -<p>(My parameter is: param) |
4893 | | -</p> |
4894 | | -!! end |
4895 | | - |
4896 | | - |
4897 | | -### |
4898 | | -### Sanitizer |
4899 | | -### |
4900 | | -!! test |
4901 | | -Sanitizer: Closing of open tags |
4902 | | -!! input |
4903 | | -<s></s><table></table> |
4904 | | -!! result |
4905 | | -<s></s><table></table> |
4906 | | - |
4907 | | -!! end |
4908 | | - |
4909 | | -!! test |
4910 | | -Sanitizer: Closing of open but not closed tags |
4911 | | -!! input |
4912 | | -<s>foo |
4913 | | -!! result |
4914 | | -<p><s>foo</s> |
4915 | | -</p> |
4916 | | -!! end |
4917 | | - |
4918 | | -!! test |
4919 | | -Sanitizer: Closing of closed but not open tags |
4920 | | -!! input |
4921 | | -</s> |
4922 | | -!! result |
4923 | | -<p></s> |
4924 | | -</p> |
4925 | | -!! end |
4926 | | - |
4927 | | -!! test |
4928 | | -Sanitizer: Closing of closed but not open table tags |
4929 | | -!! input |
4930 | | -Table not started</td></tr></table> |
4931 | | -!! result |
4932 | | -<p>Table not started</td></tr></table> |
4933 | | -</p> |
4934 | | -!! end |
4935 | | - |
4936 | | -!! test |
4937 | | -Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" |
4938 | | -!! input |
4939 | | -<span id="æ: v">byte</span>[[#æ: v|backlink]] |
4940 | | -!! result |
4941 | | -<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a> |
4942 | | -</p> |
4943 | | -!! end |
4944 | | - |
4945 | | -!! test |
4946 | | -Sanitizer: Validating the contents of the id attribute (bug 4515) |
4947 | | -!! options |
4948 | | -disabled |
4949 | | -!! input |
4950 | | -<br id=9 /> |
4951 | | -!! result |
4952 | | -Something, but definitely not <br id="9" />... |
4953 | | -!! end |
4954 | | - |
4955 | | -!! test |
4956 | | -Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301) |
4957 | | -!! options |
4958 | | -disabled |
4959 | | -!! input |
4960 | | -<br id="foo" /><br id="foo" /> |
4961 | | -!! result |
4962 | | -Something need to be done. foo-2 ? |
4963 | | -!! end |
4964 | | - |
4965 | | -!! test |
4966 | | -Language converter: output gets cut off unexpectedly (bug 5757) |
4967 | | -!! options |
4968 | | -language=zh |
4969 | | -!! input |
4970 | | -this bit is safe: }- |
4971 | | - |
4972 | | -but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}- |
4973 | | - |
4974 | | -then we get cut off here: }- |
4975 | | - |
4976 | | -all additional text is vanished |
4977 | | -!! result |
4978 | | -<p>this bit is safe: }- |
4979 | | -</p><p>but if we add a conversion instance: xxx |
4980 | | -</p><p>then we get cut off here: }- |
4981 | | -</p><p>all additional text is vanished |
4982 | | -</p> |
4983 | | -!! end |
4984 | | - |
4985 | | -!! test |
4986 | | -Self closed html pairs (bug 5487) |
4987 | | -!! options |
4988 | | -!! input |
4989 | | -<center><font id="bug" />Centered text</center> |
4990 | | -<div><font id="bug2" />In div text</div> |
4991 | | -!! result |
4992 | | -<center><font id="bug" />Centered text</center> |
4993 | | -<div><font id="bug2" />In div text</div> |
4994 | | - |
4995 | | -!! end |
4996 | | - |
4997 | | -# |
4998 | | -# |
4999 | | -# |
5000 | | - |
5001 | | -!! test |
5002 | | -Punctuation: nbsp before exclamation |
5003 | | -!! input |
5004 | | -C'est grave ! |
5005 | | -!! result |
5006 | | -<p>C'est grave ! |
5007 | | -</p> |
5008 | | -!! end |
5009 | | - |
5010 | | -!! test |
5011 | | -Punctuation: CSS !important (bug 11874) |
5012 | | -!! input |
5013 | | -<div style="width:50% !important">important</div> |
5014 | | -!! result |
5015 | | -<div style="width:50% !important">important</div> |
5016 | | - |
5017 | | -!!end |
5018 | | - |
5019 | | -!! test |
5020 | | -Punctuation: CSS ! important (bug 11874; with space after) |
5021 | | -!! input |
5022 | | -<div style="width:50% ! important">important</div> |
5023 | | -!! result |
5024 | | -<div style="width:50% ! important">important</div> |
5025 | | - |
5026 | | -!!end |
5027 | | - |
5028 | | - |
5029 | | -!! test |
5030 | | -HTML bullet list, closed tags (bug 5497) |
5031 | | -!! input |
5032 | | -<ul> |
5033 | | -<li>One</li> |
5034 | | -<li>Two</li> |
5035 | | -</ul> |
5036 | | -!! result |
5037 | | -<ul> |
5038 | | -<li>One</li> |
5039 | | -<li>Two</li> |
5040 | | -</ul> |
5041 | | - |
5042 | | -!! end |
5043 | | - |
5044 | | -!! test |
5045 | | -HTML bullet list, unclosed tags (bug 5497) |
5046 | | -!! options |
5047 | | -disabled |
5048 | | -!! input |
5049 | | -<ul> |
5050 | | -<li>One |
5051 | | -<li>Two |
5052 | | -</ul> |
5053 | | -!! result |
5054 | | -<ul> |
5055 | | -<li>One |
5056 | | -</li><li>Two |
5057 | | -</li></ul> |
5058 | | - |
5059 | | -!! end |
5060 | | - |
5061 | | -!! test |
5062 | | -HTML ordered list, closed tags (bug 5497) |
5063 | | -!! input |
5064 | | -<ol> |
5065 | | -<li>One</li> |
5066 | | -<li>Two</li> |
5067 | | -</ol> |
5068 | | -!! result |
5069 | | -<ol> |
5070 | | -<li>One</li> |
5071 | | -<li>Two</li> |
5072 | | -</ol> |
5073 | | - |
5074 | | -!! end |
5075 | | - |
5076 | | -!! test |
5077 | | -HTML ordered list, unclosed tags (bug 5497) |
5078 | | -!! options |
5079 | | -disabled |
5080 | | -!! input |
5081 | | -<ol> |
5082 | | -<li>One |
5083 | | -<li>Two |
5084 | | -</ol> |
5085 | | -!! result |
5086 | | -<ol> |
5087 | | -<li>One |
5088 | | -</li><li>Two |
5089 | | -</li></ol> |
5090 | | - |
5091 | | -!! end |
5092 | | - |
5093 | | -!! test |
5094 | | -HTML nested bullet list, closed tags (bug 5497) |
5095 | | -!! input |
5096 | | -<ul> |
5097 | | -<li>One</li> |
5098 | | -<li>Two: |
5099 | | -<ul> |
5100 | | -<li>Sub-one</li> |
5101 | | -<li>Sub-two</li> |
5102 | | -</ul> |
5103 | | -</li> |
5104 | | -</ul> |
5105 | | -!! result |
5106 | | -<ul> |
5107 | | -<li>One</li> |
5108 | | -<li>Two: |
5109 | | -<ul> |
5110 | | -<li>Sub-one</li> |
5111 | | -<li>Sub-two</li> |
5112 | | -</ul> |
5113 | | -</li> |
5114 | | -</ul> |
5115 | | - |
5116 | | -!! end |
5117 | | - |
5118 | | -!! test |
5119 | | -HTML nested bullet list, open tags (bug 5497) |
5120 | | -!! options |
5121 | | -disabled |
5122 | | -!! input |
5123 | | -<ul> |
5124 | | -<li>One |
5125 | | -<li>Two: |
5126 | | -<ul> |
5127 | | -<li>Sub-one |
5128 | | -<li>Sub-two |
5129 | | -</ul> |
5130 | | -</ul> |
5131 | | -!! result |
5132 | | -<ul> |
5133 | | -<li>One |
5134 | | -</li><li>Two: |
5135 | | -<ul> |
5136 | | -<li>Sub-one |
5137 | | -</li><li>Sub-two |
5138 | | -</li></ul> |
5139 | | -</li></ul> |
5140 | | - |
5141 | | -!! end |
5142 | | - |
5143 | | -!! test |
5144 | | -HTML nested ordered list, closed tags (bug 5497) |
5145 | | -!! input |
5146 | | -<ol> |
5147 | | -<li>One</li> |
5148 | | -<li>Two: |
5149 | | -<ol> |
5150 | | -<li>Sub-one</li> |
5151 | | -<li>Sub-two</li> |
5152 | | -</ol> |
5153 | | -</li> |
5154 | | -</ol> |
5155 | | -!! result |
5156 | | -<ol> |
5157 | | -<li>One</li> |
5158 | | -<li>Two: |
5159 | | -<ol> |
5160 | | -<li>Sub-one</li> |
5161 | | -<li>Sub-two</li> |
5162 | | -</ol> |
5163 | | -</li> |
5164 | | -</ol> |
5165 | | - |
5166 | | -!! end |
5167 | | - |
5168 | | -!! test |
5169 | | -HTML nested ordered list, open tags (bug 5497) |
5170 | | -!! options |
5171 | | -disabled |
5172 | | -!! input |
5173 | | -<ol> |
5174 | | -<li>One |
5175 | | -<li>Two: |
5176 | | -<ol> |
5177 | | -<li>Sub-one |
5178 | | -<li>Sub-two |
5179 | | -</ol> |
5180 | | -</ol> |
5181 | | -!! result |
5182 | | -<ol> |
5183 | | -<li>One |
5184 | | -</li><li>Two: |
5185 | | -<ol> |
5186 | | -<li>Sub-one |
5187 | | -</li><li>Sub-two |
5188 | | -</li></ol> |
5189 | | -</li></ol> |
5190 | | - |
5191 | | -!! end |
5192 | | - |
5193 | | -!! test |
5194 | | -HTML ordered list item with parameters oddity |
5195 | | -!! input |
5196 | | -<ol><li id="fragment">One</li></ol> |
5197 | | -!! result |
5198 | | -<ol><li id="fragment">One</li></ol> |
5199 | | - |
5200 | | -!! end |
5201 | | - |
5202 | | -!!test |
5203 | | -bug 5918: autonumbering |
5204 | | -!! input |
5205 | | -[http://first/] [http://second] [ftp://ftp] |
5206 | | - |
5207 | | -ftp://inlineftp |
5208 | | - |
5209 | | -[mailto:enclosed@mail.tld With target] |
5210 | | - |
5211 | | -[mailto:enclosed@mail.tld] |
5212 | | - |
5213 | | -mailto:inline@mail.tld |
5214 | | -!! result |
5215 | | -<p><a href="http://first/" class="external autonumber" rel="nofollow">[1]</a> <a href="http://second" class="external autonumber" rel="nofollow">[2]</a> <a href="ftp://ftp" class="external autonumber" rel="nofollow">[3]</a> |
5216 | | -</p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a> |
5217 | | -</p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a> |
5218 | | -</p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a> |
5219 | | -</p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a> |
5220 | | -</p> |
5221 | | -!! end |
5222 | | - |
5223 | | - |
5224 | | -# |
5225 | | -# Security and HTML correctness |
5226 | | -# From Nick Jenkins' fuzz testing |
5227 | | -# |
5228 | | - |
5229 | | -!! test |
5230 | | -Fuzz testing: Parser13 |
5231 | | -!! input |
5232 | | -{| |
5233 | | -| http://a| |
5234 | | -!! result |
5235 | | -<table> |
5236 | | -<tr> |
5237 | | -<td> |
5238 | | -</td> |
5239 | | -</tr> |
5240 | | -</table> |
5241 | | - |
5242 | | -!! end |
5243 | | - |
5244 | | -!! test |
5245 | | -Fuzz testing: Parser14 |
5246 | | -!! input |
5247 | | -== onmouseover= == |
5248 | | -http://__TOC__ |
5249 | | -!! result |
5250 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D"> onmouseover= </span></h2> |
5251 | | -http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
5252 | | -<ul> |
5253 | | -<li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li> |
5254 | | -</ul> |
5255 | | -</td></tr></table> |
5256 | | - |
5257 | | -!! end |
5258 | | - |
5259 | | -!! test |
5260 | | -Fuzz testing: Parser14-table |
5261 | | -!! input |
5262 | | -==a== |
5263 | | -{| STYLE=__TOC__ |
5264 | | -!! result |
5265 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2> |
5266 | | -<table style="__TOC__"> |
5267 | | -<tr><td></td></tr> |
5268 | | -</table> |
5269 | | - |
5270 | | -!! end |
5271 | | - |
5272 | | -# Known to produce bogus xml (extra </td>) |
5273 | | -!! test |
5274 | | -Fuzz testing: Parser16 |
5275 | | -!! options |
5276 | | -noxml |
5277 | | -!! input |
5278 | | -{| |
5279 | | -!https://|||||| |
5280 | | -!! result |
5281 | | -<table> |
5282 | | -<tr> |
5283 | | -<th>https://</th> |
5284 | | -<th></th> |
5285 | | -<th></th> |
5286 | | -<th> |
5287 | | -</td> |
5288 | | -</tr> |
5289 | | -</table> |
5290 | | - |
5291 | | -!! end |
5292 | | - |
5293 | | -!! test |
5294 | | -Fuzz testing: Parser21 |
5295 | | -!! input |
5296 | | -{| |
5297 | | -! irc://{{ftp://a" onmouseover="alert('hello world');" |
5298 | | -| |
5299 | | -!! result |
5300 | | -<table> |
5301 | | -<tr> |
5302 | | -<th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');" |
5303 | | -</th> |
5304 | | -<td> |
5305 | | -</td> |
5306 | | -</tr> |
5307 | | -</table> |
5308 | | - |
5309 | | -!! end |
5310 | | - |
5311 | | -!! test |
5312 | | -Fuzz testing: Parser22 |
5313 | | -!! input |
5314 | | -http://===r:::https://b |
5315 | | - |
5316 | | -{| |
5317 | | -!!result |
5318 | | -<p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a> |
5319 | | -</p> |
5320 | | -<table> |
5321 | | -<tr><td></td></tr> |
5322 | | -</table> |
5323 | | - |
5324 | | -!! end |
5325 | | - |
5326 | | -# Known to produce bad XML for now |
5327 | | -!! test |
5328 | | -Fuzz testing: Parser24 |
5329 | | -!! options |
5330 | | -noxml |
5331 | | -!! input |
5332 | | -{| |
5333 | | -{{{| |
5334 | | -<u CLASS= |
5335 | | -| {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} > |
5336 | | -<br style="onmouseover='alert(document.cookie);' " /> |
5337 | | - |
5338 | | -MOVE YOUR MOUSE CURSOR OVER THIS TEXT |
5339 | | -| |
5340 | | -!! result |
5341 | | -<table> |
5342 | | -{{{| |
5343 | | -<u class="|">}}}} > |
5344 | | -<br style="onmouseover='alert(document.cookie);'" /> |
5345 | | - |
5346 | | -MOVE YOUR MOUSE CURSOR OVER THIS TEXT |
5347 | | -<tr> |
5348 | | -<td></u> |
5349 | | -</td> |
5350 | | -</tr> |
5351 | | -</table> |
5352 | | - |
5353 | | -!! end |
5354 | | - |
5355 | | -# Note: the current result listed for this is not what the original one was, |
5356 | | -# but the original bug was JavaScript injection, which is fixed in any case. |
5357 | | -# It's not clear that the original result listed was any more correct than the |
5358 | | -# current one. Original result: |
5359 | | -# <p>{{{| |
5360 | | -# </p> |
5361 | | -# <li class="||"> |
5362 | | -# }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b> |
5363 | | -!!test |
5364 | | -Fuzz testing: Parser25 (bug 6055) |
5365 | | -!! input |
5366 | | -{{{ |
5367 | | -| |
5368 | | -<LI CLASS=|| |
5369 | | - > |
5370 | | -}}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE |
5371 | | -!! result |
5372 | | -<p><LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b> |
5373 | | -</p> |
5374 | | -!! end |
5375 | | - |
5376 | | -!!test |
5377 | | -Fuzz testing: URL adjacent extension (with space, clean) |
5378 | | -!! options |
5379 | | -!! input |
5380 | | -http://example.com <nowiki>junk</nowiki> |
5381 | | -!! result |
5382 | | -<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk |
5383 | | -</p> |
5384 | | -!!end |
5385 | | - |
5386 | | -!!test |
5387 | | -Fuzz testing: URL adjacent extension (no space, dirty; nowiki) |
5388 | | -!! options |
5389 | | -!! input |
5390 | | -http://example.com<nowiki>junk</nowiki> |
5391 | | -!! result |
5392 | | -<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk |
5393 | | -</p> |
5394 | | -!!end |
5395 | | - |
5396 | | -!!test |
5397 | | -Fuzz testing: URL adjacent extension (no space, dirty; pre) |
5398 | | -!! options |
5399 | | -!! input |
5400 | | -http://example.com<pre>junk</pre> |
5401 | | -!! result |
5402 | | -<a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre> |
5403 | | - |
5404 | | -!!end |
5405 | | - |
5406 | | -!!test |
5407 | | -Fuzz testing: image with bogus manual thumbnail |
5408 | | -!!input |
5409 | | -[[Image:foobar.jpg|thumbnail= ]] |
5410 | | -!!result |
5411 | | -<div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div> |
5412 | | - |
5413 | | -!!end |
5414 | | - |
5415 | | -!! test |
5416 | | -Fuzz testing: encoded newline in generated HTML replacements (bug 6577) |
5417 | | -!! input |
5418 | | -<pre dir=" "></pre> |
5419 | | -!! result |
5420 | | -<pre dir=" "></pre> |
5421 | | - |
5422 | | -!! end |
5423 | | - |
5424 | | -!! test |
5425 | | -Parsing optional HTML elements (Bug 6171) |
5426 | | -!! options |
5427 | | -!! input |
5428 | | -<table> |
5429 | | - <tr> |
5430 | | - <td> Some tabular data</td> |
5431 | | - <td> More tabular data ... |
5432 | | - <td> And yet som tabular data</td> |
5433 | | - </tr> |
5434 | | -</table> |
5435 | | -!! result |
5436 | | -<table> |
5437 | | - <tr> |
5438 | | - <td> Some tabular data</td> |
5439 | | - <td> More tabular data ... |
5440 | | - </td><td> And yet som tabular data</td> |
5441 | | - </tr> |
5442 | | -</table> |
5443 | | - |
5444 | | -!! end |
5445 | | - |
5446 | | -!! test |
5447 | | -Correct handling of <td>, <tr> (Bug 6171) |
5448 | | -!! options |
5449 | | -!! input |
5450 | | -<table> |
5451 | | - <tr> |
5452 | | - <td> Some tabular data</td> |
5453 | | - <td> More tabular data ...</td> |
5454 | | - <td> And yet som tabular data</td> |
5455 | | - </tr> |
5456 | | -</table> |
5457 | | -!! result |
5458 | | -<table> |
5459 | | - <tr> |
5460 | | - <td> Some tabular data</td> |
5461 | | - <td> More tabular data ...</td> |
5462 | | - <td> And yet som tabular data</td> |
5463 | | - </tr> |
5464 | | -</table> |
5465 | | - |
5466 | | -!! end |
5467 | | - |
5468 | | - |
5469 | | -!! test |
5470 | | -Parsing crashing regression (fr:JavaScript) |
5471 | | -!! input |
5472 | | -</body></x> |
5473 | | -!! result |
5474 | | -<p></body></x> |
5475 | | -</p> |
5476 | | -!! end |
5477 | | - |
5478 | | -!! test |
5479 | | -Inline wiki vs wiki block nesting |
5480 | | -!! input |
5481 | | -'''Bold paragraph |
5482 | | - |
5483 | | -New wiki paragraph |
5484 | | -!! result |
5485 | | -<p><b>Bold paragraph</b> |
5486 | | -</p><p>New wiki paragraph |
5487 | | -</p> |
5488 | | -!! end |
5489 | | - |
5490 | | -!! test |
5491 | | -Inline HTML vs wiki block nesting |
5492 | | -!! options |
5493 | | -disabled |
5494 | | -!! input |
5495 | | -<b>Bold paragraph |
5496 | | - |
5497 | | -New wiki paragraph |
5498 | | -!! result |
5499 | | -<p><b>Bold paragraph</b> |
5500 | | -</p><p>New wiki paragraph |
5501 | | -</p> |
5502 | | -!! end |
5503 | | - |
5504 | | -# Original result was this: |
5505 | | -# <p><b>bold</b><b>bold<i>bolditalics</i></b> |
5506 | | -# </p> |
5507 | | -# While that might be marginally more intuitive, maybe, the six-apostrophe |
5508 | | -# construct is clearly pathological and the result stated here (which is what |
5509 | | -# the parser actually does) is about as reasonable as anything. |
5510 | | -!!test |
5511 | | -Mixing markup for italics and bold |
5512 | | -!! options |
5513 | | -!! input |
5514 | | -'''bold''''''bold''bolditalics''''' |
5515 | | -!! result |
5516 | | -<p>'<i>bold'</i><b>bold<i>bolditalics</i></b> |
5517 | | -</p> |
5518 | | -!! end |
5519 | | - |
5520 | | - |
5521 | | -!! article |
5522 | | -Xyzzyx |
5523 | | -!! text |
5524 | | -Article for special page transclusion test |
5525 | | -!! endarticle |
5526 | | - |
5527 | | -!! test |
5528 | | -Special page transclusion |
5529 | | -!! options |
5530 | | -!! input |
5531 | | -{{Special:Prefixindex/Xyzzyx}} |
5532 | | -!! result |
5533 | | -<p><br /> |
5534 | | -</p> |
5535 | | -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> |
5536 | | - |
5537 | | -!! end |
5538 | | - |
5539 | | -!! test |
5540 | | -Special page transclusion twice (bug 5021) |
5541 | | -!! options |
5542 | | -!! input |
5543 | | -{{Special:Prefixindex/Xyzzyx}} |
5544 | | -{{Special:Prefixindex/Xyzzyx}} |
5545 | | -!! result |
5546 | | -<p><br /> |
5547 | | -</p> |
5548 | | -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> |
5549 | | -<p><br /> |
5550 | | -</p> |
5551 | | -<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> |
5552 | | - |
5553 | | -!! end |
5554 | | - |
5555 | | -!! test |
5556 | | -Transclusion of default MediaWiki message |
5557 | | -!! input |
5558 | | -{{MediaWiki:Mainpage}} |
5559 | | -!!result |
5560 | | -<p>Main Page |
5561 | | -</p> |
5562 | | -!! end |
5563 | | - |
5564 | | -!! test |
5565 | | -Transclusion of nonexistent MediaWiki message |
5566 | | -!! input |
5567 | | -{{MediaWiki:Mainpagexxx}} |
5568 | | -!!result |
5569 | | -<p><a href="https://www.mediawiki.org/index.php?title=MediaWiki:Mainpagexxx&action=edit&redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a> |
5570 | | -</p> |
5571 | | -!! end |
5572 | | - |
5573 | | -!! test |
5574 | | -Transclusion of MediaWiki message with underscore |
5575 | | -!! input |
5576 | | -{{MediaWiki:history_short}} |
5577 | | -!! result |
5578 | | -<p>History |
5579 | | -</p> |
5580 | | -!! end |
5581 | | - |
5582 | | -!! test |
5583 | | -Transclusion of MediaWiki message with space |
5584 | | -!! input |
5585 | | -{{MediaWiki:history short}} |
5586 | | -!! result |
5587 | | -<p>History |
5588 | | -</p> |
5589 | | -!! end |
5590 | | - |
5591 | | -!! test |
5592 | | -Invalid header with following text |
5593 | | -!! input |
5594 | | -= x = y |
5595 | | -!! result |
5596 | | -<p>= x = y |
5597 | | -</p> |
5598 | | -!! end |
5599 | | - |
5600 | | - |
5601 | | -!! test |
5602 | | -Section extraction test (section 0) |
5603 | | -!! options |
5604 | | -section=0 |
5605 | | -!! input |
5606 | | -start |
5607 | | -==a== |
5608 | | -===aa=== |
5609 | | -====aaa==== |
5610 | | -==b== |
5611 | | -===ba=== |
5612 | | -===bb=== |
5613 | | -====bba==== |
5614 | | -===bc=== |
5615 | | -==c== |
5616 | | -===ca=== |
5617 | | -!! result |
5618 | | -start |
5619 | | -!! end |
5620 | | - |
5621 | | -!! test |
5622 | | -Section extraction test (section 1) |
5623 | | -!! options |
5624 | | -section=1 |
5625 | | -!! input |
5626 | | -start |
5627 | | -==a== |
5628 | | -===aa=== |
5629 | | -====aaa==== |
5630 | | -==b== |
5631 | | -===ba=== |
5632 | | -===bb=== |
5633 | | -====bba==== |
5634 | | -===bc=== |
5635 | | -==c== |
5636 | | -===ca=== |
5637 | | -!! result |
5638 | | -==a== |
5639 | | -===aa=== |
5640 | | -====aaa==== |
5641 | | -!! end |
5642 | | - |
5643 | | -!! test |
5644 | | -Section extraction test (section 2) |
5645 | | -!! options |
5646 | | -section=2 |
5647 | | -!! input |
5648 | | -start |
5649 | | -==a== |
5650 | | -===aa=== |
5651 | | -====aaa==== |
5652 | | -==b== |
5653 | | -===ba=== |
5654 | | -===bb=== |
5655 | | -====bba==== |
5656 | | -===bc=== |
5657 | | -==c== |
5658 | | -===ca=== |
5659 | | -!! result |
5660 | | -===aa=== |
5661 | | -====aaa==== |
5662 | | -!! end |
5663 | | - |
5664 | | -!! test |
5665 | | -Section extraction test (section 3) |
5666 | | -!! options |
5667 | | -section=3 |
5668 | | -!! input |
5669 | | -start |
5670 | | -==a== |
5671 | | -===aa=== |
5672 | | -====aaa==== |
5673 | | -==b== |
5674 | | -===ba=== |
5675 | | -===bb=== |
5676 | | -====bba==== |
5677 | | -===bc=== |
5678 | | -==c== |
5679 | | -===ca=== |
5680 | | -!! result |
5681 | | -====aaa==== |
5682 | | -!! end |
5683 | | - |
5684 | | -!! test |
5685 | | -Section extraction test (section 4) |
5686 | | -!! options |
5687 | | -section=4 |
5688 | | -!! input |
5689 | | -start |
5690 | | -==a== |
5691 | | -===aa=== |
5692 | | -====aaa==== |
5693 | | -==b== |
5694 | | -===ba=== |
5695 | | -===bb=== |
5696 | | -====bba==== |
5697 | | -===bc=== |
5698 | | -==c== |
5699 | | -===ca=== |
5700 | | -!! result |
5701 | | -==b== |
5702 | | -===ba=== |
5703 | | -===bb=== |
5704 | | -====bba==== |
5705 | | -===bc=== |
5706 | | -!! end |
5707 | | - |
5708 | | -!! test |
5709 | | -Section extraction test (section 5) |
5710 | | -!! options |
5711 | | -section=5 |
5712 | | -!! input |
5713 | | -start |
5714 | | -==a== |
5715 | | -===aa=== |
5716 | | -====aaa==== |
5717 | | -==b== |
5718 | | -===ba=== |
5719 | | -===bb=== |
5720 | | -====bba==== |
5721 | | -===bc=== |
5722 | | -==c== |
5723 | | -===ca=== |
5724 | | -!! result |
5725 | | -===ba=== |
5726 | | -!! end |
5727 | | - |
5728 | | -!! test |
5729 | | -Section extraction test (section 6) |
5730 | | -!! options |
5731 | | -section=6 |
5732 | | -!! input |
5733 | | -start |
5734 | | -==a== |
5735 | | -===aa=== |
5736 | | -====aaa==== |
5737 | | -==b== |
5738 | | -===ba=== |
5739 | | -===bb=== |
5740 | | -====bba==== |
5741 | | -===bc=== |
5742 | | -==c== |
5743 | | -===ca=== |
5744 | | -!! result |
5745 | | -===bb=== |
5746 | | -====bba==== |
5747 | | -!! end |
5748 | | - |
5749 | | -!! test |
5750 | | -Section extraction test (section 7) |
5751 | | -!! options |
5752 | | -section=7 |
5753 | | -!! input |
5754 | | -start |
5755 | | -==a== |
5756 | | -===aa=== |
5757 | | -====aaa==== |
5758 | | -==b== |
5759 | | -===ba=== |
5760 | | -===bb=== |
5761 | | -====bba==== |
5762 | | -===bc=== |
5763 | | -==c== |
5764 | | -===ca=== |
5765 | | -!! result |
5766 | | -====bba==== |
5767 | | -!! end |
5768 | | - |
5769 | | -!! test |
5770 | | -Section extraction test (section 8) |
5771 | | -!! options |
5772 | | -section=8 |
5773 | | -!! input |
5774 | | -start |
5775 | | -==a== |
5776 | | -===aa=== |
5777 | | -====aaa==== |
5778 | | -==b== |
5779 | | -===ba=== |
5780 | | -===bb=== |
5781 | | -====bba==== |
5782 | | -===bc=== |
5783 | | -==c== |
5784 | | -===ca=== |
5785 | | -!! result |
5786 | | -===bc=== |
5787 | | -!! end |
5788 | | - |
5789 | | -!! test |
5790 | | -Section extraction test (section 9) |
5791 | | -!! options |
5792 | | -section=9 |
5793 | | -!! input |
5794 | | -start |
5795 | | -==a== |
5796 | | -===aa=== |
5797 | | -====aaa==== |
5798 | | -==b== |
5799 | | -===ba=== |
5800 | | -===bb=== |
5801 | | -====bba==== |
5802 | | -===bc=== |
5803 | | -==c== |
5804 | | -===ca=== |
5805 | | -!! result |
5806 | | -==c== |
5807 | | -===ca=== |
5808 | | -!! end |
5809 | | - |
5810 | | -!! test |
5811 | | -Section extraction test (section 10) |
5812 | | -!! options |
5813 | | -section=10 |
5814 | | -!! input |
5815 | | -start |
5816 | | -==a== |
5817 | | -===aa=== |
5818 | | -====aaa==== |
5819 | | -==b== |
5820 | | -===ba=== |
5821 | | -===bb=== |
5822 | | -====bba==== |
5823 | | -===bc=== |
5824 | | -==c== |
5825 | | -===ca=== |
5826 | | -!! result |
5827 | | -===ca=== |
5828 | | -!! end |
5829 | | - |
5830 | | -!! test |
5831 | | -Section extraction test (nonexistent section 11) |
5832 | | -!! options |
5833 | | -section=11 |
5834 | | -!! input |
5835 | | -start |
5836 | | -==a== |
5837 | | -===aa=== |
5838 | | -====aaa==== |
5839 | | -==b== |
5840 | | -===ba=== |
5841 | | -===bb=== |
5842 | | -====bba==== |
5843 | | -===bc=== |
5844 | | -==c== |
5845 | | -===ca=== |
5846 | | -!! result |
5847 | | -!! end |
5848 | | - |
5849 | | -!! test |
5850 | | -Section extraction test with bogus heading (section 1) |
5851 | | -!! options |
5852 | | -section=1 |
5853 | | -!! input |
5854 | | -==a== |
5855 | | -==bogus== not a legal section |
5856 | | -==b== |
5857 | | -!! result |
5858 | | -==a== |
5859 | | -==bogus== not a legal section |
5860 | | -!! end |
5861 | | - |
5862 | | -!! test |
5863 | | -Section extraction test with bogus heading (section 2) |
5864 | | -!! options |
5865 | | -section=2 |
5866 | | -!! input |
5867 | | -==a== |
5868 | | -==bogus== not a legal section |
5869 | | -==b== |
5870 | | -!! result |
5871 | | -==b== |
5872 | | -!! end |
5873 | | - |
5874 | | -!! test |
5875 | | -Section extraction test with comment after heading (section 1) |
5876 | | -!! options |
5877 | | -section=1 |
5878 | | -!! input |
5879 | | -==a== |
5880 | | -==b== <!-- --> |
5881 | | -==c== |
5882 | | -!! result |
5883 | | -==a== |
5884 | | -!! end |
5885 | | - |
5886 | | -!! test |
5887 | | -Section extraction test with comment after heading (section 2) |
5888 | | -!! options |
5889 | | -section=2 |
5890 | | -!! input |
5891 | | -==a== |
5892 | | -==b== <!-- --> |
5893 | | -==c== |
5894 | | -!! result |
5895 | | -==b== <!-- --> |
5896 | | -!! end |
5897 | | - |
5898 | | -!! test |
5899 | | -Section extraction test with bogus <nowiki> heading (section 1) |
5900 | | -!! options |
5901 | | -section=1 |
5902 | | -!! input |
5903 | | -==a== |
5904 | | -==bogus== <nowiki>not a legal section</nowiki> |
5905 | | -==b== |
5906 | | -!! result |
5907 | | -==a== |
5908 | | -==bogus== <nowiki>not a legal section</nowiki> |
5909 | | -!! end |
5910 | | - |
5911 | | -!! test |
5912 | | -Section extraction test with bogus <nowiki> heading (section 2) |
5913 | | -!! options |
5914 | | -section=2 |
5915 | | -!! input |
5916 | | -==a== |
5917 | | -==bogus== <nowiki>not a legal section</nowiki> |
5918 | | -==b== |
5919 | | -!! result |
5920 | | -==b== |
5921 | | -!! end |
5922 | | - |
5923 | | - |
5924 | | -# Formerly testing for bug 2587, now resolved by the use of unmarked sections |
5925 | | -# instead of respecting commented sections |
5926 | | -!! test |
5927 | | -Section extraction prefixed by comment (section 1) |
5928 | | -!! options |
5929 | | -section=1 |
5930 | | -!! input |
5931 | | -<!-- -->==sec1== |
5932 | | -==sec2== |
5933 | | -!!result |
5934 | | -==sec2== |
5935 | | -!!end |
5936 | | - |
5937 | | -!! test |
5938 | | -Section extraction prefixed by comment (section 2) |
5939 | | -!! options |
5940 | | -section=2 |
5941 | | -!! input |
5942 | | -<!-- -->==sec1== |
5943 | | -==sec2== |
5944 | | -!!result |
5945 | | - |
5946 | | -!!end |
5947 | | - |
5948 | | - |
5949 | | -# Formerly testing for bug 2607, now resolved by the use of unmarked sections |
5950 | | -# instead of respecting HTML-style headings |
5951 | | -!! test |
5952 | | -Section extraction, mixed wiki and html (section 1) |
5953 | | -!! options |
5954 | | -section=1 |
5955 | | -!! input |
5956 | | -<h2>unmarked</h2> |
5957 | | -unmarked |
5958 | | -==1== |
5959 | | -one |
5960 | | -==2== |
5961 | | -two |
5962 | | -!! result |
5963 | | -==1== |
5964 | | -one |
5965 | | -!! end |
5966 | | - |
5967 | | -!! test |
5968 | | -Section extraction, mixed wiki and html (section 2) |
5969 | | -!! options |
5970 | | -section=2 |
5971 | | -!! input |
5972 | | -<h2>unmarked</h2> |
5973 | | -unmarked |
5974 | | -==1== |
5975 | | -one |
5976 | | -==2== |
5977 | | -two |
5978 | | -!! result |
5979 | | -==2== |
5980 | | -two |
5981 | | -!! end |
5982 | | - |
5983 | | - |
5984 | | -# Formerly testing for bug 3342 |
5985 | | -!! test |
5986 | | -Section extraction, heading surrounded by <noinclude> |
5987 | | -!! options |
5988 | | -section=1 |
5989 | | -!! input |
5990 | | -<noinclude>==unmarked==</noinclude> |
5991 | | -==marked== |
5992 | | -!! result |
5993 | | -==marked== |
5994 | | -!!end |
5995 | | - |
5996 | | -# Test behaviour of bug 19910 |
5997 | | -!! test |
5998 | | -Sectiion with all-equals |
5999 | | -!! options |
6000 | | -section=2 |
6001 | | -!! input |
6002 | | -=== |
6003 | | -The line above must have a trailing space |
6004 | | -=== <!-- |
6005 | | -But just in case it doesn't... |
6006 | | -!! result |
6007 | | -=== <!-- |
6008 | | -But just in case it doesn't... |
6009 | | -!! end |
6010 | | - |
6011 | | -!! test |
6012 | | -Section replacement test (section 0) |
6013 | | -!! options |
6014 | | -replace=0,"xxx" |
6015 | | -!! input |
6016 | | -start |
6017 | | -==a== |
6018 | | -===aa=== |
6019 | | -====aaa==== |
6020 | | -==b== |
6021 | | -===ba=== |
6022 | | -===bb=== |
6023 | | -====bba==== |
6024 | | -===bc=== |
6025 | | -==c== |
6026 | | -===ca=== |
6027 | | -!! result |
6028 | | -xxx |
6029 | | - |
6030 | | -==a== |
6031 | | -===aa=== |
6032 | | -====aaa==== |
6033 | | -==b== |
6034 | | -===ba=== |
6035 | | -===bb=== |
6036 | | -====bba==== |
6037 | | -===bc=== |
6038 | | -==c== |
6039 | | -===ca=== |
6040 | | -!! end |
6041 | | - |
6042 | | -!! test |
6043 | | -Section replacement test (section 1) |
6044 | | -!! options |
6045 | | -replace=1,"xxx" |
6046 | | -!! input |
6047 | | -start |
6048 | | -==a== |
6049 | | -===aa=== |
6050 | | -====aaa==== |
6051 | | -==b== |
6052 | | -===ba=== |
6053 | | -===bb=== |
6054 | | -====bba==== |
6055 | | -===bc=== |
6056 | | -==c== |
6057 | | -===ca=== |
6058 | | -!! result |
6059 | | -start |
6060 | | -xxx |
6061 | | - |
6062 | | -==b== |
6063 | | -===ba=== |
6064 | | -===bb=== |
6065 | | -====bba==== |
6066 | | -===bc=== |
6067 | | -==c== |
6068 | | -===ca=== |
6069 | | -!! end |
6070 | | - |
6071 | | -!! test |
6072 | | -Section replacement test (section 2) |
6073 | | -!! options |
6074 | | -replace=2,"xxx" |
6075 | | -!! input |
6076 | | -start |
6077 | | -==a== |
6078 | | -===aa=== |
6079 | | -====aaa==== |
6080 | | -==b== |
6081 | | -===ba=== |
6082 | | -===bb=== |
6083 | | -====bba==== |
6084 | | -===bc=== |
6085 | | -==c== |
6086 | | -===ca=== |
6087 | | -!! result |
6088 | | -start |
6089 | | -==a== |
6090 | | -xxx |
6091 | | - |
6092 | | -==b== |
6093 | | -===ba=== |
6094 | | -===bb=== |
6095 | | -====bba==== |
6096 | | -===bc=== |
6097 | | -==c== |
6098 | | -===ca=== |
6099 | | -!! end |
6100 | | - |
6101 | | -!! test |
6102 | | -Section replacement test (section 3) |
6103 | | -!! options |
6104 | | -replace=3,"xxx" |
6105 | | -!! input |
6106 | | -start |
6107 | | -==a== |
6108 | | -===aa=== |
6109 | | -====aaa==== |
6110 | | -==b== |
6111 | | -===ba=== |
6112 | | -===bb=== |
6113 | | -====bba==== |
6114 | | -===bc=== |
6115 | | -==c== |
6116 | | -===ca=== |
6117 | | -!! result |
6118 | | -start |
6119 | | -==a== |
6120 | | -===aa=== |
6121 | | -xxx |
6122 | | - |
6123 | | -==b== |
6124 | | -===ba=== |
6125 | | -===bb=== |
6126 | | -====bba==== |
6127 | | -===bc=== |
6128 | | -==c== |
6129 | | -===ca=== |
6130 | | -!! end |
6131 | | - |
6132 | | -!! test |
6133 | | -Section replacement test (section 4) |
6134 | | -!! options |
6135 | | -replace=4,"xxx" |
6136 | | -!! input |
6137 | | -start |
6138 | | -==a== |
6139 | | -===aa=== |
6140 | | -====aaa==== |
6141 | | -==b== |
6142 | | -===ba=== |
6143 | | -===bb=== |
6144 | | -====bba==== |
6145 | | -===bc=== |
6146 | | -==c== |
6147 | | -===ca=== |
6148 | | -!! result |
6149 | | -start |
6150 | | -==a== |
6151 | | -===aa=== |
6152 | | -====aaa==== |
6153 | | -xxx |
6154 | | - |
6155 | | -==c== |
6156 | | -===ca=== |
6157 | | -!! end |
6158 | | - |
6159 | | -!! test |
6160 | | -Section replacement test (section 5) |
6161 | | -!! options |
6162 | | -replace=5,"xxx" |
6163 | | -!! input |
6164 | | -start |
6165 | | -==a== |
6166 | | -===aa=== |
6167 | | -====aaa==== |
6168 | | -==b== |
6169 | | -===ba=== |
6170 | | -===bb=== |
6171 | | -====bba==== |
6172 | | -===bc=== |
6173 | | -==c== |
6174 | | -===ca=== |
6175 | | -!! result |
6176 | | -start |
6177 | | -==a== |
6178 | | -===aa=== |
6179 | | -====aaa==== |
6180 | | -==b== |
6181 | | -xxx |
6182 | | - |
6183 | | -===bb=== |
6184 | | -====bba==== |
6185 | | -===bc=== |
6186 | | -==c== |
6187 | | -===ca=== |
6188 | | -!! end |
6189 | | - |
6190 | | -!! test |
6191 | | -Section replacement test (section 6) |
6192 | | -!! options |
6193 | | -replace=6,"xxx" |
6194 | | -!! input |
6195 | | -start |
6196 | | -==a== |
6197 | | -===aa=== |
6198 | | -====aaa==== |
6199 | | -==b== |
6200 | | -===ba=== |
6201 | | -===bb=== |
6202 | | -====bba==== |
6203 | | -===bc=== |
6204 | | -==c== |
6205 | | -===ca=== |
6206 | | -!! result |
6207 | | -start |
6208 | | -==a== |
6209 | | -===aa=== |
6210 | | -====aaa==== |
6211 | | -==b== |
6212 | | -===ba=== |
6213 | | -xxx |
6214 | | - |
6215 | | -===bc=== |
6216 | | -==c== |
6217 | | -===ca=== |
6218 | | -!! end |
6219 | | - |
6220 | | -!! test |
6221 | | -Section replacement test (section 7) |
6222 | | -!! options |
6223 | | -replace=7,"xxx" |
6224 | | -!! input |
6225 | | -start |
6226 | | -==a== |
6227 | | -===aa=== |
6228 | | -====aaa==== |
6229 | | -==b== |
6230 | | -===ba=== |
6231 | | -===bb=== |
6232 | | -====bba==== |
6233 | | -===bc=== |
6234 | | -==c== |
6235 | | -===ca=== |
6236 | | -!! result |
6237 | | -start |
6238 | | -==a== |
6239 | | -===aa=== |
6240 | | -====aaa==== |
6241 | | -==b== |
6242 | | -===ba=== |
6243 | | -===bb=== |
6244 | | -xxx |
6245 | | - |
6246 | | -===bc=== |
6247 | | -==c== |
6248 | | -===ca=== |
6249 | | -!! end |
6250 | | - |
6251 | | -!! test |
6252 | | -Section replacement test (section 8) |
6253 | | -!! options |
6254 | | -replace=8,"xxx" |
6255 | | -!! input |
6256 | | -start |
6257 | | -==a== |
6258 | | -===aa=== |
6259 | | -====aaa==== |
6260 | | -==b== |
6261 | | -===ba=== |
6262 | | -===bb=== |
6263 | | -====bba==== |
6264 | | -===bc=== |
6265 | | -==c== |
6266 | | -===ca=== |
6267 | | -!! result |
6268 | | -start |
6269 | | -==a== |
6270 | | -===aa=== |
6271 | | -====aaa==== |
6272 | | -==b== |
6273 | | -===ba=== |
6274 | | -===bb=== |
6275 | | -====bba==== |
6276 | | -xxx |
6277 | | - |
6278 | | -==c== |
6279 | | -===ca=== |
6280 | | -!!end |
6281 | | - |
6282 | | -!! test |
6283 | | -Section replacement test (section 9) |
6284 | | -!! options |
6285 | | -replace=9,"xxx" |
6286 | | -!! input |
6287 | | -start |
6288 | | -==a== |
6289 | | -===aa=== |
6290 | | -====aaa==== |
6291 | | -==b== |
6292 | | -===ba=== |
6293 | | -===bb=== |
6294 | | -====bba==== |
6295 | | -===bc=== |
6296 | | -==c== |
6297 | | -===ca=== |
6298 | | -!! result |
6299 | | -start |
6300 | | -==a== |
6301 | | -===aa=== |
6302 | | -====aaa==== |
6303 | | -==b== |
6304 | | -===ba=== |
6305 | | -===bb=== |
6306 | | -====bba==== |
6307 | | -===bc=== |
6308 | | -xxx |
6309 | | -!! end |
6310 | | - |
6311 | | -!! test |
6312 | | -Section replacement test (section 10) |
6313 | | -!! options |
6314 | | -replace=10,"xxx" |
6315 | | -!! input |
6316 | | -start |
6317 | | -==a== |
6318 | | -===aa=== |
6319 | | -====aaa==== |
6320 | | -==b== |
6321 | | -===ba=== |
6322 | | -===bb=== |
6323 | | -====bba==== |
6324 | | -===bc=== |
6325 | | -==c== |
6326 | | -===ca=== |
6327 | | -!! result |
6328 | | -start |
6329 | | -==a== |
6330 | | -===aa=== |
6331 | | -====aaa==== |
6332 | | -==b== |
6333 | | -===ba=== |
6334 | | -===bb=== |
6335 | | -====bba==== |
6336 | | -===bc=== |
6337 | | -==c== |
6338 | | -xxx |
6339 | | -!! end |
6340 | | - |
6341 | | -!! test |
6342 | | -Section replacement test with initial whitespace (bug 13728) |
6343 | | -!! options |
6344 | | -replace=2,"xxx" |
6345 | | -!! input |
6346 | | - Preformatted initial line |
6347 | | -==a== |
6348 | | -===a=== |
6349 | | -!! result |
6350 | | - Preformatted initial line |
6351 | | -==a== |
6352 | | -xxx |
6353 | | -!! end |
6354 | | - |
6355 | | - |
6356 | | -!! test |
6357 | | -Section extraction, heading followed by pre with 20 spaces (bug 6398) |
6358 | | -!! options |
6359 | | -section=1 |
6360 | | -!! input |
6361 | | -==a== |
6362 | | - a |
6363 | | -!! result |
6364 | | -==a== |
6365 | | - a |
6366 | | -!! end |
6367 | | - |
6368 | | -!! test |
6369 | | -Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check) |
6370 | | -!! options |
6371 | | -section=1 |
6372 | | -!! input |
6373 | | -==a== |
6374 | | - a |
6375 | | -!! result |
6376 | | -==a== |
6377 | | - a |
6378 | | -!! end |
6379 | | - |
6380 | | - |
6381 | | -!! test |
6382 | | -Section extraction, <pre> around bogus header (bug 10309) |
6383 | | -!! options |
6384 | | -noxml section=2 |
6385 | | -!! input |
6386 | | -== Section One == |
6387 | | -<pre> |
6388 | | -======= |
6389 | | -</pre> |
6390 | | - |
6391 | | -== Section Two == |
6392 | | -stuff |
6393 | | -!! result |
6394 | | -== Section Two == |
6395 | | -stuff |
6396 | | -!! end |
6397 | | - |
6398 | | -!! test |
6399 | | -Section replacement, <pre> around bogus header (bug 10309) |
6400 | | -!! options |
6401 | | -noxml replace=2,"xxx" |
6402 | | -!! input |
6403 | | -== Section One == |
6404 | | -<pre> |
6405 | | -======= |
6406 | | -</pre> |
6407 | | - |
6408 | | -== Section Two == |
6409 | | -stuff |
6410 | | -!! result |
6411 | | -== Section One == |
6412 | | -<pre> |
6413 | | -======= |
6414 | | -</pre> |
6415 | | - |
6416 | | -xxx |
6417 | | -!! end |
6418 | | - |
6419 | | - |
6420 | | - |
6421 | | -!! test |
6422 | | -Handling of 
 in URLs |
6423 | | -!! input |
6424 | | -**irc://
a |
6425 | | -!! result |
6426 | | -<ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a> |
6427 | | -</li></ul> |
6428 | | -</li></ul> |
6429 | | - |
6430 | | -!!end |
6431 | | - |
6432 | | -!! test |
6433 | | -5 quotes, code coverage +1 line |
6434 | | -!! input |
6435 | | -''''' |
6436 | | -!! result |
6437 | | -!! end |
6438 | | - |
6439 | | -!! test |
6440 | | -Special:Search page linking. |
6441 | | -!! input |
6442 | | -{{Special:search}} |
6443 | | -!! result |
6444 | | -<p><a href="https://www.mediawiki.org/wiki/Special:Search" title="Special:Search">Special:Search</a> |
6445 | | -</p> |
6446 | | -!! end |
6447 | | - |
6448 | | -!! test |
6449 | | -Say the magic word |
6450 | | -!! input |
6451 | | -* {{PAGENAME}} |
6452 | | -* {{BASEPAGENAME}} |
6453 | | -* {{SUBPAGENAME}} |
6454 | | -* {{SUBPAGENAMEE}} |
6455 | | -* {{BASEPAGENAME}} |
6456 | | -* {{BASEPAGENAMEE}} |
6457 | | -* {{TALKPAGENAME}} |
6458 | | -* {{TALKPAGENAMEE}} |
6459 | | -* {{SUBJECTPAGENAME}} |
6460 | | -* {{SUBJECTPAGENAMEE}} |
6461 | | -* {{NAMESPACEE}} |
6462 | | -* {{NAMESPACE}} |
6463 | | -* {{TALKSPACE}} |
6464 | | -* {{TALKSPACEE}} |
6465 | | -* {{SUBJECTSPACE}} |
6466 | | -* {{SUBJECTSPACEE}} |
6467 | | -* {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}} |
6468 | | -!! result |
6469 | | -<ul><li> Parser test |
6470 | | -</li><li> Parser test |
6471 | | -</li><li> Parser test |
6472 | | -</li><li> Parser_test |
6473 | | -</li><li> Parser test |
6474 | | -</li><li> Parser_test |
6475 | | -</li><li> Talk:Parser test |
6476 | | -</li><li> Talk:Parser_test |
6477 | | -</li><li> Parser test |
6478 | | -</li><li> Parser_test |
6479 | | -</li><li> |
6480 | | -</li><li> |
6481 | | -</li><li> Talk |
6482 | | -</li><li> Talk |
6483 | | -</li><li> |
6484 | | -</li><li> |
6485 | | -</li><li> <a href="https://www.mediawiki.org/index.php?title=Template:Dynamic&action=edit&redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a> |
6486 | | -</li></ul> |
6487 | | - |
6488 | | -!! end |
6489 | | -### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included. |
6490 | | - |
6491 | | -!! test |
6492 | | -Gallery |
6493 | | -!! input |
6494 | | -<gallery> |
6495 | | -image1.png | |
6496 | | -image2.gif||||| |
6497 | | - |
6498 | | -image3| |
6499 | | -image4 |300px| centre |
6500 | | - image5.svg| http:///////// |
6501 | | -[[x|xx]]]] |
6502 | | -* image6 |
6503 | | -</gallery> |
6504 | | -!! result |
6505 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
6506 | | - <tr> |
6507 | | - <td><div class="gallerybox" style="width: 155px;"> |
6508 | | - <div style="height: 152px;">Image1.png</div> |
6509 | | - <div class="gallerytext"> |
6510 | | - </div> |
6511 | | - </div></td> |
6512 | | - <td><div class="gallerybox" style="width: 155px;"> |
6513 | | - <div style="height: 152px;">Image2.gif</div> |
6514 | | - <div class="gallerytext"> |
6515 | | -<p>|||| |
6516 | | -</p> |
6517 | | - </div> |
6518 | | - </div></td> |
6519 | | - <td><div class="gallerybox" style="width: 155px;"> |
6520 | | - <div style="height: 152px;">Image3</div> |
6521 | | - <div class="gallerytext"> |
6522 | | - </div> |
6523 | | - </div></td> |
6524 | | - <td><div class="gallerybox" style="width: 155px;"> |
6525 | | - <div style="height: 152px;">Image4</div> |
6526 | | - <div class="gallerytext"> |
6527 | | -<p>300px| centre |
6528 | | -</p> |
6529 | | - </div> |
6530 | | - </div></td> |
6531 | | - </tr> |
6532 | | - <tr> |
6533 | | - <td><div class="gallerybox" style="width: 155px;"> |
6534 | | - <div style="height: 152px;">Image5.svg</div> |
6535 | | - <div class="gallerytext"> |
6536 | | -<p><a href="http://///////" class="external free" rel="nofollow">http://///////</a> |
6537 | | -</p> |
6538 | | - </div> |
6539 | | - </div></td> |
6540 | | - <td><div class="gallerybox" style="width: 155px;"> |
6541 | | - <div style="height: 152px;">* image6</div> |
6542 | | - <div class="gallerytext"> |
6543 | | - </div> |
6544 | | - </div></td> |
6545 | | - </tr> |
6546 | | -</table> |
6547 | | - |
6548 | | -!! end |
6549 | | - |
6550 | | -!! test |
6551 | | -Gallery (with options) |
6552 | | -!! input |
6553 | | -<gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' > |
6554 | | -File:Nonexistant.jpg|caption |
6555 | | -File:Nonexistant.jpg |
6556 | | -image:foobar.jpg|some '''caption''' [[Main Page]] |
6557 | | -image:foobar.jpg |
6558 | | -</gallery> |
6559 | | -!! result |
6560 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
6561 | | - <caption>Foo <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></caption> |
6562 | | - <tr> |
6563 | | - <td><div class="gallerybox" style="width: 95px;"> |
6564 | | - <div style="height: 52px;">Nonexistant.jpg</div> |
6565 | | - <div class="gallerytext"> |
6566 | | -<p>caption |
6567 | | -</p> |
6568 | | - </div> |
6569 | | - </div></td> |
6570 | | - <td><div class="gallerybox" style="width: 95px;"> |
6571 | | - <div style="height: 52px;">Nonexistant.jpg</div> |
6572 | | - <div class="gallerytext"> |
6573 | | - </div> |
6574 | | - </div></td> |
6575 | | - </tr> |
6576 | | - <tr> |
6577 | | - <td><div class="gallerybox" style="width: 95px;"> |
6578 | | - <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div> |
6579 | | - <div class="gallerytext"> |
6580 | | -<p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
6581 | | -</p> |
6582 | | - </div> |
6583 | | - </div></td> |
6584 | | - <td><div class="gallerybox" style="width: 95px;"> |
6585 | | - <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div> |
6586 | | - <div class="gallerytext"> |
6587 | | - </div> |
6588 | | - </div></td> |
6589 | | - </tr> |
6590 | | -</table> |
6591 | | - |
6592 | | -!! end |
6593 | | - |
6594 | | -!! test |
6595 | | -gallery (with showfilename option) |
6596 | | -!! input |
6597 | | -<gallery showfilename> |
6598 | | -File:Nonexistant.jpg|caption |
6599 | | -File:Nonexistant.jpg |
6600 | | -image:foobar.jpg|some '''caption''' [[Main Page]] |
6601 | | -File:Foobar.jpg |
6602 | | -</gallery> |
6603 | | -!! result |
6604 | | -<table class="gallery" cellspacing="0" cellpadding="0"> |
6605 | | - <tr> |
6606 | | - <td><div class="gallerybox" style="width: 155px;"> |
6607 | | - <div style="height: 152px;">Nonexistant.jpg</div> |
6608 | | - <div class="gallerytext"> |
6609 | | -<p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> |
6610 | | -caption |
6611 | | -</p> |
6612 | | - </div> |
6613 | | - </div></td> |
6614 | | - <td><div class="gallerybox" style="width: 155px;"> |
6615 | | - <div style="height: 152px;">Nonexistant.jpg</div> |
6616 | | - <div class="gallerytext"> |
6617 | | -<p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> |
6618 | | -</p> |
6619 | | - </div> |
6620 | | - </div></td> |
6621 | | - <td><div class="gallerybox" style="width: 155px;"> |
6622 | | - <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
6623 | | - <div class="gallerytext"> |
6624 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
6625 | | -some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
6626 | | -</p> |
6627 | | - </div> |
6628 | | - </div></td> |
6629 | | - <td><div class="gallerybox" style="width: 155px;"> |
6630 | | - <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
6631 | | - <div class="gallerytext"> |
6632 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
6633 | | -</p> |
6634 | | - </div> |
6635 | | - </div></td> |
6636 | | - </tr> |
6637 | | -</table> |
6638 | | - |
6639 | | -!! end |
6640 | | - |
6641 | | -!! test |
6642 | | -HTML Hex character encoding (spells the word "JavaScript") |
6643 | | -!! input |
6644 | | -JavaScript |
6645 | | -!! result |
6646 | | -<p>JavaScript |
6647 | | -</p> |
6648 | | -!! end |
6649 | | - |
6650 | | -!! test |
6651 | | -__FORCETOC__ override |
6652 | | -!! input |
6653 | | -__NEWSECTIONLINK__ |
6654 | | -__FORCETOC__ |
6655 | | -!! result |
6656 | | -<p><br /> |
6657 | | -</p> |
6658 | | -!! end |
6659 | | - |
6660 | | -!! test |
6661 | | -ISBN code coverage |
6662 | | -!! input |
6663 | | -ISBN 978-0-1234-56 789 |
6664 | | -!! result |
6665 | | -<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789 |
6666 | | -</p> |
6667 | | -!! end |
6668 | | - |
6669 | | -!! test |
6670 | | -ISBN followed by 5 spaces |
6671 | | -!! input |
6672 | | -ISBN |
6673 | | -!! result |
6674 | | -<p>ISBN |
6675 | | -</p> |
6676 | | -!! end |
6677 | | - |
6678 | | -!! test |
6679 | | -Double ISBN |
6680 | | -!! input |
6681 | | -ISBN ISBN 1234567890 |
6682 | | -!! result |
6683 | | -<p>ISBN <a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a> |
6684 | | -</p> |
6685 | | -!! end |
6686 | | - |
6687 | | -!! test |
6688 | | -Bug 22905: <abbr> followed by ISBN followed by </a> |
6689 | | -!! input |
6690 | | -<abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com] |
6691 | | -!! result |
6692 | | -<p><abbr>(fr)</abbr> <a href="https://www.mediawiki.org/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a href="http://www.example.com" class="external text" rel="nofollow">example.com</a> |
6693 | | -</p> |
6694 | | -!! end |
6695 | | - |
6696 | | -!! test |
6697 | | -Double RFC |
6698 | | -!! input |
6699 | | -RFC RFC 1234 |
6700 | | -!! result |
6701 | | -<p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external mw-magiclink-rfc">RFC 1234</a> |
6702 | | -</p> |
6703 | | -!! end |
6704 | | - |
6705 | | -!! test |
6706 | | -Double RFC with a wiki link |
6707 | | -!! input |
6708 | | -RFC [[RFC 1234]] |
6709 | | -!! result |
6710 | | -<p>RFC <a href="https://www.mediawiki.org/index.php?title=RFC_1234&action=edit&redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a> |
6711 | | -</p> |
6712 | | -!! end |
6713 | | - |
6714 | | -!! test |
6715 | | -RFC code coverage |
6716 | | -!! input |
6717 | | -RFC 983 987 |
6718 | | -!! result |
6719 | | -<p><a href="http://tools.ietf.org/html/rfc983" class="external mw-magiclink-rfc">RFC 983</a> 987 |
6720 | | -</p> |
6721 | | -!! end |
6722 | | - |
6723 | | -!! test |
6724 | | -Centre-aligned image |
6725 | | -!! input |
6726 | | -[[Image:foobar.jpg|centre]] |
6727 | | -!! result |
6728 | | -<div class="center"><div class="floatnone"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div> |
6729 | | - |
6730 | | -!!end |
6731 | | - |
6732 | | -!! test |
6733 | | -None-aligned image |
6734 | | -!! input |
6735 | | -[[Image:foobar.jpg|none]] |
6736 | | -!! result |
6737 | | -<div class="floatnone"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> |
6738 | | - |
6739 | | -!!end |
6740 | | - |
6741 | | -!! test |
6742 | | -Width + Height sized image (using px) (height is ignored) |
6743 | | -!! input |
6744 | | -[[Image:foobar.jpg|640x480px]] |
6745 | | -!! result |
6746 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
6747 | | -</p> |
6748 | | -!!end |
6749 | | - |
6750 | | -!! test |
6751 | | -Width-sized image (using px, no following whitespace) |
6752 | | -!! input |
6753 | | -[[Image:foobar.jpg|640px]] |
6754 | | -!! result |
6755 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
6756 | | -</p> |
6757 | | -!!end |
6758 | | - |
6759 | | -!! test |
6760 | | -Width-sized image (using px, with following whitespace - test regression from r39467) |
6761 | | -!! input |
6762 | | -[[Image:foobar.jpg|640px ]] |
6763 | | -!! result |
6764 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
6765 | | -</p> |
6766 | | -!!end |
6767 | | - |
6768 | | -!! test |
6769 | | -Width-sized image (using px, with preceding whitespace - test regression from r39467) |
6770 | | -!! input |
6771 | | -[[Image:foobar.jpg| 640px]] |
6772 | | -!! result |
6773 | | -<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
6774 | | -</p> |
6775 | | -!!end |
6776 | | - |
6777 | | -!! test |
6778 | | -Another italics / bold test |
6779 | | -!! input |
6780 | | - ''' ''x' |
6781 | | -!! result |
6782 | | -<pre>'<i> </i>x' |
6783 | | -</pre> |
6784 | | -!!end |
6785 | | - |
6786 | | -# Note the results may be incorrect, as parserTest output included this: |
6787 | | -# XML error: Mismatched tag at byte 6120: |
6788 | | -# ...<dd> </dt></dl> </dd... |
6789 | | -!! test |
6790 | | -dt/dd/dl test |
6791 | | -!! options |
6792 | | -disabled |
6793 | | -!! input |
6794 | | -:;;;:: |
6795 | | -!! result |
6796 | | -<dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd> |
6797 | | -</dd></dl> |
6798 | | -</dd></dl> |
6799 | | -</dt></dl> |
6800 | | -</dt></dl> |
6801 | | -</dt></dl> |
6802 | | -</dd></dl> |
6803 | | - |
6804 | | -!!end |
6805 | | - |
6806 | | - |
6807 | | -# Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag. |
6808 | | -!! test |
6809 | | -Images with the "|" character in the comment |
6810 | | -!! input |
6811 | | -[[image:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] |
6812 | | -!! result |
6813 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a href="http://test/?param1=%7Cleft%7C&param2=%7Cx" class="external text" rel="nofollow">external</a> URL</div></div></div> |
6814 | | - |
6815 | | -!!end |
6816 | | - |
6817 | | -!! test |
6818 | | -[Before] HTML without raw HTML enabled ($wgRawHtml==false) |
6819 | | -!! input |
6820 | | -<html><script>alert(1);</script></html> |
6821 | | -!! result |
6822 | | -<p><html><script>alert(1);</script></html> |
6823 | | -</p> |
6824 | | -!! end |
6825 | | - |
6826 | | -!! test |
6827 | | -HTML with raw HTML ($wgRawHtml==true) |
6828 | | -!! options |
6829 | | -rawhtml |
6830 | | -!! input |
6831 | | -<html><script>alert(1);</script></html> |
6832 | | -!! result |
6833 | | -<p><script>alert(1);</script> |
6834 | | -</p> |
6835 | | -!! end |
6836 | | - |
6837 | | -!! test |
6838 | | -Parents of subpages, one level up |
6839 | | -!! options |
6840 | | -subpage title=[[Subpage test/L1/L2/L3]] |
6841 | | -!! input |
6842 | | -[[../|L2]] |
6843 | | -!! result |
6844 | | -<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a> |
6845 | | -</p> |
6846 | | -!! end |
6847 | | - |
6848 | | - |
6849 | | -!! test |
6850 | | -Parents of subpages, one level up, not named |
6851 | | -!! options |
6852 | | -subpage title=[[Subpage test/L1/L2/L3]] |
6853 | | -!! input |
6854 | | -[[../]] |
6855 | | -!! result |
6856 | | -<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a> |
6857 | | -</p> |
6858 | | -!! end |
6859 | | - |
6860 | | - |
6861 | | - |
6862 | | -!! test |
6863 | | -Parents of subpages, two levels up |
6864 | | -!! options |
6865 | | -subpage title=[[Subpage test/L1/L2/L3]] |
6866 | | -!! input |
6867 | | -[[../../|L1]]2 |
6868 | | - |
6869 | | -[[../../|L1]]l |
6870 | | -!! result |
6871 | | -<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2 |
6872 | | -</p><p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a> |
6873 | | -</p> |
6874 | | -!! end |
6875 | | - |
6876 | | -!! test |
6877 | | -Parents of subpages, two levels up, without trailing slash or name. |
6878 | | -!! options |
6879 | | -subpage title=[[Subpage test/L1/L2/L3]] |
6880 | | -!! input |
6881 | | -[[../..]] |
6882 | | -!! result |
6883 | | -<p>[[../..]] |
6884 | | -</p> |
6885 | | -!! end |
6886 | | - |
6887 | | -!! test |
6888 | | -Parents of subpages, two levels up, with lots of extra trailing slashes. |
6889 | | -!! options |
6890 | | -subpage title=[[Subpage test/L1/L2/L3]] |
6891 | | -!! input |
6892 | | -[[../../////]] |
6893 | | -!! result |
6894 | | -<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1////&action=edit&redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a> |
6895 | | -</p> |
6896 | | -!! end |
6897 | | - |
6898 | | -!! test |
6899 | | -Definition list code coverage |
6900 | | -!! input |
6901 | | -; title : def |
6902 | | -; title : def |
6903 | | -;title: def |
6904 | | -!! result |
6905 | | -<dl><dt> title  </dt><dd> def |
6906 | | -</dd><dt> title </dt><dd> def |
6907 | | -</dd><dt>title</dt><dd> def |
6908 | | -</dd></dl> |
6909 | | - |
6910 | | -!! end |
6911 | | - |
6912 | | -!! test |
6913 | | -Don't fall for the self-closing div |
6914 | | -!! input |
6915 | | -<div>hello world</div/> |
6916 | | -!! result |
6917 | | -<div>hello world</div> |
6918 | | - |
6919 | | -!! end |
6920 | | - |
6921 | | -!! test |
6922 | | -MSGNW magic word |
6923 | | -!! input |
6924 | | -{{MSGNW:msg}} |
6925 | | -!! result |
6926 | | -<p>[[:Template:Msg]] |
6927 | | -</p> |
6928 | | -!! end |
6929 | | - |
6930 | | -!! test |
6931 | | -RAW magic word |
6932 | | -!! input |
6933 | | -{{RAW:QUERTY}} |
6934 | | -!! result |
6935 | | -<p><a href="https://www.mediawiki.org/index.php?title=Template:QUERTY&action=edit&redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a> |
6936 | | -</p> |
6937 | | -!! end |
6938 | | - |
6939 | | -# This isn't needed for XHTML conformance, but would be handy as a fallback security measure |
6940 | | -!! test |
6941 | | -Always escape literal '>' in output, not just after '<' |
6942 | | -!! input |
6943 | | -><> |
6944 | | -!! result |
6945 | | -<p>><> |
6946 | | -</p> |
6947 | | -!! end |
6948 | | - |
6949 | | -!! test |
6950 | | -Template caching |
6951 | | -!! input |
6952 | | -{{Test}} |
6953 | | -{{Test}} |
6954 | | -!! result |
6955 | | -<p>This is a test template |
6956 | | -This is a test template |
6957 | | -</p> |
6958 | | -!! end |
6959 | | - |
6960 | | - |
6961 | | -!! article |
6962 | | -MediaWiki:Fake |
6963 | | -!! text |
6964 | | -==header== |
6965 | | -!! endarticle |
6966 | | - |
6967 | | -!! test |
6968 | | -Inclusion of !userCanEdit() content |
6969 | | -!! input |
6970 | | -{{MediaWiki:Fake}} |
6971 | | -!! result |
6972 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=MediaWiki:Fake&action=edit&section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2> |
6973 | | - |
6974 | | -!! end |
6975 | | - |
6976 | | - |
6977 | | -!! test |
6978 | | -Out-of-order TOC heading levels |
6979 | | -!! input |
6980 | | -==2== |
6981 | | -======6====== |
6982 | | -===3=== |
6983 | | -=1= |
6984 | | -=====5===== |
6985 | | -==2== |
6986 | | -!! result |
6987 | | -<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
6988 | | -<ul> |
6989 | | -<li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a> |
6990 | | -<ul> |
6991 | | -<li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li> |
6992 | | -<li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li> |
6993 | | -</ul> |
6994 | | -</li> |
6995 | | -<li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a> |
6996 | | -<ul> |
6997 | | -<li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li> |
6998 | | -<li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li> |
6999 | | -</ul> |
7000 | | -</li> |
7001 | | -</ul> |
7002 | | -</td></tr></table> |
7003 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2> |
7004 | | -<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6> |
7005 | | -<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3> |
7006 | | -<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1> |
7007 | | -<h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5> |
7008 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2> |
7009 | | - |
7010 | | -!! end |
7011 | | - |
7012 | | - |
7013 | | -!! test |
7014 | | -ISBN with a dummy number |
7015 | | -!! input |
7016 | | -ISBN --- |
7017 | | -!! result |
7018 | | -<p>ISBN --- |
7019 | | -</p> |
7020 | | -!! end |
7021 | | - |
7022 | | - |
7023 | | -!! test |
7024 | | -ISBN with space-delimited number |
7025 | | -!! input |
7026 | | -ISBN 92 9017 032 8 |
7027 | | -!! result |
7028 | | -<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a> |
7029 | | -</p> |
7030 | | -!! end |
7031 | | - |
7032 | | - |
7033 | | -!! test |
7034 | | -ISBN with multiple spaces, no number |
7035 | | -!! input |
7036 | | -ISBN foo |
7037 | | -!! result |
7038 | | -<p>ISBN foo |
7039 | | -</p> |
7040 | | -!! end |
7041 | | - |
7042 | | - |
7043 | | -!! test |
7044 | | -ISBN length |
7045 | | -!! input |
7046 | | -ISBN 123456789 |
7047 | | - |
7048 | | -ISBN 1234567890 |
7049 | | - |
7050 | | -ISBN 12345678901 |
7051 | | -!! result |
7052 | | -<p>ISBN 123456789 |
7053 | | -</p><p><a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a> |
7054 | | -</p><p>ISBN 12345678901 |
7055 | | -</p> |
7056 | | -!! end |
7057 | | - |
7058 | | - |
7059 | | -!! test |
7060 | | -ISBN with trailing year (bug 8110) |
7061 | | -!! input |
7062 | | -ISBN 1-234-56789-0 - 2006 |
7063 | | - |
7064 | | -ISBN 1 234 56789 0 - 2006 |
7065 | | -!! result |
7066 | | -<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006 |
7067 | | -</p><p><a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006 |
7068 | | -</p> |
7069 | | -!! end |
7070 | | - |
7071 | | - |
7072 | | -!! test |
7073 | | -anchorencode |
7074 | | -!! input |
7075 | | -{{anchorencode:foo bar©#%n}} |
7076 | | -!! result |
7077 | | -<p>foo_bar.C2.A9.23.25n |
7078 | | -</p> |
7079 | | -!! end |
7080 | | - |
7081 | | -!! test |
7082 | | -anchorencode trims spaces |
7083 | | -!! input |
7084 | | -{{anchorencode: __pretty__please__}} |
7085 | | -!! result |
7086 | | -<p>pretty_please |
7087 | | -</p> |
7088 | | -!! end |
7089 | | - |
7090 | | -!! test |
7091 | | -anchorencode deals with links |
7092 | | -!! input |
7093 | | -{{anchorencode: [[hello|world]] [[hi]]}} |
7094 | | -!! result |
7095 | | -<p>world_hi |
7096 | | -</p> |
7097 | | -!! end |
7098 | | - |
7099 | | -!! test |
7100 | | -anchorencode deals with templates |
7101 | | -!! input |
7102 | | -{{anchorencode: {{Foo}} }} |
7103 | | -!! result |
7104 | | -<p>FOO |
7105 | | -</p> |
7106 | | -!! end |
7107 | | - |
7108 | | -!! test |
7109 | | -anchorencode encodes like the TOC generator: (bug 18431) |
7110 | | -!! input |
7111 | | -=== _ +:.3A%3A&&]] === |
7112 | | -{{anchorencode: _ +:.3A%3A&&]] }} |
7113 | | -__NOEDITSECTION__ |
7114 | | -!! result |
7115 | | -<h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&&]] </span></h3> |
7116 | | -<p>.2B:.3A.253A.26.26.5D.5D |
7117 | | -</p> |
7118 | | -!! end |
7119 | | - |
7120 | | -# Expected output in the following test is not necessarily expected (there |
7121 | | -# should probably be <p> tags inside the <blockquote> in the output) -- it's |
7122 | | -# only testing for well-formedness. |
7123 | | -!! test |
7124 | | -Bug 6200: blockquotes and paragraph formatting |
7125 | | -!! input |
7126 | | -<blockquote> |
7127 | | -foo |
7128 | | -</blockquote> |
7129 | | - |
7130 | | -bar |
7131 | | - |
7132 | | - baz |
7133 | | -!! result |
7134 | | -<blockquote> |
7135 | | -foo |
7136 | | -</blockquote> |
7137 | | -<p>bar |
7138 | | -</p> |
7139 | | -<pre>baz |
7140 | | -</pre> |
7141 | | -!! end |
7142 | | - |
7143 | | -!! test |
7144 | | -Bug 8293: Use of center tag ruins paragraph formatting |
7145 | | -!! input |
7146 | | -<center> |
7147 | | -foo |
7148 | | -</center> |
7149 | | - |
7150 | | -bar |
7151 | | - |
7152 | | - baz |
7153 | | -!! result |
7154 | | -<center> |
7155 | | -<p>foo |
7156 | | -</p> |
7157 | | -</center> |
7158 | | -<p>bar |
7159 | | -</p> |
7160 | | -<pre>baz |
7161 | | -</pre> |
7162 | | -!! end |
7163 | | - |
7164 | | - |
7165 | | -### |
7166 | | -### Language variants related tests |
7167 | | -### |
7168 | | -!! test |
7169 | | -Self-link in language variants |
7170 | | -!! options |
7171 | | -title=[[Dunav]] language=sr |
7172 | | -!! input |
7173 | | -Both [[Dunav]] and [[Дунав]] are names for this river. |
7174 | | -!! result |
7175 | | -<p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river. |
7176 | | -</p> |
7177 | | -!!end |
7178 | | - |
7179 | | - |
7180 | | -!! test |
7181 | | -Link to pages in language variants |
7182 | | -!! options |
7183 | | -language=sr |
7184 | | -!! input |
7185 | | -Main Page can be written as [[Маин Паге]] |
7186 | | -!! result |
7187 | | -<p>Main Page can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> |
7188 | | -</p> |
7189 | | -!!end |
7190 | | - |
7191 | | - |
7192 | | -!! test |
7193 | | -Multiple links to pages in language variants |
7194 | | -!! options |
7195 | | -language=sr |
7196 | | -!! input |
7197 | | -[[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]]. |
7198 | | -!! result |
7199 | | -<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a>. |
7200 | | -</p> |
7201 | | -!!end |
7202 | | - |
7203 | | - |
7204 | | -!! test |
7205 | | -Simple template in language variants |
7206 | | -!! options |
7207 | | -language=sr |
7208 | | -!! input |
7209 | | -{{тест}} |
7210 | | -!! result |
7211 | | -<p>This is a test template |
7212 | | -</p> |
7213 | | -!! end |
7214 | | - |
7215 | | - |
7216 | | -!! test |
7217 | | -Template with explicit namespace in language variants |
7218 | | -!! options |
7219 | | -language=sr |
7220 | | -!! input |
7221 | | -{{Template:тест}} |
7222 | | -!! result |
7223 | | -<p>This is a test template |
7224 | | -</p> |
7225 | | -!! end |
7226 | | - |
7227 | | - |
7228 | | -!! test |
7229 | | -Basic test for template parameter in language variants |
7230 | | -!! options |
7231 | | -language=sr |
7232 | | -!! input |
7233 | | -{{парамтест|param=foo}} |
7234 | | -!! result |
7235 | | -<p>This is a test template with parameter foo |
7236 | | -</p> |
7237 | | -!! end |
7238 | | - |
7239 | | - |
7240 | | -!! test |
7241 | | -Simple category in language variants |
7242 | | -!! options |
7243 | | -language=sr cat |
7244 | | -!! input |
7245 | | -[[Category:МедиаWики Усер'с Гуиде]] |
7246 | | -!! result |
7247 | | -<a href="https://www.mediawiki.org/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a> |
7248 | | -!! end |
7249 | | - |
7250 | | - |
7251 | | -!! test |
7252 | | -Stripping -{}- tags (language variants) |
7253 | | -!! options |
7254 | | -language=sr |
7255 | | -!! input |
7256 | | -Latin proverb: -{Ne nuntium necare}- |
7257 | | -!! result |
7258 | | -<p>Latin proverb: Ne nuntium necare |
7259 | | -</p> |
7260 | | -!! end |
7261 | | - |
7262 | | - |
7263 | | -!! test |
7264 | | -Prevent conversion with -{}- tags (language variants) |
7265 | | -!! options |
7266 | | -language=sr variant=sr-ec |
7267 | | -!! input |
7268 | | -Latinski: -{Ne nuntium necare}- |
7269 | | -!! result |
7270 | | -<p>Латински: Ne nuntium necare |
7271 | | -</p> |
7272 | | -!! end |
7273 | | - |
7274 | | - |
7275 | | -!! test |
7276 | | -Prevent conversion of text with -{}- tags (language variants) |
7277 | | -!! options |
7278 | | -language=sr variant=sr-ec |
7279 | | -!! input |
7280 | | -Latinski: -{Ne nuntium necare}- |
7281 | | -!! result |
7282 | | -<p>Латински: Ne nuntium necare |
7283 | | -</p> |
7284 | | -!! end |
7285 | | - |
7286 | | - |
7287 | | -!! test |
7288 | | -Prevent conversion of links with -{}- tags (language variants) |
7289 | | -!! options |
7290 | | -language=sr variant=sr-ec |
7291 | | -!! input |
7292 | | --{[[Main Page]]}- |
7293 | | -!! result |
7294 | | -<p><a href="https://www.mediawiki.org/index.php?title=Main_Page&variant=sr-ec" title="Main Page">Main Page</a> |
7295 | | -</p> |
7296 | | -!! end |
7297 | | - |
7298 | | - |
7299 | | -!! test |
7300 | | --{}- tags within headlines (within html for parserConvert()) |
7301 | | -!! options |
7302 | | -language=sr variant=sr-ec |
7303 | | -!! input |
7304 | | -== -{Naslov}- == |
7305 | | -!! result |
7306 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2> |
7307 | | - |
7308 | | -!! end |
7309 | | - |
7310 | | - |
7311 | | -!! test |
7312 | | -Explicit definition of language variant alternatives |
7313 | | -!! options |
7314 | | -language=zh variant=zh-tw |
7315 | | -!! input |
7316 | | --{zh:China;zh-tw:Taiwan}-, not China |
7317 | | -!! result |
7318 | | -<p>Taiwan, not China |
7319 | | -</p> |
7320 | | -!! end |
7321 | | - |
7322 | | - |
7323 | | -!! test |
7324 | | -Explicit session-wise language variant mapping (A flag and - flag) |
7325 | | -!! options |
7326 | | -language=zh variant=zh-tw |
7327 | | -!! input |
7328 | | -Taiwan is not China. |
7329 | | -But -{A|zh:China;zh-tw:Taiwan}- is China, |
7330 | | -(This-{-|zh:China;zh-tw:Taiwan}- should be stripped!) |
7331 | | -and -{China}- is China. |
7332 | | -!! result |
7333 | | -<p>Taiwan is not China. |
7334 | | -But Taiwan is Taiwan, |
7335 | | -(This should be stripped!) |
7336 | | -and China is China. |
7337 | | -</p> |
7338 | | -!! end |
7339 | | - |
7340 | | -!! test |
7341 | | -Explicit session-wise language variant mapping (H flag for hide) |
7342 | | -!! options |
7343 | | -language=zh variant=zh-tw |
7344 | | -!! input |
7345 | | -(This-{H|zh:China;zh-tw:Taiwan}- should be stripped!) |
7346 | | -Taiwan is China. |
7347 | | -!! result |
7348 | | -<p>(This should be stripped!) |
7349 | | -Taiwan is Taiwan. |
7350 | | -</p> |
7351 | | -!! end |
7352 | | - |
7353 | | -!! test |
7354 | | -Adding explicit conversion rule for title (T flag) |
7355 | | -!! options |
7356 | | -language=zh variant=zh-tw showtitle |
7357 | | -!! input |
7358 | | -Should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
7359 | | -!! result |
7360 | | -Taiwan |
7361 | | -<p>Should be stripped! |
7362 | | -</p> |
7363 | | -!! end |
7364 | | - |
7365 | | -!! test |
7366 | | -Testing that changing the language variant here in the tests actually works |
7367 | | -!! options |
7368 | | -language=zh variant=zh showtitle |
7369 | | -!! input |
7370 | | -Should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
7371 | | -!! result |
7372 | | -China |
7373 | | -<p>Should be stripped! |
7374 | | -</p> |
7375 | | -!! end |
7376 | | - |
7377 | | -!! test |
7378 | | -Bug 24072: more test on conversion rule for title |
7379 | | -!! options |
7380 | | -language=zh variant=zh-tw showtitle |
7381 | | -!! input |
7382 | | -This should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
7383 | | -This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-. |
7384 | | -!! result |
7385 | | -Taiwan |
7386 | | -<p>This should be stripped! |
7387 | | -This won't take interferes with the title rule. |
7388 | | -</p> |
7389 | | -!! end |
7390 | | - |
7391 | | -!! test |
7392 | | -Raw output of variant escape tags (R flag) |
7393 | | -!! options |
7394 | | -language=zh variant=zh-tw |
7395 | | -!! input |
7396 | | -Raw: -{R|zh:China;zh-tw:Taiwan}- |
7397 | | -!! result |
7398 | | -<p>Raw: zh:China;zh-tw:Taiwan |
7399 | | -</p> |
7400 | | -!! end |
7401 | | - |
7402 | | -!! test |
7403 | | -Nested using of manual convert syntax |
7404 | | -!! options |
7405 | | -language=zh variant=zh-hk |
7406 | | -!! input |
7407 | | -Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-! |
7408 | | -!! result |
7409 | | -<p>Nested: Hello Hong Kong! |
7410 | | -</p> |
7411 | | -!! end |
7412 | | - |
7413 | | -!! test |
7414 | | -Do not convert roman numbers to language variants |
7415 | | -!! options |
7416 | | -language=sr variant=sr-ec |
7417 | | -!! input |
7418 | | -Fridrih IV je car. |
7419 | | -!! result |
7420 | | -<p>Фридрих IV је цар. |
7421 | | -</p> |
7422 | | -!! end |
7423 | | - |
7424 | | -!! test |
7425 | | -Unclosed language converter markup "-{" |
7426 | | -!! options |
7427 | | -language=sr |
7428 | | -!! input |
7429 | | --{T|hello |
7430 | | -!! result |
7431 | | -<p>-{T|hello |
7432 | | -</p> |
7433 | | -!! end |
7434 | | - |
7435 | | -!! test |
7436 | | -Don't convert raw rule "-{R|=>}-" to "=>" |
7437 | | -!! options |
7438 | | -language=sr |
7439 | | -!! input |
7440 | | --{R|=>}- |
7441 | | -!! result |
7442 | | -<p>=> |
7443 | | -</p> |
7444 | | -!!end |
7445 | | - |
7446 | | -!!article |
7447 | | -Template:Bullet |
7448 | | -!!text |
7449 | | -* Bar |
7450 | | -!!endarticle |
7451 | | - |
7452 | | -!! test |
7453 | | -Bug 529: Uncovered bullet |
7454 | | -!! input |
7455 | | -* Foo {{bullet}} |
7456 | | -!! result |
7457 | | -<ul><li> Foo |
7458 | | -</li><li> Bar |
7459 | | -</li></ul> |
7460 | | - |
7461 | | -!! end |
7462 | | - |
7463 | | -!! test |
7464 | | -Bug 529: Uncovered table already at line-start |
7465 | | -!! input |
7466 | | -x |
7467 | | - |
7468 | | -{{table}} |
7469 | | -y |
7470 | | -!! result |
7471 | | -<p>x |
7472 | | -</p> |
7473 | | -<table> |
7474 | | -<tr> |
7475 | | -<td> 1 </td> |
7476 | | -<td> 2 |
7477 | | -</td></tr> |
7478 | | -<tr> |
7479 | | -<td> 3 </td> |
7480 | | -<td> 4 |
7481 | | -</td></tr></table> |
7482 | | -<p>y |
7483 | | -</p> |
7484 | | -!! end |
7485 | | - |
7486 | | -!! test |
7487 | | -Bug 529: Uncovered bullet in parser function result |
7488 | | -!! input |
7489 | | -* Foo {{lc:{{bullet}} }} |
7490 | | -!! result |
7491 | | -<ul><li> Foo |
7492 | | -</li><li> bar |
7493 | | -</li></ul> |
7494 | | - |
7495 | | -!! end |
7496 | | - |
7497 | | -!! test |
7498 | | -Bug 5678: Double-parsed template argument |
7499 | | -!! input |
7500 | | -{{lc:{{{1}}}|hello}} |
7501 | | -!! result |
7502 | | -<p>{{{1}}} |
7503 | | -</p> |
7504 | | -!! end |
7505 | | - |
7506 | | -!! test |
7507 | | -Bug 5678: Double-parsed template invocation |
7508 | | -!! input |
7509 | | -{{lc:{{paramtest {{!}} param = hello }} }} |
7510 | | -!! result |
7511 | | -<p>{{paramtest | param = hello }} |
7512 | | -</p> |
7513 | | -!! end |
7514 | | - |
7515 | | -!! test |
7516 | | -Case insensitivity of parser functions for non-ASCII characters (bug 8143) |
7517 | | -!! options |
7518 | | -language=cs |
7519 | | -title=[[Main Page]] |
7520 | | -!! input |
7521 | | -{{PRVNÍVELKÉ:ěščř}} |
7522 | | -{{prvnívelké:ěščř}} |
7523 | | -{{PRVNÍMALÉ:ěščř}} |
7524 | | -{{prvnímalé:ěščř}} |
7525 | | -{{MALÁ:ěščř}} |
7526 | | -{{malá:ěščř}} |
7527 | | -{{VELKÁ:ěščř}} |
7528 | | -{{velká:ěščř}} |
7529 | | -!! result |
7530 | | -<p>Ěščř |
7531 | | -Ěščř |
7532 | | -ěščř |
7533 | | -ěščř |
7534 | | -ěščř |
7535 | | -ěščř |
7536 | | -ĚŠČŘ |
7537 | | -ĚŠČŘ |
7538 | | -</p> |
7539 | | -!! end |
7540 | | - |
7541 | | -!! test |
7542 | | -Morwen/13: Unclosed link followed by heading |
7543 | | -!! input |
7544 | | -[[link |
7545 | | -==heading== |
7546 | | -!! result |
7547 | | -<p>[[link |
7548 | | -</p> |
7549 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2> |
7550 | | - |
7551 | | -!! end |
7552 | | - |
7553 | | -!! test |
7554 | | -HHP2.1: Heuristics for headings in preprocessor parenthetical structures |
7555 | | -!! input |
7556 | | -{{foo| |
7557 | | -=heading= |
7558 | | -!! result |
7559 | | -<p>{{foo| |
7560 | | -</p> |
7561 | | -<h1> <span class="mw-headline" id="heading">heading</span></h1> |
7562 | | - |
7563 | | -!! end |
7564 | | - |
7565 | | -!! test |
7566 | | -HHP2.2: Heuristics for headings in preprocessor parenthetical structures |
7567 | | -!! input |
7568 | | -{{foo| |
7569 | | -==heading== |
7570 | | -!! result |
7571 | | -<p>{{foo| |
7572 | | -</p> |
7573 | | -<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2> |
7574 | | - |
7575 | | -!! end |
7576 | | - |
7577 | | -!! test |
7578 | | -Tildes in comments |
7579 | | -!! options |
7580 | | -pst |
7581 | | -!! input |
7582 | | -<!-- ~~~~ --> |
7583 | | -!! result |
7584 | | -<!-- ~~~~ --> |
7585 | | -!! end |
7586 | | - |
7587 | | -!! test |
7588 | | -Paragraphs inside divs (no extra line breaks) |
7589 | | -!! input |
7590 | | -<div>Line one |
7591 | | - |
7592 | | -Line two</div> |
7593 | | -!! result |
7594 | | -<div>Line one |
7595 | | -Line two</div> |
7596 | | - |
7597 | | -!! end |
7598 | | - |
7599 | | -!! test |
7600 | | -Paragraphs inside divs (extra line break on open) |
7601 | | -!! input |
7602 | | -<div> |
7603 | | -Line one |
7604 | | - |
7605 | | -Line two</div> |
7606 | | -!! result |
7607 | | -<div> |
7608 | | -<p>Line one |
7609 | | -</p> |
7610 | | -Line two</div> |
7611 | | - |
7612 | | -!! end |
7613 | | - |
7614 | | -!! test |
7615 | | -Paragraphs inside divs (extra line break on close) |
7616 | | -!! input |
7617 | | -<div>Line one |
7618 | | - |
7619 | | -Line two |
7620 | | -</div> |
7621 | | -!! result |
7622 | | -<div>Line one |
7623 | | -<p>Line two |
7624 | | -</p> |
7625 | | -</div> |
7626 | | - |
7627 | | -!! end |
7628 | | - |
7629 | | -!! test |
7630 | | -Paragraphs inside divs (extra line break on open and close) |
7631 | | -!! input |
7632 | | -<div> |
7633 | | -Line one |
7634 | | - |
7635 | | -Line two |
7636 | | -</div> |
7637 | | -!! result |
7638 | | -<div> |
7639 | | -<p>Line one |
7640 | | -</p><p>Line two |
7641 | | -</p> |
7642 | | -</div> |
7643 | | - |
7644 | | -!! end |
7645 | | - |
7646 | | -!! test |
7647 | | -Nesting tags, paragraphs on lines which begin with <div> |
7648 | | -!! options |
7649 | | -disabled |
7650 | | -!! input |
7651 | | -<div></div><strong>A |
7652 | | -B</strong> |
7653 | | -!! result |
7654 | | -<div></div> |
7655 | | -<p><strong>A |
7656 | | -B</strong> |
7657 | | -</p> |
7658 | | -!! end |
7659 | | - |
7660 | | -# Bug 6200: <blockquote> should behave like <div> with respect to line breaks |
7661 | | -!! test |
7662 | | -Bug 6200: paragraphs inside blockquotes (no extra line breaks) |
7663 | | -!! options |
7664 | | -disabled |
7665 | | -!! input |
7666 | | -<blockquote>Line one |
7667 | | - |
7668 | | -Line two</blockquote> |
7669 | | -!! result |
7670 | | -<blockquote>Line one |
7671 | | -Line two</blockquote> |
7672 | | - |
7673 | | -!! end |
7674 | | - |
7675 | | -!! test |
7676 | | -Bug 6200: paragraphs inside blockquotes (extra line break on open) |
7677 | | -!! options |
7678 | | -disabled |
7679 | | -!! input |
7680 | | -<blockquote> |
7681 | | -Line one |
7682 | | - |
7683 | | -Line two</blockquote> |
7684 | | -!! result |
7685 | | -<blockquote> |
7686 | | -<p>Line one |
7687 | | -</p> |
7688 | | -Line two</blockquote> |
7689 | | - |
7690 | | -!! end |
7691 | | - |
7692 | | -!! test |
7693 | | -Bug 6200: paragraphs inside blockquotes (extra line break on close) |
7694 | | -!! options |
7695 | | -disabled |
7696 | | -!! input |
7697 | | -<blockquote>Line one |
7698 | | - |
7699 | | -Line two |
7700 | | -</blockquote> |
7701 | | -!! result |
7702 | | -<blockquote>Line one |
7703 | | -<p>Line two |
7704 | | -</p> |
7705 | | -</blockquote> |
7706 | | - |
7707 | | -!! end |
7708 | | - |
7709 | | -!! test |
7710 | | -Bug 6200: paragraphs inside blockquotes (extra line break on open and close) |
7711 | | -!! options |
7712 | | -disabled |
7713 | | -!! input |
7714 | | -<blockquote> |
7715 | | -Line one |
7716 | | - |
7717 | | -Line two |
7718 | | -</blockquote> |
7719 | | -!! result |
7720 | | -<blockquote> |
7721 | | -<p>Line one |
7722 | | -</p><p>Line two |
7723 | | -</p> |
7724 | | -</blockquote> |
7725 | | - |
7726 | | -!! end |
7727 | | - |
7728 | | -!! test |
7729 | | -Paragraphs inside blockquotes/divs (no extra line breaks) |
7730 | | -!! input |
7731 | | -<blockquote><div>Line one |
7732 | | - |
7733 | | -Line two</div></blockquote> |
7734 | | -!! result |
7735 | | -<blockquote><div>Line one |
7736 | | -Line two</div></blockquote> |
7737 | | - |
7738 | | -!! end |
7739 | | - |
7740 | | -!! test |
7741 | | -Paragraphs inside blockquotes/divs (extra line break on open) |
7742 | | -!! input |
7743 | | -<blockquote><div> |
7744 | | -Line one |
7745 | | - |
7746 | | -Line two</div></blockquote> |
7747 | | -!! result |
7748 | | -<blockquote><div> |
7749 | | -<p>Line one |
7750 | | -</p> |
7751 | | -Line two</div></blockquote> |
7752 | | - |
7753 | | -!! end |
7754 | | - |
7755 | | -!! test |
7756 | | -Paragraphs inside blockquotes/divs (extra line break on close) |
7757 | | -!! input |
7758 | | -<blockquote><div>Line one |
7759 | | - |
7760 | | -Line two |
7761 | | -</div></blockquote> |
7762 | | -!! result |
7763 | | -<blockquote><div>Line one |
7764 | | -<p>Line two |
7765 | | -</p> |
7766 | | -</div></blockquote> |
7767 | | - |
7768 | | -!! end |
7769 | | - |
7770 | | -!! test |
7771 | | -Paragraphs inside blockquotes/divs (extra line break on open and close) |
7772 | | -!! input |
7773 | | -<blockquote><div> |
7774 | | -Line one |
7775 | | - |
7776 | | -Line two |
7777 | | -</div></blockquote> |
7778 | | -!! result |
7779 | | -<blockquote><div> |
7780 | | -<p>Line one |
7781 | | -</p><p>Line two |
7782 | | -</p> |
7783 | | -</div></blockquote> |
7784 | | - |
7785 | | -!! end |
7786 | | - |
7787 | | -!! test |
7788 | | -Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion |
7789 | | -!! options |
7790 | | -wgLinkHolderBatchSize=0 |
7791 | | -!! input |
7792 | | -[[meatball:1]] |
7793 | | -[[meatball:2]] |
7794 | | -[[meatball:3]] |
7795 | | -!! result |
7796 | | -<p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a> |
7797 | | -<a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a> |
7798 | | -<a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a> |
7799 | | -</p> |
7800 | | -!! end |
7801 | | - |
7802 | | -!! test |
7803 | | -Free external link invading image caption |
7804 | | -!! input |
7805 | | -[[Image:Foobar.jpg|thumb|http://x|hello]] |
7806 | | -!! result |
7807 | | -<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div> |
7808 | | - |
7809 | | -!! end |
7810 | | - |
7811 | | -!! test |
7812 | | -Bug 15196: localised external link numbers |
7813 | | -!! options |
7814 | | -language=fa |
7815 | | -!! input |
7816 | | -[http://en.wikipedia.org/] |
7817 | | -!! result |
7818 | | -<p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a> |
7819 | | -</p> |
7820 | | -!! end |
7821 | | - |
7822 | | -!! test |
7823 | | -Multibyte character in padleft |
7824 | | -!! input |
7825 | | -{{padleft:-Hello|7|Æ}} |
7826 | | -!! result |
7827 | | -<p>Æ-Hello |
7828 | | -</p> |
7829 | | -!! end |
7830 | | - |
7831 | | -!! test |
7832 | | -Multibyte character in padright |
7833 | | -!! input |
7834 | | -{{padright:Hello-|7|Æ}} |
7835 | | -!! result |
7836 | | -<p>Hello-Æ |
7837 | | -</p> |
7838 | | -!! end |
7839 | | - |
7840 | | -!! test |
7841 | | -Formatted date |
7842 | | -!! config |
7843 | | -wgUseDynamicDates=1 |
7844 | | -!! input |
7845 | | -[[2009-03-24]] |
7846 | | -!! result |
7847 | | -<p><span class="mw-formatted-date" title="2009-03-24"><a href="https://www.mediawiki.org/index.php?title=2009&action=edit&redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="https://www.mediawiki.org/index.php?title=March_24&action=edit&redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span> |
7848 | | -</p> |
7849 | | -!!end |
7850 | | - |
7851 | | -!!test |
7852 | | -formatdate parser function |
7853 | | -!!input |
7854 | | -{{#formatdate:2009-03-24}} |
7855 | | -!! result |
7856 | | -<p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span> |
7857 | | -</p> |
7858 | | -!! end |
7859 | | - |
7860 | | -!!test |
7861 | | -formatdate parser function, with default format |
7862 | | -!!input |
7863 | | -{{#formatdate:2009-03-24|mdy}} |
7864 | | -!! result |
7865 | | -<p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span> |
7866 | | -</p> |
7867 | | -!! end |
7868 | | - |
7869 | | -!! test |
7870 | | -Linked date with autoformatting disabled |
7871 | | -!! config |
7872 | | -wgUseDynamicDates=false |
7873 | | -!! input |
7874 | | -[[2009-03-24]] |
7875 | | -!! result |
7876 | | -<p><a href="https://www.mediawiki.org/index.php?title=2009-03-24&action=edit&redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a> |
7877 | | -</p> |
7878 | | -!! end |
7879 | | - |
7880 | | -!! test |
7881 | | -Spacing of numbers in formatted dates |
7882 | | -!! input |
7883 | | -{{#formatdate:January 15}} |
7884 | | -!! result |
7885 | | -<p><span class="mw-formatted-date" title="01-15">January 15</span> |
7886 | | -</p> |
7887 | | -!! end |
7888 | | - |
7889 | | -!! test |
7890 | | -Spacing of numbers in formatted dates (linked) |
7891 | | -!! config |
7892 | | -wgUseDynamicDates=true |
7893 | | -!! input |
7894 | | -[[January 15]] |
7895 | | -!! result |
7896 | | -<p><span class="mw-formatted-date" title="01-15"><a href="https://www.mediawiki.org/index.php?title=January_15&action=edit&redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span> |
7897 | | -</p> |
7898 | | -!! end |
7899 | | - |
7900 | | -# |
7901 | | -# |
7902 | | -# |
7903 | | - |
7904 | | -# |
7905 | | -# Edit comments |
7906 | | -# |
7907 | | - |
7908 | | -!! test |
7909 | | -Edit comment with link |
7910 | | -!! options |
7911 | | -comment |
7912 | | -!! input |
7913 | | -I like the [[Main Page]] a lot |
7914 | | -!! result |
7915 | | -I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> a lot |
7916 | | -!!end |
7917 | | - |
7918 | | -!! test |
7919 | | -Edit comment with link and link text |
7920 | | -!! options |
7921 | | -comment |
7922 | | -!! input |
7923 | | -I like the [[Main Page|best pages]] a lot |
7924 | | -!! result |
7925 | | -I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">best pages</a> a lot |
7926 | | -!!end |
7927 | | - |
7928 | | -!! test |
7929 | | -Edit comment with link and link text with suffix |
7930 | | -!! options |
7931 | | -comment |
7932 | | -!! input |
7933 | | -I like the [[Main Page|best page]]s a lot |
7934 | | -!! result |
7935 | | -I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">best pages</a> a lot |
7936 | | -!!end |
7937 | | - |
7938 | | -!! test |
7939 | | -Edit comment with section link (non-local, eg in history list) |
7940 | | -!! options |
7941 | | -comment title=[[Main Page]] |
7942 | | -!! input |
7943 | | -/* External links */ removed bogus entries |
7944 | | -!! result |
7945 | | -<span class="autocomment"><a href="https://www.mediawiki.org/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries |
7946 | | -!!end |
7947 | | - |
7948 | | -!! test |
7949 | | -Edit comment with section link (local, eg in diff view) |
7950 | | -!! options |
7951 | | -comment local title=[[Main Page]] |
7952 | | -!! input |
7953 | | -/* External links */ removed bogus entries |
7954 | | -!! result |
7955 | | -<span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries |
7956 | | -!!end |
7957 | | - |
7958 | | -!! test |
7959 | | -Edit comment with subpage link (bug 14080) |
7960 | | -!! options |
7961 | | -comment |
7962 | | -subpage |
7963 | | -title=[[Subpage test]] |
7964 | | -!! input |
7965 | | -Poked at a [[/subpage]] here... |
7966 | | -!! result |
7967 | | -Poked at a <a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here... |
7968 | | -!!end |
7969 | | - |
7970 | | -!! test |
7971 | | -Edit comment with subpage link and link text (bug 14080) |
7972 | | -!! options |
7973 | | -comment |
7974 | | -subpage |
7975 | | -title=[[Subpage test]] |
7976 | | -!! input |
7977 | | -Poked at a [[/subpage|neat little page]] here... |
7978 | | -!! result |
7979 | | -Poked at a <a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here... |
7980 | | -!!end |
7981 | | - |
7982 | | -!! test |
7983 | | -Edit comment with bogus subpage link in non-subpage NS (bug 14080) |
7984 | | -!! options |
7985 | | -comment |
7986 | | -title=[[Subpage test]] |
7987 | | -!! input |
7988 | | -Poked at a [[/subpage]] here... |
7989 | | -!! result |
7990 | | -Poked at a <a href="https://www.mediawiki.org/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here... |
7991 | | -!!end |
7992 | | - |
7993 | | -!! test |
7994 | | -Edit comment with bare anchor link (local, as on diff) |
7995 | | -!! options |
7996 | | -comment |
7997 | | -local |
7998 | | -title=[[Main Page]] |
7999 | | -!!input |
8000 | | -[[#section]] |
8001 | | -!! result |
8002 | | -<a href="#section">#section</a> |
8003 | | -!! end |
8004 | | - |
8005 | | -!! test |
8006 | | -Edit comment with bare anchor link (non-local, as on history) |
8007 | | -!! options |
8008 | | -comment |
8009 | | -title=[[Main Page]] |
8010 | | -!!input |
8011 | | -[[#section]] |
8012 | | -!! result |
8013 | | -<a href="https://www.mediawiki.org/wiki/Main_Page#section" title="Main Page">#section</a> |
8014 | | -!! end |
8015 | | - |
8016 | | -!! test |
8017 | | -Space normalisation on autocomment (bug 22784) |
8018 | | -!! options |
8019 | | -comment |
8020 | | -title=[[Main Page]] |
8021 | | -!!input |
8022 | | -/* __hello__world__ */ |
8023 | | -!! result |
8024 | | -<span class="autocomment"><a href="https://www.mediawiki.org/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span> |
8025 | | -!! end |
8026 | | - |
8027 | | -!! test |
8028 | | -Bad images - basic functionality |
8029 | | -!! input |
8030 | | -[[File:Bad.jpg]] |
8031 | | -!! result |
8032 | | -!! end |
8033 | | - |
8034 | | -!! test |
8035 | | -Bad images - bug 16039: text after bad image disappears |
8036 | | -!! input |
8037 | | -Foo bar |
8038 | | -[[File:Bad.jpg]] |
8039 | | -Bar foo |
8040 | | -!! result |
8041 | | -<p>Foo bar |
8042 | | -</p><p>Bar foo |
8043 | | -</p> |
8044 | | -!! end |
8045 | | - |
8046 | | -!! test |
8047 | | -Verify that displaytitle works (bug #22501) no displaytitle |
8048 | | -!! options |
8049 | | -showtitle |
8050 | | -!! config |
8051 | | -wgAllowDisplayTitle=true |
8052 | | -wgRestrictDisplayTitle=false |
8053 | | -!! input |
8054 | | -this is not the the title |
8055 | | -!! result |
8056 | | -Parser test |
8057 | | -<p>this is not the the title |
8058 | | -</p> |
8059 | | -!! end |
8060 | | - |
8061 | | -!! test |
8062 | | -Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false |
8063 | | -!! options |
8064 | | -showtitle |
8065 | | -title=[[Screen]] |
8066 | | -!! config |
8067 | | -wgAllowDisplayTitle=true |
8068 | | -wgRestrictDisplayTitle=false |
8069 | | -!! input |
8070 | | -this is not the the title |
8071 | | -{{DISPLAYTITLE:whatever}} |
8072 | | -!! result |
8073 | | -whatever |
8074 | | -<p>this is not the the title |
8075 | | -</p> |
8076 | | -!! end |
8077 | | - |
8078 | | -!! test |
8079 | | -Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch |
8080 | | -!! options |
8081 | | -showtitle |
8082 | | -title=[[Screen]] |
8083 | | -!! config |
8084 | | -wgAllowDisplayTitle=true |
8085 | | -wgRestrictDisplayTitle=true |
8086 | | -!! input |
8087 | | -this is not the the title |
8088 | | -{{DISPLAYTITLE:whatever}} |
8089 | | -!! result |
8090 | | -Screen |
8091 | | -<p>this is not the the title |
8092 | | -</p> |
8093 | | -!! end |
8094 | | - |
8095 | | -!! test |
8096 | | -Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching |
8097 | | -!! options |
8098 | | -showtitle |
8099 | | -title=[[Screen]] |
8100 | | -!! config |
8101 | | -wgAllowDisplayTitle=true |
8102 | | -wgRestrictDisplayTitle=true |
8103 | | -!! input |
8104 | | -this is not the the title |
8105 | | -{{DISPLAYTITLE:screen}} |
8106 | | -!! result |
8107 | | -screen |
8108 | | -<p>this is not the the title |
8109 | | -</p> |
8110 | | -!! end |
8111 | | - |
8112 | | -!! test |
8113 | | -Verify that displaytitle works (bug #22501) AllowDisplayTitle=false |
8114 | | -!! options |
8115 | | -showtitle |
8116 | | -title=[[Screen]] |
8117 | | -!! config |
8118 | | -wgAllowDisplayTitle=false |
8119 | | -!! input |
8120 | | -this is not the the title |
8121 | | -{{DISPLAYTITLE:screen}} |
8122 | | -!! result |
8123 | | -Screen |
8124 | | -<p>this is not the the title |
8125 | | -<a href="https://www.mediawiki.org/index.php?title=Template:DISPLAYTITLE:screen&action=edit&redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a> |
8126 | | -</p> |
8127 | | -!! end |
8128 | | - |
8129 | | -!! test |
8130 | | -Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE |
8131 | | -!! options |
8132 | | -showtitle |
8133 | | -title=[[Screen]] |
8134 | | -!! config |
8135 | | -wgAllowDisplayTitle=false |
8136 | | -!! input |
8137 | | -this is not the the title |
8138 | | -!! result |
8139 | | -Screen |
8140 | | -<p>this is not the the title |
8141 | | -</p> |
8142 | | -!! end |
8143 | | - |
8144 | | -!! test |
8145 | | -preload: check <noinclude> and <includeonly> |
8146 | | -!! options |
8147 | | -preload |
8148 | | -!! input |
8149 | | -Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world. |
8150 | | -!! result |
8151 | | -Hello kind world. |
8152 | | -!! end |
8153 | | - |
8154 | | -!! test |
8155 | | -preload: check <onlyinclude> |
8156 | | -!! options |
8157 | | -preload |
8158 | | -!! input |
8159 | | -Goodbye <onlyinclude>Hello world</onlyinclude> |
8160 | | -!! result |
8161 | | -Hello world |
8162 | | -!! end |
8163 | | - |
8164 | | -!! test |
8165 | | -preload: can pass tags through if we want to |
8166 | | -!! options |
8167 | | -preload |
8168 | | -!! input |
8169 | | -<includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly> |
8170 | | -!! result |
8171 | | -<includeonly>Hello world</includeonly> |
8172 | | -!! end |
8173 | | - |
8174 | | -!! test |
8175 | | -preload: check that it doesn't try to do tricks |
8176 | | -!! options |
8177 | | -preload |
8178 | | -!! input |
8179 | | -* <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}} |
8180 | | -!! result |
8181 | | -* <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}} |
8182 | | -!! end |
8183 | | - |
8184 | | -!! test |
8185 | | -Play a bit with r67090 and bug 3158 |
8186 | | -!! options |
8187 | | -disabled |
8188 | | -!! input |
8189 | | -<div style="width:50% !important"> </div> |
8190 | | -<div style="width:50% !important"> </div> |
8191 | | -<div style="width:50% !important"> </div> |
8192 | | -<div style="border : solid;"> </div> |
8193 | | -!! result |
8194 | | -<div style="width:50% !important"> </div> |
8195 | | -<div style="width:50% !important"> </div> |
8196 | | -<div style="width:50% !important"> </div> |
8197 | | -<div style="border : solid;"> </div> |
8198 | | - |
8199 | | -!! end |
8200 | | - |
8201 | | -!! test |
8202 | | -HTML5 data attributes |
8203 | | -!! input |
8204 | | -<span data-foo="bar">Baz</span> |
8205 | | -<p data-abc-def_hij="">Quuz</p> |
8206 | | -!! result |
8207 | | -<p><span data-foo="bar">Baz</span> |
8208 | | -</p> |
8209 | | -<p data-abc-def_hij="">Quuz</p> |
8210 | | - |
8211 | | -!! end |
8212 | | - |
8213 | | - |
8214 | | -TODO: |
8215 | | -more images |
8216 | | -more tables |
8217 | | -math |
8218 | | -character entities |
8219 | | -and much more |
8220 | | -Try for 100% code coverage |
Index: trunk/phase3/maintenance/ExtraParserTests.txt |
— | — | @@ -1,51 +0,0 @@ |
2 | | -# This is another parserTest file. |
3 | | -# Parser tests should go to ParserTests.txt |
4 | | -# This one got exiliated here because its broken character |
5 | | -# a) Already lost this test for years when removed on r12975 |
6 | | -# b) Some text editors choke in the whole file due to the character |
7 | | - |
8 | | -!! test |
9 | | -External links: invalid character NUL |
10 | | -!! options |
11 | | -noxml |
12 | | -preprocessor=Preprocessor_Hash |
13 | | -!! input |
14 | | -[http://www.example.com test] |
15 | | -!! result |
16 | | -<p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> test] |
17 | | -</p> |
18 | | -!! end |
19 | | - |
20 | | -!! test |
21 | | -External links: invalid character backspace |
22 | | -!! options |
23 | | -noxml |
24 | | -preprocessor=Preprocessor_Hash |
25 | | -!! input |
26 | | -[http://www.example.com test] |
27 | | -!! result |
28 | | -<p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> test] |
29 | | -</p> |
30 | | -!! end |
31 | | - |
32 | | - |
33 | | -!! test |
34 | | -Magic link: invalid character |
35 | | -!! options |
36 | | -noxml |
37 | | -preprocessor=Preprocessor_Hash |
38 | | -!! input |
39 | | -http://www.example.com |
40 | | -!! result |
41 | | -<p><a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> |
42 | | -</p> |
43 | | -!! end |
44 | | - |
45 | | -!! test |
46 | | -External links: tab character |
47 | | -!! input |
48 | | -[http://www.example.com Alice in Wonderland] |
49 | | -!! result |
50 | | -<p><a href="http://www.example.com" class="external text" rel="nofollow">Alice in Wonderland</a> |
51 | | -</p> |
52 | | -!! end |
Index: trunk/phase3/maintenance/parserTestsStaticParserHook.php |
— | — | @@ -1,58 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * A basic extension that's used by the parser tests to test whether the parser |
5 | | - * calls extensions when they're called inside comments, it shouldn't do that |
6 | | - * |
7 | | - * Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason |
8 | | - * |
9 | | - * This program is free software; you can redistribute it and/or modify |
10 | | - * it under the terms of the GNU General Public License as published by |
11 | | - * the Free Software Foundation; either version 2 of the License, or |
12 | | - * (at your option) any later version. |
13 | | - * |
14 | | - * This program is distributed in the hope that it will be useful, |
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | | - * GNU General Public License for more details. |
18 | | - * |
19 | | - * You should have received a copy of the GNU General Public License along |
20 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
21 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
22 | | - * http://www.gnu.org/copyleft/gpl.html |
23 | | - * |
24 | | - * @file |
25 | | - * @ingroup Maintenance |
26 | | - * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
27 | | - */ |
28 | | - |
29 | | -class ParserTestStaticParserHook { |
30 | | - static function setup( &$parser ) { |
31 | | - $parser->setHook( 'statictag', array( __CLASS__, 'hook' ) ); |
32 | | - |
33 | | - return true; |
34 | | - } |
35 | | - |
36 | | - static function hook( $in, $argv, $parser ) { |
37 | | - if ( ! count( $argv ) ) { |
38 | | - $parser->static_tag_buf = $in; |
39 | | - return ''; |
40 | | - } else if ( count( $argv ) === 1 && isset( $argv['action'] ) |
41 | | - && $argv['action'] === 'flush' && $in === null ) |
42 | | - { |
43 | | - // Clear the buffer, we probably don't need to |
44 | | - if ( isset( $parser->static_tag_buf ) ) { |
45 | | - $tmp = $parser->static_tag_buf; |
46 | | - } else { |
47 | | - $tmp = ''; |
48 | | - } |
49 | | - $parser->static_tag_buf = null; |
50 | | - return $tmp; |
51 | | - } else |
52 | | - // wtf? |
53 | | - return |
54 | | - "\nCall this extension as <statictag>string</statictag> or as" . |
55 | | - " <statictag action=flush/>, not in any other way.\n" . |
56 | | - "text: " . var_export( $in, true ) . "\n" . |
57 | | - "argv: " . var_export( $argv, true ) . "\n"; |
58 | | - } |
59 | | -} |
Index: trunk/phase3/maintenance/parserTestsParserHook.php |
— | — | @@ -1,46 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * A basic extension that's used by the parser tests to test whether input and |
5 | | - * arguments are passed to extensions properly. |
6 | | - * |
7 | | - * Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason |
8 | | - * |
9 | | - * This program is free software; you can redistribute it and/or modify |
10 | | - * it under the terms of the GNU General Public License as published by |
11 | | - * the Free Software Foundation; either version 2 of the License, or |
12 | | - * (at your option) any later version. |
13 | | - * |
14 | | - * This program is distributed in the hope that it will be useful, |
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | | - * GNU General Public License for more details. |
18 | | - * |
19 | | - * You should have received a copy of the GNU General Public License along |
20 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
21 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
22 | | - * http://www.gnu.org/copyleft/gpl.html |
23 | | - * |
24 | | - * @file |
25 | | - * @ingroup Maintenance |
26 | | - * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
27 | | - */ |
28 | | - |
29 | | -class ParserTestParserHook { |
30 | | - |
31 | | - static function setup( &$parser ) { |
32 | | - $parser->setHook( 'tag', array( __CLASS__, 'hook' ) ); |
33 | | - |
34 | | - return true; |
35 | | - } |
36 | | - |
37 | | - static function hook( $in, $argv ) { |
38 | | - ob_start(); |
39 | | - var_dump( |
40 | | - $in, |
41 | | - $argv |
42 | | - ); |
43 | | - $ret = ob_get_clean(); |
44 | | - |
45 | | - return "<pre>\n$ret</pre>"; |
46 | | - } |
47 | | -} |
Index: trunk/phase3/maintenance/tests/parserTests.php |
— | — | @@ -0,0 +1,90 @@ |
| 2 | +<?php |
| 3 | +# Copyright (C) 2004 Brion Vibber <brion@pobox.com> |
| 4 | +# http://www.mediawiki.org/ |
| 5 | +# |
| 6 | +# This program is free software; you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU General Public License as published by |
| 8 | +# the Free Software Foundation; either version 2 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# This program is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU General Public License along |
| 17 | +# with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | +# http://www.gnu.org/copyleft/gpl.html |
| 20 | + |
| 21 | +/** |
| 22 | + * @file |
| 23 | + * @ingroup Maintenance |
| 24 | + */ |
| 25 | + |
| 26 | +$options = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record', 'run-disabled' ); |
| 27 | +$optionsWithArgs = array( 'regex', 'seed', 'setversion' ); |
| 28 | + |
| 29 | +require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); |
| 30 | + |
| 31 | +if ( isset( $options['help'] ) ) { |
| 32 | + echo <<<ENDS |
| 33 | +MediaWiki $wgVersion parser test suite |
| 34 | +Usage: php parserTests.php [options...] |
| 35 | + |
| 36 | +Options: |
| 37 | + --quick Suppress diff output of failed tests |
| 38 | + --quiet Suppress notification of passed tests (shows only failed tests) |
| 39 | + --show-output Show expected and actual output |
| 40 | + --color[=yes|no] Override terminal detection and force color output on or off |
| 41 | + use wgCommandLineDarkBg = true; if your term is dark |
| 42 | + --regex Only run tests whose descriptions which match given regex |
| 43 | + --file=<testfile> Run test cases from a custom file instead of parserTests.txt |
| 44 | + --record Record tests in database |
| 45 | + --compare Compare with recorded results, without updating the database. |
| 46 | + --setversion When using --record, set the version string to use (useful |
| 47 | + with git-svn so that you can get the exact revision) |
| 48 | + --keep-uploads Re-use the same upload directory for each test, don't delete it |
| 49 | + --fuzz Do a fuzz test instead of a normal test |
| 50 | + --seed <n> Start the fuzz test from the specified seed |
| 51 | + --help Show this help message |
| 52 | + --run-disabled run disabled tests |
| 53 | + --upload Upload test results to remote wiki (per \$wgParserTestRemote) |
| 54 | + |
| 55 | +ENDS; |
| 56 | + exit( 0 ); |
| 57 | +} |
| 58 | + |
| 59 | +# Cases of weird db corruption were encountered when running tests on earlyish |
| 60 | +# versions of SQLite |
| 61 | +if ( $wgDBtype == 'sqlite' ) { |
| 62 | + $db = wfGetDB( DB_MASTER ); |
| 63 | + $version = $db->getServerVersion(); |
| 64 | + if ( version_compare( $version, '3.6' ) < 0 ) { |
| 65 | + die( "Parser tests require SQLite version 3.6 or later, you have $version\n" ); |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +# There is a convention that the parser should never |
| 70 | +# refer to $wgTitle directly, but instead use the title |
| 71 | +# passed to it. |
| 72 | +$wgTitle = Title::newFromText( 'Parser test script do not use' ); |
| 73 | +$tester = new ParserTest($options); |
| 74 | + |
| 75 | +if ( isset( $options['file'] ) ) { |
| 76 | + $files = array( $options['file'] ); |
| 77 | +} else { |
| 78 | + // Default parser tests and any set from extensions or local config |
| 79 | + $files = $wgParserTestFiles; |
| 80 | +} |
| 81 | + |
| 82 | +# Print out software version to assist with locating regressions |
| 83 | +$version = SpecialVersion::getVersion(); |
| 84 | +echo( "This is MediaWiki version {$version}.\n\n" ); |
| 85 | + |
| 86 | +if ( isset( $options['fuzz'] ) ) { |
| 87 | + $tester->fuzzTest( $files ); |
| 88 | +} else { |
| 89 | + $ok = $tester->runTestsFromFiles( $files ); |
| 90 | + exit ( $ok ? 0 : 1 ); |
| 91 | +} |
Property changes on: trunk/phase3/maintenance/tests/parserTests.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 92 | + native |
Added: svn:keywords |
2 | 93 | + Author Date Id Revision |
Index: trunk/phase3/maintenance/tests/phpunit/includes/parser/MediaWikiParserTest.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | $wgMemc = new FakeMemCachedClient; |
26 | 26 | $this->backend->setupDatabase(); |
27 | 27 | |
28 | | - $iter = new TestFileIterator( "$IP/maintenance/parserTests.txt" ); |
| 28 | + $iter = new TestFileIterator( "$IP/maintenance/tests/parser/parserTests.txt" ); |
29 | 29 | $iter->setParser( $this->backend ); |
30 | 30 | $this->count = 0; |
31 | 31 | |
Index: trunk/phase3/maintenance/tests/testHelpers.inc |
— | — | @@ -0,0 +1,663 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * @ingroup Maintenance |
| 6 | + * |
| 7 | + * Set of classes to help with test output and such. Right now pretty specific |
| 8 | + * to the parser tests but could be more useful one day :) |
| 9 | + * |
| 10 | + * @todo @fixme Make this more generic |
| 11 | + */ |
| 12 | + |
| 13 | +class AnsiTermColorer { |
| 14 | + function __construct() { |
| 15 | + } |
| 16 | + |
| 17 | + /** |
| 18 | + * Return ANSI terminal escape code for changing text attribs/color |
| 19 | + * |
| 20 | + * @param $color String: semicolon-separated list of attribute/color codes |
| 21 | + * @return String |
| 22 | + */ |
| 23 | + public function color( $color ) { |
| 24 | + global $wgCommandLineDarkBg; |
| 25 | + |
| 26 | + $light = $wgCommandLineDarkBg ? "1;" : "0;"; |
| 27 | + |
| 28 | + return "\x1b[{$light}{$color}m"; |
| 29 | + } |
| 30 | + |
| 31 | + /** |
| 32 | + * Return ANSI terminal escape code for restoring default text attributes |
| 33 | + * |
| 34 | + * @return String |
| 35 | + */ |
| 36 | + public function reset() { |
| 37 | + return $this->color( 0 ); |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +/* A colour-less terminal */ |
| 42 | +class DummyTermColorer { |
| 43 | + public function color( $color ) { |
| 44 | + return ''; |
| 45 | + } |
| 46 | + |
| 47 | + public function reset() { |
| 48 | + return ''; |
| 49 | + } |
| 50 | +} |
| 51 | + |
| 52 | +class TestRecorder { |
| 53 | + var $parent; |
| 54 | + var $term; |
| 55 | + |
| 56 | + function __construct( $parent ) { |
| 57 | + $this->parent = $parent; |
| 58 | + $this->term = $parent->term; |
| 59 | + } |
| 60 | + |
| 61 | + function start() { |
| 62 | + $this->total = 0; |
| 63 | + $this->success = 0; |
| 64 | + } |
| 65 | + |
| 66 | + function record( $test, $result ) { |
| 67 | + $this->total++; |
| 68 | + $this->success += ( $result ? 1 : 0 ); |
| 69 | + } |
| 70 | + |
| 71 | + function end() { |
| 72 | + // dummy |
| 73 | + } |
| 74 | + |
| 75 | + function report() { |
| 76 | + if ( $this->total > 0 ) { |
| 77 | + $this->reportPercentage( $this->success, $this->total ); |
| 78 | + } else { |
| 79 | + wfDie( "No tests found.\n" ); |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + function reportPercentage( $success, $total ) { |
| 84 | + $ratio = wfPercent( 100 * $success / $total ); |
| 85 | + print $this->term->color( 1 ) . "Passed $success of $total tests ($ratio)... "; |
| 86 | + |
| 87 | + if ( $success == $total ) { |
| 88 | + print $this->term->color( 32 ) . "ALL TESTS PASSED!"; |
| 89 | + } else { |
| 90 | + $failed = $total - $success ; |
| 91 | + print $this->term->color( 31 ) . "$failed tests failed!"; |
| 92 | + } |
| 93 | + |
| 94 | + print $this->term->reset() . "\n"; |
| 95 | + |
| 96 | + return ( $success == $total ); |
| 97 | + } |
| 98 | +} |
| 99 | + |
| 100 | +class DbTestPreviewer extends TestRecorder { |
| 101 | + protected $lb; // /< Database load balancer |
| 102 | + protected $db; // /< Database connection to the main DB |
| 103 | + protected $curRun; // /< run ID number for the current run |
| 104 | + protected $prevRun; // /< run ID number for the previous run, if any |
| 105 | + protected $results; // /< Result array |
| 106 | + |
| 107 | + /** |
| 108 | + * This should be called before the table prefix is changed |
| 109 | + */ |
| 110 | + function __construct( $parent ) { |
| 111 | + parent::__construct( $parent ); |
| 112 | + |
| 113 | + $this->lb = wfGetLBFactory()->newMainLB(); |
| 114 | + // This connection will have the wiki's table prefix, not parsertest_ |
| 115 | + $this->db = $this->lb->getConnection( DB_MASTER ); |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * Set up result recording; insert a record for the run with the date |
| 120 | + * and all that fun stuff |
| 121 | + */ |
| 122 | + function start() { |
| 123 | + parent::start(); |
| 124 | + |
| 125 | + if ( ! $this->db->tableExists( 'testrun' ) |
| 126 | + or ! $this->db->tableExists( 'testitem' ) ) |
| 127 | + { |
| 128 | + print "WARNING> `testrun` table not found in database.\n"; |
| 129 | + $this->prevRun = false; |
| 130 | + } else { |
| 131 | + // We'll make comparisons against the previous run later... |
| 132 | + $this->prevRun = $this->db->selectField( 'testrun', 'MAX(tr_id)' ); |
| 133 | + } |
| 134 | + |
| 135 | + $this->results = array(); |
| 136 | + } |
| 137 | + |
| 138 | + function record( $test, $result ) { |
| 139 | + parent::record( $test, $result ); |
| 140 | + $this->results[$test] = $result; |
| 141 | + } |
| 142 | + |
| 143 | + function report() { |
| 144 | + if ( $this->prevRun ) { |
| 145 | + // f = fail, p = pass, n = nonexistent |
| 146 | + // codes show before then after |
| 147 | + $table = array( |
| 148 | + 'fp' => 'previously failing test(s) now PASSING! :)', |
| 149 | + 'pn' => 'previously PASSING test(s) removed o_O', |
| 150 | + 'np' => 'new PASSING test(s) :)', |
| 151 | + |
| 152 | + 'pf' => 'previously passing test(s) now FAILING! :(', |
| 153 | + 'fn' => 'previously FAILING test(s) removed O_o', |
| 154 | + 'nf' => 'new FAILING test(s) :(', |
| 155 | + 'ff' => 'still FAILING test(s) :(', |
| 156 | + ); |
| 157 | + |
| 158 | + $prevResults = array(); |
| 159 | + |
| 160 | + $res = $this->db->select( 'testitem', array( 'ti_name', 'ti_success' ), |
| 161 | + array( 'ti_run' => $this->prevRun ), __METHOD__ ); |
| 162 | + |
| 163 | + foreach ( $res as $row ) { |
| 164 | + if ( !$this->parent->regex |
| 165 | + || preg_match( "/{$this->parent->regex}/i", $row->ti_name ) ) |
| 166 | + { |
| 167 | + $prevResults[$row->ti_name] = $row->ti_success; |
| 168 | + } |
| 169 | + } |
| 170 | + |
| 171 | + $combined = array_keys( $this->results + $prevResults ); |
| 172 | + |
| 173 | + # Determine breakdown by change type |
| 174 | + $breakdown = array(); |
| 175 | + foreach ( $combined as $test ) { |
| 176 | + if ( !isset( $prevResults[$test] ) ) { |
| 177 | + $before = 'n'; |
| 178 | + } elseif ( $prevResults[$test] == 1 ) { |
| 179 | + $before = 'p'; |
| 180 | + } else /* if ( $prevResults[$test] == 0 )*/ { |
| 181 | + $before = 'f'; |
| 182 | + } |
| 183 | + |
| 184 | + if ( !isset( $this->results[$test] ) ) { |
| 185 | + $after = 'n'; |
| 186 | + } elseif ( $this->results[$test] == 1 ) { |
| 187 | + $after = 'p'; |
| 188 | + } else /*if ( $this->results[$test] == 0 ) */ { |
| 189 | + $after = 'f'; |
| 190 | + } |
| 191 | + |
| 192 | + $code = $before . $after; |
| 193 | + |
| 194 | + if ( isset( $table[$code] ) ) { |
| 195 | + $breakdown[$code][$test] = $this->getTestStatusInfo( $test, $after ); |
| 196 | + } |
| 197 | + } |
| 198 | + |
| 199 | + # Write out results |
| 200 | + foreach ( $table as $code => $label ) { |
| 201 | + if ( !empty( $breakdown[$code] ) ) { |
| 202 | + $count = count( $breakdown[$code] ); |
| 203 | + printf( "\n%4d %s\n", $count, $label ); |
| 204 | + |
| 205 | + foreach ( $breakdown[$code] as $differing_test_name => $statusInfo ) { |
| 206 | + print " * $differing_test_name [$statusInfo]\n"; |
| 207 | + } |
| 208 | + } |
| 209 | + } |
| 210 | + } else { |
| 211 | + print "No previous test runs to compare against.\n"; |
| 212 | + } |
| 213 | + |
| 214 | + print "\n"; |
| 215 | + parent::report(); |
| 216 | + } |
| 217 | + |
| 218 | + /** |
| 219 | + * Returns a string giving information about when a test last had a status change. |
| 220 | + * Could help to track down when regressions were introduced, as distinct from tests |
| 221 | + * which have never passed (which are more change requests than regressions). |
| 222 | + */ |
| 223 | + private function getTestStatusInfo( $testname, $after ) { |
| 224 | + // If we're looking at a test that has just been removed, then say when it first appeared. |
| 225 | + if ( $after == 'n' ) { |
| 226 | + $changedRun = $this->db->selectField ( 'testitem', |
| 227 | + 'MIN(ti_run)', |
| 228 | + array( 'ti_name' => $testname ), |
| 229 | + __METHOD__ ); |
| 230 | + $appear = $this->db->selectRow ( 'testrun', |
| 231 | + array( 'tr_date', 'tr_mw_version' ), |
| 232 | + array( 'tr_id' => $changedRun ), |
| 233 | + __METHOD__ ); |
| 234 | + |
| 235 | + return "First recorded appearance: " |
| 236 | + . date( "d-M-Y H:i:s", strtotime ( $appear->tr_date ) ) |
| 237 | + . ", " . $appear->tr_mw_version; |
| 238 | + } |
| 239 | + |
| 240 | + // Otherwise, this test has previous recorded results. |
| 241 | + // See when this test last had a different result to what we're seeing now. |
| 242 | + $conds = array( |
| 243 | + 'ti_name' => $testname, |
| 244 | + 'ti_success' => ( $after == 'f' ? "1" : "0" ) ); |
| 245 | + |
| 246 | + if ( $this->curRun ) { |
| 247 | + $conds[] = "ti_run != " . $this->db->addQuotes ( $this->curRun ); |
| 248 | + } |
| 249 | + |
| 250 | + $changedRun = $this->db->selectField ( 'testitem', 'MAX(ti_run)', $conds, __METHOD__ ); |
| 251 | + |
| 252 | + // If no record of ever having had a different result. |
| 253 | + if ( is_null ( $changedRun ) ) { |
| 254 | + if ( $after == "f" ) { |
| 255 | + return "Has never passed"; |
| 256 | + } else { |
| 257 | + return "Has never failed"; |
| 258 | + } |
| 259 | + } |
| 260 | + |
| 261 | + // Otherwise, we're looking at a test whose status has changed. |
| 262 | + // (i.e. it used to work, but now doesn't; or used to fail, but is now fixed.) |
| 263 | + // In this situation, give as much info as we can as to when it changed status. |
| 264 | + $pre = $this->db->selectRow ( 'testrun', |
| 265 | + array( 'tr_date', 'tr_mw_version' ), |
| 266 | + array( 'tr_id' => $changedRun ), |
| 267 | + __METHOD__ ); |
| 268 | + $post = $this->db->selectRow ( 'testrun', |
| 269 | + array( 'tr_date', 'tr_mw_version' ), |
| 270 | + array( "tr_id > " . $this->db->addQuotes ( $changedRun ) ), |
| 271 | + __METHOD__, |
| 272 | + array( "LIMIT" => 1, "ORDER BY" => 'tr_id' ) |
| 273 | + ); |
| 274 | + |
| 275 | + if ( $post ) { |
| 276 | + $postDate = date( "d-M-Y H:i:s", strtotime ( $post->tr_date ) ) . ", {$post->tr_mw_version}"; |
| 277 | + } else { |
| 278 | + $postDate = 'now'; |
| 279 | + } |
| 280 | + |
| 281 | + return ( $after == "f" ? "Introduced" : "Fixed" ) . " between " |
| 282 | + . date( "d-M-Y H:i:s", strtotime ( $pre->tr_date ) ) . ", " . $pre->tr_mw_version |
| 283 | + . " and $postDate"; |
| 284 | + |
| 285 | + } |
| 286 | + |
| 287 | + /** |
| 288 | + * Commit transaction and clean up for result recording |
| 289 | + */ |
| 290 | + function end() { |
| 291 | + $this->lb->commitMasterChanges(); |
| 292 | + $this->lb->closeAll(); |
| 293 | + parent::end(); |
| 294 | + } |
| 295 | + |
| 296 | +} |
| 297 | + |
| 298 | +class DbTestRecorder extends DbTestPreviewer { |
| 299 | + var $version; |
| 300 | + |
| 301 | + /** |
| 302 | + * Set up result recording; insert a record for the run with the date |
| 303 | + * and all that fun stuff |
| 304 | + */ |
| 305 | + function start() { |
| 306 | + global $wgDBtype; |
| 307 | + $this->db->begin(); |
| 308 | + |
| 309 | + if ( ! $this->db->tableExists( 'testrun' ) |
| 310 | + or ! $this->db->tableExists( 'testitem' ) ) |
| 311 | + { |
| 312 | + print "WARNING> `testrun` table not found in database. Trying to create table.\n"; |
| 313 | + if ( $wgDBtype === 'postgres' ) { |
| 314 | + $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.postgres.sql' ); |
| 315 | + } elseif ( $wgDBtype === 'oracle' ) { |
| 316 | + $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.ora.sql' ); |
| 317 | + } else { |
| 318 | + $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.sql' ); |
| 319 | + } |
| 320 | + |
| 321 | + echo "OK, resuming.\n"; |
| 322 | + } |
| 323 | + |
| 324 | + parent::start(); |
| 325 | + |
| 326 | + $this->db->insert( 'testrun', |
| 327 | + array( |
| 328 | + 'tr_date' => $this->db->timestamp(), |
| 329 | + 'tr_mw_version' => $this->version, |
| 330 | + 'tr_php_version' => phpversion(), |
| 331 | + 'tr_db_version' => $this->db->getServerVersion(), |
| 332 | + 'tr_uname' => php_uname() |
| 333 | + ), |
| 334 | + __METHOD__ ); |
| 335 | + if ( $wgDBtype === 'postgres' ) { |
| 336 | + $this->curRun = $this->db->currentSequenceValue( 'testrun_id_seq' ); |
| 337 | + } else { |
| 338 | + $this->curRun = $this->db->insertId(); |
| 339 | + } |
| 340 | + } |
| 341 | + |
| 342 | + /** |
| 343 | + * Record an individual test item's success or failure to the db |
| 344 | + * |
| 345 | + * @param $test String |
| 346 | + * @param $result Boolean |
| 347 | + */ |
| 348 | + function record( $test, $result ) { |
| 349 | + parent::record( $test, $result ); |
| 350 | + |
| 351 | + $this->db->insert( 'testitem', |
| 352 | + array( |
| 353 | + 'ti_run' => $this->curRun, |
| 354 | + 'ti_name' => $test, |
| 355 | + 'ti_success' => $result ? 1 : 0, |
| 356 | + ), |
| 357 | + __METHOD__ ); |
| 358 | + } |
| 359 | +} |
| 360 | + |
| 361 | +class RemoteTestRecorder extends TestRecorder { |
| 362 | + function start() { |
| 363 | + parent::start(); |
| 364 | + |
| 365 | + $this->results = array(); |
| 366 | + $this->ping( 'running' ); |
| 367 | + } |
| 368 | + |
| 369 | + function record( $test, $result ) { |
| 370 | + parent::record( $test, $result ); |
| 371 | + $this->results[$test] = (bool)$result; |
| 372 | + } |
| 373 | + |
| 374 | + function end() { |
| 375 | + $this->ping( 'complete', $this->results ); |
| 376 | + parent::end(); |
| 377 | + } |
| 378 | + |
| 379 | + /** |
| 380 | + * Inform a CodeReview instance that we've started or completed a test run... |
| 381 | + * |
| 382 | + * @param $status string: "running" - tell it we've started |
| 383 | + * "complete" - provide test results array |
| 384 | + * "abort" - something went horribly awry |
| 385 | + * @param $results array of test name => true/false |
| 386 | + */ |
| 387 | + function ping( $status, $results = false ) { |
| 388 | + global $wgParserTestRemote, $IP; |
| 389 | + |
| 390 | + $remote = $wgParserTestRemote; |
| 391 | + $revId = SpecialVersion::getSvnRevision( $IP ); |
| 392 | + $jsonResults = FormatJson::encode( $results ); |
| 393 | + |
| 394 | + if ( !$remote ) { |
| 395 | + print "Can't do remote upload without configuring \$wgParserTestRemote!\n"; |
| 396 | + exit( 1 ); |
| 397 | + } |
| 398 | + |
| 399 | + // Generate a hash MAC to validate our credentials |
| 400 | + $message = array( |
| 401 | + $remote['repo'], |
| 402 | + $remote['suite'], |
| 403 | + $revId, |
| 404 | + $status, |
| 405 | + ); |
| 406 | + |
| 407 | + if ( $status == "complete" ) { |
| 408 | + $message[] = $jsonResults; |
| 409 | + } |
| 410 | + $hmac = hash_hmac( "sha1", implode( "|", $message ), $remote['secret'] ); |
| 411 | + |
| 412 | + $postData = array( |
| 413 | + 'action' => 'codetestupload', |
| 414 | + 'format' => 'json', |
| 415 | + 'repo' => $remote['repo'], |
| 416 | + 'suite' => $remote['suite'], |
| 417 | + 'rev' => $revId, |
| 418 | + 'status' => $status, |
| 419 | + 'hmac' => $hmac, |
| 420 | + ); |
| 421 | + |
| 422 | + if ( $status == "complete" ) { |
| 423 | + $postData['results'] = $jsonResults; |
| 424 | + } |
| 425 | + |
| 426 | + $response = $this->post( $remote['api-url'], $postData ); |
| 427 | + |
| 428 | + if ( $response === false ) { |
| 429 | + print "CodeReview info upload failed to reach server.\n"; |
| 430 | + exit( 1 ); |
| 431 | + } |
| 432 | + |
| 433 | + $responseData = FormatJson::decode( $response, true ); |
| 434 | + |
| 435 | + if ( !is_array( $responseData ) ) { |
| 436 | + print "CodeReview API response not recognized...\n"; |
| 437 | + wfDebug( "Unrecognized CodeReview API response: $response\n" ); |
| 438 | + exit( 1 ); |
| 439 | + } |
| 440 | + |
| 441 | + if ( isset( $responseData['error'] ) ) { |
| 442 | + $code = $responseData['error']['code']; |
| 443 | + $info = $responseData['error']['info']; |
| 444 | + print "CodeReview info upload failed: $code $info\n"; |
| 445 | + exit( 1 ); |
| 446 | + } |
| 447 | + } |
| 448 | + |
| 449 | + function post( $url, $data ) { |
| 450 | + return Http::post( $url, array( 'postData' => $data ) ); |
| 451 | + } |
| 452 | +} |
| 453 | + |
| 454 | +class TestFileIterator implements Iterator { |
| 455 | + private $file; |
| 456 | + private $fh; |
| 457 | + private $parser; |
| 458 | + private $index = 0; |
| 459 | + private $test; |
| 460 | + private $lineNum; |
| 461 | + private $eof; |
| 462 | + |
| 463 | + function __construct( $file, $parser = null ) { |
| 464 | + global $IP; |
| 465 | + |
| 466 | + $this->file = $file; |
| 467 | + $this->fh = fopen( $this->file, "rt" ); |
| 468 | + |
| 469 | + if ( !$this->fh ) { |
| 470 | + wfDie( "Couldn't open file '$file'\n" ); |
| 471 | + } |
| 472 | + |
| 473 | + $this->parser = $parser; |
| 474 | + |
| 475 | + if ( $this->parser ) { |
| 476 | + $this->parser->showRunFile( wfRelativePath( $this->file, $IP ) ); |
| 477 | + } |
| 478 | + |
| 479 | + $this->lineNum = $this->index = 0; |
| 480 | + } |
| 481 | + |
| 482 | + function setParser( ParserTest $parser ) { |
| 483 | + $this->parser = $parser; |
| 484 | + } |
| 485 | + |
| 486 | + function rewind() { |
| 487 | + if ( fseek( $this->fh, 0 ) ) { |
| 488 | + wfDie( "Couldn't fseek to the start of '$this->file'\n" ); |
| 489 | + } |
| 490 | + |
| 491 | + $this->index = -1; |
| 492 | + $this->lineNum = 0; |
| 493 | + $this->eof = false; |
| 494 | + $this->next(); |
| 495 | + |
| 496 | + return true; |
| 497 | + } |
| 498 | + |
| 499 | + function current() { |
| 500 | + return $this->test; |
| 501 | + } |
| 502 | + |
| 503 | + function key() { |
| 504 | + return $this->index; |
| 505 | + } |
| 506 | + |
| 507 | + function next() { |
| 508 | + if ( $this->readNextTest() ) { |
| 509 | + $this->index++; |
| 510 | + return true; |
| 511 | + } else { |
| 512 | + $this->eof = true; |
| 513 | + } |
| 514 | + } |
| 515 | + |
| 516 | + function valid() { |
| 517 | + return $this->eof != true; |
| 518 | + } |
| 519 | + |
| 520 | + function readNextTest() { |
| 521 | + $data = array(); |
| 522 | + $section = null; |
| 523 | + |
| 524 | + while ( false !== ( $line = fgets( $this->fh ) ) ) { |
| 525 | + $this->lineNum++; |
| 526 | + $matches = array(); |
| 527 | + |
| 528 | + if ( preg_match( '/^!!\s*(\w+)/', $line, $matches ) ) { |
| 529 | + $section = strtolower( $matches[1] ); |
| 530 | + |
| 531 | + if ( $section == 'endarticle' ) { |
| 532 | + if ( !isset( $data['text'] ) ) { |
| 533 | + wfDie( "'endarticle' without 'text' at line {$this->lineNum} of $this->file\n" ); |
| 534 | + } |
| 535 | + |
| 536 | + if ( !isset( $data['article'] ) ) { |
| 537 | + wfDie( "'endarticle' without 'article' at line {$this->lineNum} of $this->file\n" ); |
| 538 | + } |
| 539 | + |
| 540 | + if ( $this->parser ) { |
| 541 | + $this->parser->addArticle( $this->parser->chomp( $data['article'] ), $this->parser->chomp( $data['text'] ), |
| 542 | + $this->lineNum ); |
| 543 | + } |
| 544 | + |
| 545 | + $data = array(); |
| 546 | + $section = null; |
| 547 | + |
| 548 | + continue; |
| 549 | + } |
| 550 | + |
| 551 | + if ( $section == 'endhooks' ) { |
| 552 | + if ( !isset( $data['hooks'] ) ) { |
| 553 | + wfDie( "'endhooks' without 'hooks' at line {$this->lineNum} of $this->file\n" ); |
| 554 | + } |
| 555 | + |
| 556 | + foreach ( explode( "\n", $data['hooks'] ) as $line ) { |
| 557 | + $line = trim( $line ); |
| 558 | + |
| 559 | + if ( $line ) { |
| 560 | + if ( $this->parser && !$this->parser->requireHook( $line ) ) { |
| 561 | + return false; |
| 562 | + } |
| 563 | + } |
| 564 | + } |
| 565 | + |
| 566 | + $data = array(); |
| 567 | + $section = null; |
| 568 | + |
| 569 | + continue; |
| 570 | + } |
| 571 | + |
| 572 | + if ( $section == 'endfunctionhooks' ) { |
| 573 | + if ( !isset( $data['functionhooks'] ) ) { |
| 574 | + wfDie( "'endfunctionhooks' without 'functionhooks' at line {$this->lineNum} of $this->file\n" ); |
| 575 | + } |
| 576 | + |
| 577 | + foreach ( explode( "\n", $data['functionhooks'] ) as $line ) { |
| 578 | + $line = trim( $line ); |
| 579 | + |
| 580 | + if ( $line ) { |
| 581 | + if ( $this->parser && !$this->parser->requireFunctionHook( $line ) ) { |
| 582 | + return false; |
| 583 | + } |
| 584 | + } |
| 585 | + } |
| 586 | + |
| 587 | + $data = array(); |
| 588 | + $section = null; |
| 589 | + |
| 590 | + continue; |
| 591 | + } |
| 592 | + |
| 593 | + if ( $section == 'end' ) { |
| 594 | + if ( !isset( $data['test'] ) ) { |
| 595 | + wfDie( "'end' without 'test' at line {$this->lineNum} of $this->file\n" ); |
| 596 | + } |
| 597 | + |
| 598 | + if ( !isset( $data['input'] ) ) { |
| 599 | + wfDie( "'end' without 'input' at line {$this->lineNum} of $this->file\n" ); |
| 600 | + } |
| 601 | + |
| 602 | + if ( !isset( $data['result'] ) ) { |
| 603 | + wfDie( "'end' without 'result' at line {$this->lineNum} of $this->file\n" ); |
| 604 | + } |
| 605 | + |
| 606 | + if ( !isset( $data['options'] ) ) { |
| 607 | + $data['options'] = ''; |
| 608 | + } |
| 609 | + |
| 610 | + if ( !isset( $data['config'] ) ) |
| 611 | + $data['config'] = ''; |
| 612 | + |
| 613 | + if ( $this->parser |
| 614 | + && ( ( preg_match( '/\\bdisabled\\b/i', $data['options'] ) && !$this->parser->runDisabled ) |
| 615 | + || !preg_match( "/" . $this->parser->regex . "/i", $data['test'] ) ) ) { |
| 616 | + # disabled test |
| 617 | + $data = array(); |
| 618 | + $section = null; |
| 619 | + |
| 620 | + continue; |
| 621 | + } |
| 622 | + |
| 623 | + global $wgUseTeX; |
| 624 | + |
| 625 | + if ( $this->parser && |
| 626 | + preg_match( '/\\bmath\\b/i', $data['options'] ) && !$wgUseTeX ) { |
| 627 | + # don't run math tests if $wgUseTeX is set to false in LocalSettings |
| 628 | + $data = array(); |
| 629 | + $section = null; |
| 630 | + |
| 631 | + continue; |
| 632 | + } |
| 633 | + |
| 634 | + if ( $this->parser ) { |
| 635 | + $this->test = array( |
| 636 | + 'test' => $this->parser->chomp( $data['test'] ), |
| 637 | + 'input' => $this->parser->chomp( $data['input'] ), |
| 638 | + 'result' => $this->parser->chomp( $data['result'] ), |
| 639 | + 'options' => $this->parser->chomp( $data['options'] ), |
| 640 | + 'config' => $this->parser->chomp( $data['config'] ) ); |
| 641 | + } else { |
| 642 | + $this->test['test'] = $data['test']; |
| 643 | + } |
| 644 | + |
| 645 | + return true; |
| 646 | + } |
| 647 | + |
| 648 | + if ( isset ( $data[$section] ) ) { |
| 649 | + wfDie( "duplicate section '$section' at line {$this->lineNum} of $this->file\n" ); |
| 650 | + } |
| 651 | + |
| 652 | + $data[$section] = ''; |
| 653 | + |
| 654 | + continue; |
| 655 | + } |
| 656 | + |
| 657 | + if ( $section ) { |
| 658 | + $data[$section] .= $line; |
| 659 | + } |
| 660 | + } |
| 661 | + |
| 662 | + return false; |
| 663 | + } |
| 664 | +} |
Property changes on: trunk/phase3/maintenance/tests/testHelpers.inc |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 665 | + native |
Index: trunk/phase3/maintenance/tests/parser/ExtraParserTests.txt |
— | — | @@ -0,0 +1,51 @@ |
| 2 | +# This is another parserTest file. |
| 3 | +# Parser tests should go to ParserTests.txt |
| 4 | +# This one got exiliated here because its broken character |
| 5 | +# a) Already lost this test for years when removed on r12975 |
| 6 | +# b) Some text editors choke in the whole file due to the character |
| 7 | + |
| 8 | +!! test |
| 9 | +External links: invalid character NUL |
| 10 | +!! options |
| 11 | +noxml |
| 12 | +preprocessor=Preprocessor_Hash |
| 13 | +!! input |
| 14 | +[http://www.example.com test] |
| 15 | +!! result |
| 16 | +<p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> test] |
| 17 | +</p> |
| 18 | +!! end |
| 19 | + |
| 20 | +!! test |
| 21 | +External links: invalid character backspace |
| 22 | +!! options |
| 23 | +noxml |
| 24 | +preprocessor=Preprocessor_Hash |
| 25 | +!! input |
| 26 | +[http://www.example.com test] |
| 27 | +!! result |
| 28 | +<p>[<a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> test] |
| 29 | +</p> |
| 30 | +!! end |
| 31 | + |
| 32 | + |
| 33 | +!! test |
| 34 | +Magic link: invalid character |
| 35 | +!! options |
| 36 | +noxml |
| 37 | +preprocessor=Preprocessor_Hash |
| 38 | +!! input |
| 39 | +http://www.example.com |
| 40 | +!! result |
| 41 | +<p><a href="http://www.example.com" class="external free" rel="nofollow">http://www.example.com</a> |
| 42 | +</p> |
| 43 | +!! end |
| 44 | + |
| 45 | +!! test |
| 46 | +External links: tab character |
| 47 | +!! input |
| 48 | +[http://www.example.com Alice in Wonderland] |
| 49 | +!! result |
| 50 | +<p><a href="http://www.example.com" class="external text" rel="nofollow">Alice in Wonderland</a> |
| 51 | +</p> |
| 52 | +!! end |
Property changes on: trunk/phase3/maintenance/tests/parser/ExtraParserTests.txt |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 53 | + native |
Index: trunk/phase3/maintenance/tests/parser/parserTestsParserHook.php |
— | — | @@ -0,0 +1,46 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * A basic extension that's used by the parser tests to test whether input and |
| 5 | + * arguments are passed to extensions properly. |
| 6 | + * |
| 7 | + * Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason |
| 8 | + * |
| 9 | + * This program is free software; you can redistribute it and/or modify |
| 10 | + * it under the terms of the GNU General Public License as published by |
| 11 | + * the Free Software Foundation; either version 2 of the License, or |
| 12 | + * (at your option) any later version. |
| 13 | + * |
| 14 | + * This program is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU General Public License along |
| 20 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 22 | + * http://www.gnu.org/copyleft/gpl.html |
| 23 | + * |
| 24 | + * @file |
| 25 | + * @ingroup Maintenance |
| 26 | + * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
| 27 | + */ |
| 28 | + |
| 29 | +class ParserTestParserHook { |
| 30 | + |
| 31 | + static function setup( &$parser ) { |
| 32 | + $parser->setHook( 'tag', array( __CLASS__, 'hook' ) ); |
| 33 | + |
| 34 | + return true; |
| 35 | + } |
| 36 | + |
| 37 | + static function hook( $in, $argv ) { |
| 38 | + ob_start(); |
| 39 | + var_dump( |
| 40 | + $in, |
| 41 | + $argv |
| 42 | + ); |
| 43 | + $ret = ob_get_clean(); |
| 44 | + |
| 45 | + return "<pre>\n$ret</pre>"; |
| 46 | + } |
| 47 | +} |
Property changes on: trunk/phase3/maintenance/tests/parser/parserTestsParserHook.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 48 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 49 | + native |
Index: trunk/phase3/maintenance/tests/parser/parserTest.inc |
— | — | @@ -0,0 +1,1231 @@ |
| 2 | +<?php |
| 3 | +# Copyright (C) 2004, 2010 Brion Vibber <brion@pobox.com> |
| 4 | +# http://www.mediawiki.org/ |
| 5 | +# |
| 6 | +# This program is free software; you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU General Public License as published by |
| 8 | +# the Free Software Foundation; either version 2 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# This program is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU General Public License along |
| 17 | +# with this program; if not, write to the Free Software Foundation, Inc., |
| 18 | +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | +# http://www.gnu.org/copyleft/gpl.html |
| 20 | + |
| 21 | +/** |
| 22 | + * @todo Make this more independent of the configuration (and if possible the database) |
| 23 | + * @todo document |
| 24 | + * @file |
| 25 | + * @ingroup Maintenance |
| 26 | + */ |
| 27 | + |
| 28 | +/** |
| 29 | + * @ingroup Maintenance |
| 30 | + */ |
| 31 | +class ParserTest { |
| 32 | + /** |
| 33 | + * boolean $color whereas output should be colorized |
| 34 | + */ |
| 35 | + private $color; |
| 36 | + |
| 37 | + /** |
| 38 | + * boolean $showOutput Show test output |
| 39 | + */ |
| 40 | + private $showOutput; |
| 41 | + |
| 42 | + /** |
| 43 | + * boolean $useTemporaryTables Use temporary tables for the temporary database |
| 44 | + */ |
| 45 | + private $useTemporaryTables = true; |
| 46 | + |
| 47 | + /** |
| 48 | + * boolean $databaseSetupDone True if the database has been set up |
| 49 | + */ |
| 50 | + private $databaseSetupDone = false; |
| 51 | + |
| 52 | + /** |
| 53 | + * string $oldTablePrefix Original table prefix |
| 54 | + */ |
| 55 | + private $oldTablePrefix; |
| 56 | + |
| 57 | + private $maxFuzzTestLength = 300; |
| 58 | + private $fuzzSeed = 0; |
| 59 | + private $memoryLimit = 50; |
| 60 | + |
| 61 | + /** |
| 62 | + * Sets terminal colorization and diff/quick modes depending on OS and |
| 63 | + * command-line options (--color and --quick). |
| 64 | + */ |
| 65 | + public function ParserTest( $options = array() ) { |
| 66 | + # Only colorize output if stdout is a terminal. |
| 67 | + $this->color = !wfIsWindows() && posix_isatty( 1 ); |
| 68 | + |
| 69 | + if ( isset( $options['color'] ) ) { |
| 70 | + switch( $options['color'] ) { |
| 71 | + case 'no': |
| 72 | + $this->color = false; |
| 73 | + break; |
| 74 | + case 'yes': |
| 75 | + default: |
| 76 | + $this->color = true; |
| 77 | + break; |
| 78 | + } |
| 79 | + } |
| 80 | + |
| 81 | + $this->term = $this->color |
| 82 | + ? new AnsiTermColorer() |
| 83 | + : new DummyTermColorer(); |
| 84 | + |
| 85 | + $this->showDiffs = !isset( $options['quick'] ); |
| 86 | + $this->showProgress = !isset( $options['quiet'] ); |
| 87 | + $this->showFailure = !( |
| 88 | + isset( $options['quiet'] ) |
| 89 | + && ( isset( $options['record'] ) |
| 90 | + || isset( $options['compare'] ) ) ); // redundant output |
| 91 | + |
| 92 | + $this->showOutput = isset( $options['show-output'] ); |
| 93 | + |
| 94 | + |
| 95 | + if ( isset( $options['regex'] ) ) { |
| 96 | + if ( isset( $options['record'] ) ) { |
| 97 | + echo "Warning: --record cannot be used with --regex, disabling --record\n"; |
| 98 | + unset( $options['record'] ); |
| 99 | + } |
| 100 | + $this->regex = $options['regex']; |
| 101 | + } else { |
| 102 | + # Matches anything |
| 103 | + $this->regex = ''; |
| 104 | + } |
| 105 | + |
| 106 | + $this->setupRecorder( $options ); |
| 107 | + $this->keepUploads = isset( $options['keep-uploads'] ); |
| 108 | + |
| 109 | + if ( isset( $options['seed'] ) ) { |
| 110 | + $this->fuzzSeed = intval( $options['seed'] ) - 1; |
| 111 | + } |
| 112 | + |
| 113 | + $this->runDisabled = isset( $options['run-disabled'] ); |
| 114 | + |
| 115 | + $this->hooks = array(); |
| 116 | + $this->functionHooks = array(); |
| 117 | + } |
| 118 | + |
| 119 | + public function setupRecorder ( $options ) { |
| 120 | + if ( isset( $options['record'] ) ) { |
| 121 | + $this->recorder = new DbTestRecorder( $this ); |
| 122 | + $this->recorder->version = isset( $options['setversion'] ) ? |
| 123 | + $options['setversion'] : SpecialVersion::getVersion(); |
| 124 | + } elseif ( isset( $options['compare'] ) ) { |
| 125 | + $this->recorder = new DbTestPreviewer( $this ); |
| 126 | + } elseif ( isset( $options['upload'] ) ) { |
| 127 | + $this->recorder = new RemoteTestRecorder( $this ); |
| 128 | + } else { |
| 129 | + $this->recorder = new TestRecorder( $this ); |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * Remove last character if it is a newline |
| 135 | + */ |
| 136 | + public function chomp( $s ) { |
| 137 | + if ( substr( $s, -1 ) === "\n" ) { |
| 138 | + return substr( $s, 0, -1 ); |
| 139 | + } |
| 140 | + else { |
| 141 | + return $s; |
| 142 | + } |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * Run a fuzz test series |
| 147 | + * Draw input from a set of test files |
| 148 | + */ |
| 149 | + function fuzzTest( $filenames ) { |
| 150 | + $GLOBALS['wgContLang'] = Language::factory( 'en' ); |
| 151 | + $dict = $this->getFuzzInput( $filenames ); |
| 152 | + $dictSize = strlen( $dict ); |
| 153 | + $logMaxLength = log( $this->maxFuzzTestLength ); |
| 154 | + $this->setupDatabase(); |
| 155 | + ini_set( 'memory_limit', $this->memoryLimit * 1048576 ); |
| 156 | + |
| 157 | + $numTotal = 0; |
| 158 | + $numSuccess = 0; |
| 159 | + $user = new User; |
| 160 | + $opts = ParserOptions::newFromUser( $user ); |
| 161 | + $title = Title::makeTitle( NS_MAIN, 'Parser_test' ); |
| 162 | + |
| 163 | + while ( true ) { |
| 164 | + // Generate test input |
| 165 | + mt_srand( ++$this->fuzzSeed ); |
| 166 | + $totalLength = mt_rand( 1, $this->maxFuzzTestLength ); |
| 167 | + $input = ''; |
| 168 | + |
| 169 | + while ( strlen( $input ) < $totalLength ) { |
| 170 | + $logHairLength = mt_rand( 0, 1000000 ) / 1000000 * $logMaxLength; |
| 171 | + $hairLength = min( intval( exp( $logHairLength ) ), $dictSize ); |
| 172 | + $offset = mt_rand( 0, $dictSize - $hairLength ); |
| 173 | + $input .= substr( $dict, $offset, $hairLength ); |
| 174 | + } |
| 175 | + |
| 176 | + $this->setupGlobals(); |
| 177 | + $parser = $this->getParser(); |
| 178 | + |
| 179 | + // Run the test |
| 180 | + try { |
| 181 | + $parser->parse( $input, $title, $opts ); |
| 182 | + $fail = false; |
| 183 | + } catch ( Exception $exception ) { |
| 184 | + $fail = true; |
| 185 | + } |
| 186 | + |
| 187 | + if ( $fail ) { |
| 188 | + echo "Test failed with seed {$this->fuzzSeed}\n"; |
| 189 | + echo "Input:\n"; |
| 190 | + var_dump( $input ); |
| 191 | + echo "\n\n"; |
| 192 | + echo "$exception\n"; |
| 193 | + } else { |
| 194 | + $numSuccess++; |
| 195 | + } |
| 196 | + |
| 197 | + $numTotal++; |
| 198 | + $this->teardownGlobals(); |
| 199 | + $parser->__destruct(); |
| 200 | + |
| 201 | + if ( $numTotal % 100 == 0 ) { |
| 202 | + $usage = intval( memory_get_usage( true ) / $this->memoryLimit / 1048576 * 100 ); |
| 203 | + echo "{$this->fuzzSeed}: $numSuccess/$numTotal (mem: $usage%)\n"; |
| 204 | + if ( $usage > 90 ) { |
| 205 | + echo "Out of memory:\n"; |
| 206 | + $memStats = $this->getMemoryBreakdown(); |
| 207 | + |
| 208 | + foreach ( $memStats as $name => $usage ) { |
| 209 | + echo "$name: $usage\n"; |
| 210 | + } |
| 211 | + $this->abort(); |
| 212 | + } |
| 213 | + } |
| 214 | + } |
| 215 | + } |
| 216 | + |
| 217 | + /** |
| 218 | + * Get an input dictionary from a set of parser test files |
| 219 | + */ |
| 220 | + function getFuzzInput( $filenames ) { |
| 221 | + $dict = ''; |
| 222 | + |
| 223 | + foreach ( $filenames as $filename ) { |
| 224 | + $contents = file_get_contents( $filename ); |
| 225 | + preg_match_all( '/!!\s*input\n(.*?)\n!!\s*result/s', $contents, $matches ); |
| 226 | + |
| 227 | + foreach ( $matches[1] as $match ) { |
| 228 | + $dict .= $match . "\n"; |
| 229 | + } |
| 230 | + } |
| 231 | + |
| 232 | + return $dict; |
| 233 | + } |
| 234 | + |
| 235 | + /** |
| 236 | + * Get a memory usage breakdown |
| 237 | + */ |
| 238 | + function getMemoryBreakdown() { |
| 239 | + $memStats = array(); |
| 240 | + |
| 241 | + foreach ( $GLOBALS as $name => $value ) { |
| 242 | + $memStats['$' . $name] = strlen( serialize( $value ) ); |
| 243 | + } |
| 244 | + |
| 245 | + $classes = get_declared_classes(); |
| 246 | + |
| 247 | + foreach ( $classes as $class ) { |
| 248 | + $rc = new ReflectionClass( $class ); |
| 249 | + $props = $rc->getStaticProperties(); |
| 250 | + $memStats[$class] = strlen( serialize( $props ) ); |
| 251 | + $methods = $rc->getMethods(); |
| 252 | + |
| 253 | + foreach ( $methods as $method ) { |
| 254 | + $memStats[$class] += strlen( serialize( $method->getStaticVariables() ) ); |
| 255 | + } |
| 256 | + } |
| 257 | + |
| 258 | + $functions = get_defined_functions(); |
| 259 | + |
| 260 | + foreach ( $functions['user'] as $function ) { |
| 261 | + $rf = new ReflectionFunction( $function ); |
| 262 | + $memStats["$function()"] = strlen( serialize( $rf->getStaticVariables() ) ); |
| 263 | + } |
| 264 | + |
| 265 | + asort( $memStats ); |
| 266 | + |
| 267 | + return $memStats; |
| 268 | + } |
| 269 | + |
| 270 | + function abort() { |
| 271 | + $this->abort(); |
| 272 | + } |
| 273 | + |
| 274 | + /** |
| 275 | + * Run a series of tests listed in the given text files. |
| 276 | + * Each test consists of a brief description, wikitext input, |
| 277 | + * and the expected HTML output. |
| 278 | + * |
| 279 | + * Prints status updates on stdout and counts up the total |
| 280 | + * number and percentage of passed tests. |
| 281 | + * |
| 282 | + * @param $filenames Array of strings |
| 283 | + * @return Boolean: true if passed all tests, false if any tests failed. |
| 284 | + */ |
| 285 | + public function runTestsFromFiles( $filenames ) { |
| 286 | + $GLOBALS['wgContLang'] = Language::factory( 'en' ); |
| 287 | + $this->recorder->start(); |
| 288 | + $this->setupDatabase(); |
| 289 | + $ok = true; |
| 290 | + |
| 291 | + foreach ( $filenames as $filename ) { |
| 292 | + $tests = new TestFileIterator( $filename, $this ); |
| 293 | + $ok = $this->runTests( $tests ) && $ok; |
| 294 | + } |
| 295 | + |
| 296 | + $this->teardownDatabase(); |
| 297 | + $this->recorder->report(); |
| 298 | + $this->recorder->end(); |
| 299 | + |
| 300 | + return $ok; |
| 301 | + } |
| 302 | + |
| 303 | + function runTests( $tests ) { |
| 304 | + $ok = true; |
| 305 | + |
| 306 | + foreach ( $tests as $i => $t ) { |
| 307 | + $result = |
| 308 | + $this->runTest( $t['test'], $t['input'], $t['result'], $t['options'], $t['config'] ); |
| 309 | + $ok = $ok && $result; |
| 310 | + $this->recorder->record( $t['test'], $result ); |
| 311 | + } |
| 312 | + |
| 313 | + if ( $this->showProgress ) { |
| 314 | + print "\n"; |
| 315 | + } |
| 316 | + |
| 317 | + return $ok; |
| 318 | + } |
| 319 | + |
| 320 | + /** |
| 321 | + * Get a Parser object |
| 322 | + */ |
| 323 | + function getParser( $preprocessor = null ) { |
| 324 | + global $wgParserConf; |
| 325 | + |
| 326 | + $class = $wgParserConf['class']; |
| 327 | + $parser = new $class( array( 'preprocessorClass' => $preprocessor ) + $wgParserConf ); |
| 328 | + |
| 329 | + foreach ( $this->hooks as $tag => $callback ) { |
| 330 | + $parser->setHook( $tag, $callback ); |
| 331 | + } |
| 332 | + |
| 333 | + foreach ( $this->functionHooks as $tag => $bits ) { |
| 334 | + list( $callback, $flags ) = $bits; |
| 335 | + $parser->setFunctionHook( $tag, $callback, $flags ); |
| 336 | + } |
| 337 | + |
| 338 | + wfRunHooks( 'ParserTestParser', array( &$parser ) ); |
| 339 | + |
| 340 | + return $parser; |
| 341 | + } |
| 342 | + |
| 343 | + /** |
| 344 | + * Run a given wikitext input through a freshly-constructed wiki parser, |
| 345 | + * and compare the output against the expected results. |
| 346 | + * Prints status and explanatory messages to stdout. |
| 347 | + * |
| 348 | + * @param $desc String: test's description |
| 349 | + * @param $input String: wikitext to try rendering |
| 350 | + * @param $result String: result to output |
| 351 | + * @param $opts Array: test's options |
| 352 | + * @param $config String: overrides for global variables, one per line |
| 353 | + * @return Boolean |
| 354 | + */ |
| 355 | + public function runTest( $desc, $input, $result, $opts, $config ) { |
| 356 | + if ( $this->showProgress ) { |
| 357 | + $this->showTesting( $desc ); |
| 358 | + } |
| 359 | + |
| 360 | + $opts = $this->parseOptions( $opts ); |
| 361 | + $this->setupGlobals( $opts, $config ); |
| 362 | + |
| 363 | + $user = new User(); |
| 364 | + $options = ParserOptions::newFromUser( $user ); |
| 365 | + |
| 366 | + if ( isset( $opts['title'] ) ) { |
| 367 | + $titleText = $opts['title']; |
| 368 | + } |
| 369 | + else { |
| 370 | + $titleText = 'Parser test'; |
| 371 | + } |
| 372 | + |
| 373 | + $noxml = isset( $opts['noxml'] ); |
| 374 | + $local = isset( $opts['local'] ); |
| 375 | + $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null; |
| 376 | + $parser = $this->getParser( $preprocessor ); |
| 377 | + $title = Title::newFromText( $titleText ); |
| 378 | + |
| 379 | + if ( isset( $opts['pst'] ) ) { |
| 380 | + $out = $parser->preSaveTransform( $input, $title, $user, $options ); |
| 381 | + } elseif ( isset( $opts['msg'] ) ) { |
| 382 | + $out = $parser->transformMsg( $input, $options ); |
| 383 | + } elseif ( isset( $opts['section'] ) ) { |
| 384 | + $section = $opts['section']; |
| 385 | + $out = $parser->getSection( $input, $section ); |
| 386 | + } elseif ( isset( $opts['replace'] ) ) { |
| 387 | + $section = $opts['replace'][0]; |
| 388 | + $replace = $opts['replace'][1]; |
| 389 | + $out = $parser->replaceSection( $input, $section, $replace ); |
| 390 | + } elseif ( isset( $opts['comment'] ) ) { |
| 391 | + $linker = $user->getSkin(); |
| 392 | + $out = $linker->formatComment( $input, $title, $local ); |
| 393 | + } elseif ( isset( $opts['preload'] ) ) { |
| 394 | + $out = $parser->getpreloadText( $input, $title, $options ); |
| 395 | + } else { |
| 396 | + $output = $parser->parse( $input, $title, $options, true, true, 1337 ); |
| 397 | + $out = $output->getText(); |
| 398 | + |
| 399 | + if ( isset( $opts['showtitle'] ) ) { |
| 400 | + if ( $output->getTitleText() ) { |
| 401 | + $title = $output->getTitleText(); |
| 402 | + } |
| 403 | + |
| 404 | + $out = "$title\n$out"; |
| 405 | + } |
| 406 | + |
| 407 | + if ( isset( $opts['ill'] ) ) { |
| 408 | + $out = $this->tidy( implode( ' ', $output->getLanguageLinks() ) ); |
| 409 | + } elseif ( isset( $opts['cat'] ) ) { |
| 410 | + global $wgOut; |
| 411 | + |
| 412 | + $wgOut->addCategoryLinks( $output->getCategories() ); |
| 413 | + $cats = $wgOut->getCategoryLinks(); |
| 414 | + |
| 415 | + if ( isset( $cats['normal'] ) ) { |
| 416 | + $out = $this->tidy( implode( ' ', $cats['normal'] ) ); |
| 417 | + } else { |
| 418 | + $out = ''; |
| 419 | + } |
| 420 | + } |
| 421 | + |
| 422 | + $result = $this->tidy( $result ); |
| 423 | + } |
| 424 | + |
| 425 | + |
| 426 | + $this->teardownGlobals(); |
| 427 | + |
| 428 | + if ( $result === $out && ( $noxml === true || $this->wellFormed( $out ) ) ) { |
| 429 | + return $this->showSuccess( $desc ); |
| 430 | + } else { |
| 431 | + return $this->showFailure( $desc, $result, $out ); |
| 432 | + } |
| 433 | + } |
| 434 | + |
| 435 | + /** |
| 436 | + * Use a regex to find out the value of an option |
| 437 | + * @param $key String: name of option val to retrieve |
| 438 | + * @param $opts Options array to look in |
| 439 | + * @param $default Mixed: default value returned if not found |
| 440 | + */ |
| 441 | + private static function getOptionValue( $key, $opts, $default ) { |
| 442 | + $key = strtolower( $key ); |
| 443 | + |
| 444 | + if ( isset( $opts[$key] ) ) { |
| 445 | + return $opts[$key]; |
| 446 | + } else { |
| 447 | + return $default; |
| 448 | + } |
| 449 | + } |
| 450 | + |
| 451 | + private function parseOptions( $instring ) { |
| 452 | + $opts = array(); |
| 453 | + $lines = explode( "\n", $instring ); |
| 454 | + // foo |
| 455 | + // foo=bar |
| 456 | + // foo="bar baz" |
| 457 | + // foo=[[bar baz]] |
| 458 | + // foo=bar,"baz quux" |
| 459 | + $regex = '/\b |
| 460 | + ([\w-]+) # Key |
| 461 | + \b |
| 462 | + (?:\s* |
| 463 | + = # First sub-value |
| 464 | + \s* |
| 465 | + ( |
| 466 | + " |
| 467 | + [^"]* # Quoted val |
| 468 | + " |
| 469 | + | |
| 470 | + \[\[ |
| 471 | + [^]]* # Link target |
| 472 | + \]\] |
| 473 | + | |
| 474 | + [\w-]+ # Plain word |
| 475 | + ) |
| 476 | + (?:\s* |
| 477 | + , # Sub-vals 1..N |
| 478 | + \s* |
| 479 | + ( |
| 480 | + "[^"]*" # Quoted val |
| 481 | + | |
| 482 | + \[\[[^]]*\]\] # Link target |
| 483 | + | |
| 484 | + [\w-]+ # Plain word |
| 485 | + ) |
| 486 | + )* |
| 487 | + )? |
| 488 | + /x'; |
| 489 | + |
| 490 | + if ( preg_match_all( $regex, $instring, $matches, PREG_SET_ORDER ) ) { |
| 491 | + foreach ( $matches as $bits ) { |
| 492 | + $match = array_shift( $bits ); |
| 493 | + $key = strtolower( array_shift( $bits ) ); |
| 494 | + if ( count( $bits ) == 0 ) { |
| 495 | + $opts[$key] = true; |
| 496 | + } elseif ( count( $bits ) == 1 ) { |
| 497 | + $opts[$key] = $this->cleanupOption( array_shift( $bits ) ); |
| 498 | + } else { |
| 499 | + // Array! |
| 500 | + $opts[$key] = array_map( array( $this, 'cleanupOption' ), $bits ); |
| 501 | + } |
| 502 | + } |
| 503 | + } |
| 504 | + return $opts; |
| 505 | + } |
| 506 | + |
| 507 | + private function cleanupOption( $opt ) { |
| 508 | + if ( substr( $opt, 0, 1 ) == '"' ) { |
| 509 | + return substr( $opt, 1, -1 ); |
| 510 | + } |
| 511 | + |
| 512 | + if ( substr( $opt, 0, 2 ) == '[[' ) { |
| 513 | + return substr( $opt, 2, -2 ); |
| 514 | + } |
| 515 | + return $opt; |
| 516 | + } |
| 517 | + |
| 518 | + /** |
| 519 | + * Set up the global variables for a consistent environment for each test. |
| 520 | + * Ideally this should replace the global configuration entirely. |
| 521 | + */ |
| 522 | + private function setupGlobals( $opts = '', $config = '' ) { |
| 523 | + global $wgDBtype; |
| 524 | + |
| 525 | + # Find out values for some special options. |
| 526 | + $lang = |
| 527 | + self::getOptionValue( 'language', $opts, 'en' ); |
| 528 | + $variant = |
| 529 | + self::getOptionValue( 'variant', $opts, false ); |
| 530 | + $maxtoclevel = |
| 531 | + self::getOptionValue( 'wgMaxTocLevel', $opts, 999 ); |
| 532 | + $linkHolderBatchSize = |
| 533 | + self::getOptionValue( 'wgLinkHolderBatchSize', $opts, 1000 ); |
| 534 | + |
| 535 | + $settings = array( |
| 536 | + 'wgServer' => 'http://localhost', |
| 537 | + 'wgScript' => '/index.php', |
| 538 | + 'wgScriptPath' => '/', |
| 539 | + 'wgArticlePath' => '/wiki/$1', |
| 540 | + 'wgActionPaths' => array(), |
| 541 | + 'wgLocalFileRepo' => array( |
| 542 | + 'class' => 'LocalRepo', |
| 543 | + 'name' => 'local', |
| 544 | + 'directory' => $this->uploadDir, |
| 545 | + 'url' => 'http://example.com/images', |
| 546 | + 'hashLevels' => 2, |
| 547 | + 'transformVia404' => false, |
| 548 | + ), |
| 549 | + 'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ), |
| 550 | + 'wgStyleSheetPath' => '/skins', |
| 551 | + 'wgSitename' => 'MediaWiki', |
| 552 | + 'wgServerName' => 'Britney-Spears', |
| 553 | + 'wgLanguageCode' => $lang, |
| 554 | + 'wgDBprefix' => $wgDBtype != 'oracle' ? 'parsertest_' : 'pt_', |
| 555 | + 'wgRawHtml' => isset( $opts['rawhtml'] ), |
| 556 | + 'wgLang' => null, |
| 557 | + 'wgContLang' => null, |
| 558 | + 'wgNamespacesWithSubpages' => array( 0 => isset( $opts['subpage'] ) ), |
| 559 | + 'wgMaxTocLevel' => $maxtoclevel, |
| 560 | + 'wgCapitalLinks' => true, |
| 561 | + 'wgNoFollowLinks' => true, |
| 562 | + 'wgNoFollowDomainExceptions' => array(), |
| 563 | + 'wgThumbnailScriptPath' => false, |
| 564 | + 'wgUseImageResize' => false, |
| 565 | + 'wgUseTeX' => isset( $opts['math'] ), |
| 566 | + 'wgMathDirectory' => $this->uploadDir . '/math', |
| 567 | + 'wgLocaltimezone' => 'UTC', |
| 568 | + 'wgAllowExternalImages' => true, |
| 569 | + 'wgUseTidy' => false, |
| 570 | + 'wgDefaultLanguageVariant' => $variant, |
| 571 | + 'wgVariantArticlePath' => false, |
| 572 | + 'wgGroupPermissions' => array( '*' => array( |
| 573 | + 'createaccount' => true, |
| 574 | + 'read' => true, |
| 575 | + 'edit' => true, |
| 576 | + 'createpage' => true, |
| 577 | + 'createtalk' => true, |
| 578 | + ) ), |
| 579 | + 'wgNamespaceProtection' => array( NS_MEDIAWIKI => 'editinterface' ), |
| 580 | + 'wgDefaultExternalStore' => array(), |
| 581 | + 'wgForeignFileRepos' => array(), |
| 582 | + 'wgLinkHolderBatchSize' => $linkHolderBatchSize, |
| 583 | + 'wgExperimentalHtmlIds' => false, |
| 584 | + 'wgExternalLinkTarget' => false, |
| 585 | + 'wgAlwaysUseTidy' => false, |
| 586 | + 'wgHtml5' => true, |
| 587 | + 'wgWellFormedXml' => true, |
| 588 | + 'wgAllowMicrodataAttributes' => true, |
| 589 | + ); |
| 590 | + |
| 591 | + if ( $config ) { |
| 592 | + $configLines = explode( "\n", $config ); |
| 593 | + |
| 594 | + foreach ( $configLines as $line ) { |
| 595 | + list( $var, $value ) = explode( '=', $line, 2 ); |
| 596 | + |
| 597 | + $settings[$var] = eval( "return $value;" ); |
| 598 | + } |
| 599 | + } |
| 600 | + |
| 601 | + $this->savedGlobals = array(); |
| 602 | + |
| 603 | + foreach ( $settings as $var => $val ) { |
| 604 | + if ( array_key_exists( $var, $GLOBALS ) ) { |
| 605 | + $this->savedGlobals[$var] = $GLOBALS[$var]; |
| 606 | + } |
| 607 | + |
| 608 | + $GLOBALS[$var] = $val; |
| 609 | + } |
| 610 | + |
| 611 | + $langObj = Language::factory( $lang ); |
| 612 | + $GLOBALS['wgLang'] = $langObj; |
| 613 | + $GLOBALS['wgContLang'] = $langObj; |
| 614 | + $GLOBALS['wgMemc'] = new FakeMemCachedClient; |
| 615 | + $GLOBALS['wgOut'] = new OutputPage; |
| 616 | + |
| 617 | + global $wgHooks; |
| 618 | + |
| 619 | + $wgHooks['ParserTestParser'][] = 'ParserTestParserHook::setup'; |
| 620 | + $wgHooks['ParserTestParser'][] = 'ParserTestStaticParserHook::setup'; |
| 621 | + $wgHooks['ParserGetVariableValueTs'][] = 'ParserTest::getFakeTimestamp'; |
| 622 | + |
| 623 | + MagicWord::clearCache(); |
| 624 | + |
| 625 | + global $wgUser; |
| 626 | + $wgUser = new User(); |
| 627 | + } |
| 628 | + |
| 629 | + /** |
| 630 | + * List of temporary tables to create, without prefix. |
| 631 | + * Some of these probably aren't necessary. |
| 632 | + */ |
| 633 | + private function listTables() { |
| 634 | + global $wgDBtype; |
| 635 | + |
| 636 | + $tables = array( 'user', 'user_properties', 'page', 'page_restrictions', |
| 637 | + 'protected_titles', 'revision', 'text', 'pagelinks', 'imagelinks', |
| 638 | + 'categorylinks', 'templatelinks', 'externallinks', 'langlinks', 'iwlinks', |
| 639 | + 'site_stats', 'hitcounter', 'ipblocks', 'image', 'oldimage', |
| 640 | + 'recentchanges', 'watchlist', 'math', 'interwiki', 'logging', |
| 641 | + 'querycache', 'objectcache', 'job', 'l10n_cache', 'redirect', 'querycachetwo', |
| 642 | + 'archive', 'user_groups', 'page_props', 'category', 'msg_resource', 'msg_resource_links' |
| 643 | + ); |
| 644 | + |
| 645 | + if ( in_array( $wgDBtype, array( 'mysql', 'sqlite' ) ) ) |
| 646 | + array_push( $tables, 'searchindex' ); |
| 647 | + |
| 648 | + // Allow extensions to add to the list of tables to duplicate; |
| 649 | + // may be necessary if they hook into page save or other code |
| 650 | + // which will require them while running tests. |
| 651 | + wfRunHooks( 'ParserTestTables', array( &$tables ) ); |
| 652 | + |
| 653 | + return $tables; |
| 654 | + } |
| 655 | + |
| 656 | + /** |
| 657 | + * Set up a temporary set of wiki tables to work with for the tests. |
| 658 | + * Currently this will only be done once per run, and any changes to |
| 659 | + * the db will be visible to later tests in the run. |
| 660 | + */ |
| 661 | + public function setupDatabase() { |
| 662 | + global $wgDBprefix, $wgDBtype; |
| 663 | + |
| 664 | + if ( $this->databaseSetupDone ) { |
| 665 | + return; |
| 666 | + } |
| 667 | + |
| 668 | + if ( $wgDBprefix === 'parsertest_' || ( $wgDBtype == 'oracle' && $wgDBprefix === 'pt_' ) ) { |
| 669 | + throw new MWException( 'setupDatabase should be called before setupGlobals' ); |
| 670 | + } |
| 671 | + |
| 672 | + $this->databaseSetupDone = true; |
| 673 | + $this->oldTablePrefix = $wgDBprefix; |
| 674 | + |
| 675 | + # SqlBagOStuff broke when using temporary tables on r40209 (bug 15892). |
| 676 | + # It seems to have been fixed since (r55079?). |
| 677 | + # If it fails, $wgCaches[CACHE_DB] = new HashBagOStuff(); should work around it. |
| 678 | + |
| 679 | + # CREATE TEMPORARY TABLE breaks if there is more than one server |
| 680 | + if ( wfGetLB()->getServerCount() != 1 ) { |
| 681 | + $this->useTemporaryTables = false; |
| 682 | + } |
| 683 | + |
| 684 | + $temporary = $this->useTemporaryTables || $wgDBtype == 'postgres'; |
| 685 | + |
| 686 | + $db = wfGetDB( DB_MASTER ); |
| 687 | + $tables = $this->listTables(); |
| 688 | + |
| 689 | + foreach ( $tables as $tbl ) { |
| 690 | + # Clean up from previous aborted run. So that table escaping |
| 691 | + # works correctly across DB engines, we need to change the pre- |
| 692 | + # fix back and forth so tableName() works right. |
| 693 | + $this->changePrefix( $this->oldTablePrefix ); |
| 694 | + $oldTableName = $db->tableName( $tbl ); |
| 695 | + $this->changePrefix( $wgDBtype != 'oracle' ? 'parsertest_' : 'pt_' ); |
| 696 | + $newTableName = $db->tableName( $tbl ); |
| 697 | + |
| 698 | + if ( $wgDBtype == 'mysql' ) { |
| 699 | + $db->query( "DROP TABLE IF EXISTS $newTableName" ); |
| 700 | + } elseif ( in_array( $wgDBtype, array( 'postgres', 'oracle' ) ) ) { |
| 701 | + /* DROPs wouldn't work due to Foreign Key Constraints (bug 14990, r58669) |
| 702 | + * Use "DROP TABLE IF EXISTS $newTableName CASCADE" for postgres? That |
| 703 | + * syntax would also work for mysql. |
| 704 | + */ |
| 705 | + } elseif ( $db->tableExists( $tbl ) ) { |
| 706 | + $db->query( "DROP TABLE $newTableName" ); |
| 707 | + } |
| 708 | + |
| 709 | + # Create new table |
| 710 | + $db->duplicateTableStructure( $oldTableName, $newTableName, $temporary ); |
| 711 | + } |
| 712 | + |
| 713 | + if ( $wgDBtype == 'oracle' ) |
| 714 | + $db->query( 'BEGIN FILL_WIKI_INFO; END;' ); |
| 715 | + |
| 716 | + $this->changePrefix( $wgDBtype != 'oracle' ? 'parsertest_' : 'pt_' ); |
| 717 | + |
| 718 | + # Hack: insert a few Wikipedia in-project interwiki prefixes, |
| 719 | + # for testing inter-language links |
| 720 | + $db->insert( 'interwiki', array( |
| 721 | + array( 'iw_prefix' => 'wikipedia', |
| 722 | + 'iw_url' => 'http://en.wikipedia.org/wiki/$1', |
| 723 | + 'iw_api' => '', |
| 724 | + 'iw_wikiid' => '', |
| 725 | + 'iw_local' => 0 ), |
| 726 | + array( 'iw_prefix' => 'meatball', |
| 727 | + 'iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', |
| 728 | + 'iw_api' => '', |
| 729 | + 'iw_wikiid' => '', |
| 730 | + 'iw_local' => 0 ), |
| 731 | + array( 'iw_prefix' => 'zh', |
| 732 | + 'iw_url' => 'http://zh.wikipedia.org/wiki/$1', |
| 733 | + 'iw_api' => '', |
| 734 | + 'iw_wikiid' => '', |
| 735 | + 'iw_local' => 1 ), |
| 736 | + array( 'iw_prefix' => 'es', |
| 737 | + 'iw_url' => 'http://es.wikipedia.org/wiki/$1', |
| 738 | + 'iw_api' => '', |
| 739 | + 'iw_wikiid' => '', |
| 740 | + 'iw_local' => 1 ), |
| 741 | + array( 'iw_prefix' => 'fr', |
| 742 | + 'iw_url' => 'http://fr.wikipedia.org/wiki/$1', |
| 743 | + 'iw_api' => '', |
| 744 | + 'iw_wikiid' => '', |
| 745 | + 'iw_local' => 1 ), |
| 746 | + array( 'iw_prefix' => 'ru', |
| 747 | + 'iw_url' => 'http://ru.wikipedia.org/wiki/$1', |
| 748 | + 'iw_api' => '', |
| 749 | + 'iw_wikiid' => '', |
| 750 | + 'iw_local' => 1 ), |
| 751 | + ) ); |
| 752 | + |
| 753 | + |
| 754 | + if ( $wgDBtype == 'oracle' ) { |
| 755 | + # Insert 0 user to prevent FK violations |
| 756 | + |
| 757 | + # Anonymous user |
| 758 | + $db->insert( 'user', array( |
| 759 | + 'user_id' => 0, |
| 760 | + 'user_name' => 'Anonymous' ) ); |
| 761 | + } |
| 762 | + |
| 763 | + # Update certain things in site_stats |
| 764 | + $db->insert( 'site_stats', array( 'ss_row_id' => 1, 'ss_images' => 2, 'ss_good_articles' => 1 ) ); |
| 765 | + |
| 766 | + # Reinitialise the LocalisationCache to match the database state |
| 767 | + Language::getLocalisationCache()->unloadAll(); |
| 768 | + |
| 769 | + # Make a new message cache |
| 770 | + global $wgMessageCache, $wgMemc; |
| 771 | + $wgMessageCache = new MessageCache( $wgMemc, true, 3600 ); |
| 772 | + |
| 773 | + $this->uploadDir = $this->setupUploadDir(); |
| 774 | + $user = User::createNew( 'WikiSysop' ); |
| 775 | + $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Foobar.jpg' ) ); |
| 776 | + $image->recordUpload2( '', 'Upload of some lame file', 'Some lame file', array( |
| 777 | + 'size' => 12345, |
| 778 | + 'width' => 1941, |
| 779 | + 'height' => 220, |
| 780 | + 'bits' => 24, |
| 781 | + 'media_type' => MEDIATYPE_BITMAP, |
| 782 | + 'mime' => 'image/jpeg', |
| 783 | + 'metadata' => serialize( array() ), |
| 784 | + 'sha1' => sha1( '' ), |
| 785 | + 'fileExists' => true |
| 786 | + ), $db->timestamp( '20010115123500' ), $user ); |
| 787 | + |
| 788 | + # This image will be blacklisted in [[MediaWiki:Bad image list]] |
| 789 | + $image = wfLocalFile( Title::makeTitle( NS_FILE, 'Bad.jpg' ) ); |
| 790 | + $image->recordUpload2( '', 'zomgnotcensored', 'Borderline image', array( |
| 791 | + 'size' => 12345, |
| 792 | + 'width' => 320, |
| 793 | + 'height' => 240, |
| 794 | + 'bits' => 24, |
| 795 | + 'media_type' => MEDIATYPE_BITMAP, |
| 796 | + 'mime' => 'image/jpeg', |
| 797 | + 'metadata' => serialize( array() ), |
| 798 | + 'sha1' => sha1( '' ), |
| 799 | + 'fileExists' => true |
| 800 | + ), $db->timestamp( '20010115123500' ), $user ); |
| 801 | + } |
| 802 | + |
| 803 | + /** |
| 804 | + * Change the table prefix on all open DB connections/ |
| 805 | + */ |
| 806 | + protected function changePrefix( $prefix ) { |
| 807 | + global $wgDBprefix; |
| 808 | + wfGetLBFactory()->forEachLB( array( $this, 'changeLBPrefix' ), array( $prefix ) ); |
| 809 | + $wgDBprefix = $prefix; |
| 810 | + } |
| 811 | + |
| 812 | + public function changeLBPrefix( $lb, $prefix ) { |
| 813 | + $lb->forEachOpenConnection( array( $this, 'changeDBPrefix' ), array( $prefix ) ); |
| 814 | + } |
| 815 | + |
| 816 | + public function changeDBPrefix( $db, $prefix ) { |
| 817 | + $db->tablePrefix( $prefix ); |
| 818 | + } |
| 819 | + |
| 820 | + public function teardownDatabase() { |
| 821 | + global $wgDBtype; |
| 822 | + |
| 823 | + if ( !$this->databaseSetupDone ) { |
| 824 | + return; |
| 825 | + } |
| 826 | + $this->teardownUploadDir( $this->uploadDir ); |
| 827 | + |
| 828 | + $this->changePrefix( $this->oldTablePrefix ); |
| 829 | + $this->databaseSetupDone = false; |
| 830 | + |
| 831 | + if ( $this->useTemporaryTables ) { |
| 832 | + # Don't need to do anything |
| 833 | + return; |
| 834 | + } |
| 835 | + |
| 836 | + $tables = $this->listTables(); |
| 837 | + $db = wfGetDB( DB_MASTER ); |
| 838 | + |
| 839 | + foreach ( $tables as $table ) { |
| 840 | + $sql = $wgDBtype == 'oracle' ? "DROP TABLE pt_$table DROP CONSTRAINTS" : "DROP TABLE `parsertest_$table`"; |
| 841 | + $db->query( $sql ); |
| 842 | + } |
| 843 | + |
| 844 | + if ( $wgDBtype == 'oracle' ) |
| 845 | + $db->query( 'BEGIN FILL_WIKI_INFO; END;' ); |
| 846 | + } |
| 847 | + |
| 848 | + /** |
| 849 | + * Create a dummy uploads directory which will contain a couple |
| 850 | + * of files in order to pass existence tests. |
| 851 | + * |
| 852 | + * @return String: the directory |
| 853 | + */ |
| 854 | + private function setupUploadDir() { |
| 855 | + global $IP; |
| 856 | + |
| 857 | + if ( $this->keepUploads ) { |
| 858 | + $dir = wfTempDir() . '/mwParser-images'; |
| 859 | + |
| 860 | + if ( is_dir( $dir ) ) { |
| 861 | + return $dir; |
| 862 | + } |
| 863 | + } else { |
| 864 | + $dir = wfTempDir() . "/mwParser-" . mt_rand() . "-images"; |
| 865 | + } |
| 866 | + |
| 867 | + // wfDebug( "Creating upload directory $dir\n" ); |
| 868 | + if ( file_exists( $dir ) ) { |
| 869 | + wfDebug( "Already exists!\n" ); |
| 870 | + return $dir; |
| 871 | + } |
| 872 | + |
| 873 | + wfMkdirParents( $dir . '/3/3a' ); |
| 874 | + copy( "$IP/skins/monobook/headbg.jpg", "$dir/3/3a/Foobar.jpg" ); |
| 875 | + wfMkdirParents( $dir . '/0/09' ); |
| 876 | + copy( "$IP/skins/monobook/headbg.jpg", "$dir/0/09/Bad.jpg" ); |
| 877 | + |
| 878 | + return $dir; |
| 879 | + } |
| 880 | + |
| 881 | + /** |
| 882 | + * Restore default values and perform any necessary clean-up |
| 883 | + * after each test runs. |
| 884 | + */ |
| 885 | + private function teardownGlobals() { |
| 886 | + RepoGroup::destroySingleton(); |
| 887 | + LinkCache::singleton()->clear(); |
| 888 | + |
| 889 | + foreach ( $this->savedGlobals as $var => $val ) { |
| 890 | + $GLOBALS[$var] = $val; |
| 891 | + } |
| 892 | + } |
| 893 | + |
| 894 | + /** |
| 895 | + * Remove the dummy uploads directory |
| 896 | + */ |
| 897 | + private function teardownUploadDir( $dir ) { |
| 898 | + if ( $this->keepUploads ) { |
| 899 | + return; |
| 900 | + } |
| 901 | + |
| 902 | + // delete the files first, then the dirs. |
| 903 | + self::deleteFiles( |
| 904 | + array ( |
| 905 | + "$dir/3/3a/Foobar.jpg", |
| 906 | + "$dir/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg", |
| 907 | + "$dir/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg", |
| 908 | + "$dir/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg", |
| 909 | + "$dir/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg", |
| 910 | + |
| 911 | + "$dir/0/09/Bad.jpg", |
| 912 | + |
| 913 | + "$dir/math/f/a/5/fa50b8b616463173474302ca3e63586b.png", |
| 914 | + ) |
| 915 | + ); |
| 916 | + |
| 917 | + self::deleteDirs( |
| 918 | + array ( |
| 919 | + "$dir/3/3a", |
| 920 | + "$dir/3", |
| 921 | + "$dir/thumb/6/65", |
| 922 | + "$dir/thumb/6", |
| 923 | + "$dir/thumb/3/3a/Foobar.jpg", |
| 924 | + "$dir/thumb/3/3a", |
| 925 | + "$dir/thumb/3", |
| 926 | + |
| 927 | + "$dir/0/09/", |
| 928 | + "$dir/0/", |
| 929 | + "$dir/thumb", |
| 930 | + "$dir/math/f/a/5", |
| 931 | + "$dir/math/f/a", |
| 932 | + "$dir/math/f", |
| 933 | + "$dir/math", |
| 934 | + "$dir", |
| 935 | + ) |
| 936 | + ); |
| 937 | + } |
| 938 | + |
| 939 | + /** |
| 940 | + * Delete the specified files, if they exist. |
| 941 | + * @param $files Array: full paths to files to delete. |
| 942 | + */ |
| 943 | + private static function deleteFiles( $files ) { |
| 944 | + foreach ( $files as $file ) { |
| 945 | + if ( file_exists( $file ) ) { |
| 946 | + unlink( $file ); |
| 947 | + } |
| 948 | + } |
| 949 | + } |
| 950 | + |
| 951 | + /** |
| 952 | + * Delete the specified directories, if they exist. Must be empty. |
| 953 | + * @param $dirs Array: full paths to directories to delete. |
| 954 | + */ |
| 955 | + private static function deleteDirs( $dirs ) { |
| 956 | + foreach ( $dirs as $dir ) { |
| 957 | + if ( is_dir( $dir ) ) { |
| 958 | + rmdir( $dir ); |
| 959 | + } |
| 960 | + } |
| 961 | + } |
| 962 | + |
| 963 | + /** |
| 964 | + * "Running test $desc..." |
| 965 | + */ |
| 966 | + protected function showTesting( $desc ) { |
| 967 | + print "Running test $desc... "; |
| 968 | + } |
| 969 | + |
| 970 | + /** |
| 971 | + * Print a happy success message. |
| 972 | + * |
| 973 | + * @param $desc String: the test name |
| 974 | + * @return Boolean |
| 975 | + */ |
| 976 | + protected function showSuccess( $desc ) { |
| 977 | + if ( $this->showProgress ) { |
| 978 | + print $this->term->color( '1;32' ) . 'PASSED' . $this->term->reset() . "\n"; |
| 979 | + } |
| 980 | + |
| 981 | + return true; |
| 982 | + } |
| 983 | + |
| 984 | + /** |
| 985 | + * Print a failure message and provide some explanatory output |
| 986 | + * about what went wrong if so configured. |
| 987 | + * |
| 988 | + * @param $desc String: the test name |
| 989 | + * @param $result String: expected HTML output |
| 990 | + * @param $html String: actual HTML output |
| 991 | + * @return Boolean |
| 992 | + */ |
| 993 | + protected function showFailure( $desc, $result, $html ) { |
| 994 | + if ( $this->showFailure ) { |
| 995 | + if ( !$this->showProgress ) { |
| 996 | + # In quiet mode we didn't show the 'Testing' message before the |
| 997 | + # test, in case it succeeded. Show it now: |
| 998 | + $this->showTesting( $desc ); |
| 999 | + } |
| 1000 | + |
| 1001 | + print $this->term->color( '31' ) . 'FAILED!' . $this->term->reset() . "\n"; |
| 1002 | + |
| 1003 | + if ( $this->showOutput ) { |
| 1004 | + print "--- Expected ---\n$result\n--- Actual ---\n$html\n"; |
| 1005 | + } |
| 1006 | + |
| 1007 | + if ( $this->showDiffs ) { |
| 1008 | + print $this->quickDiff( $result, $html ); |
| 1009 | + if ( !$this->wellFormed( $html ) ) { |
| 1010 | + print "XML error: $this->mXmlError\n"; |
| 1011 | + } |
| 1012 | + } |
| 1013 | + } |
| 1014 | + |
| 1015 | + return false; |
| 1016 | + } |
| 1017 | + |
| 1018 | + /** |
| 1019 | + * Run given strings through a diff and return the (colorized) output. |
| 1020 | + * Requires writable /tmp directory and a 'diff' command in the PATH. |
| 1021 | + * |
| 1022 | + * @param $input String |
| 1023 | + * @param $output String |
| 1024 | + * @param $inFileTail String: tailing for the input file name |
| 1025 | + * @param $outFileTail String: tailing for the output file name |
| 1026 | + * @return String |
| 1027 | + */ |
| 1028 | + protected function quickDiff( $input, $output, $inFileTail = 'expected', $outFileTail = 'actual' ) { |
| 1029 | + $prefix = wfTempDir() . "/mwParser-" . mt_rand(); |
| 1030 | + |
| 1031 | + $infile = "$prefix-$inFileTail"; |
| 1032 | + $this->dumpToFile( $input, $infile ); |
| 1033 | + |
| 1034 | + $outfile = "$prefix-$outFileTail"; |
| 1035 | + $this->dumpToFile( $output, $outfile ); |
| 1036 | + |
| 1037 | + $diff = `diff -au $infile $outfile`; |
| 1038 | + unlink( $infile ); |
| 1039 | + unlink( $outfile ); |
| 1040 | + |
| 1041 | + return $this->colorDiff( $diff ); |
| 1042 | + } |
| 1043 | + |
| 1044 | + /** |
| 1045 | + * Write the given string to a file, adding a final newline. |
| 1046 | + * |
| 1047 | + * @param $data String |
| 1048 | + * @param $filename String |
| 1049 | + */ |
| 1050 | + private function dumpToFile( $data, $filename ) { |
| 1051 | + $file = fopen( $filename, "wt" ); |
| 1052 | + fwrite( $file, $data . "\n" ); |
| 1053 | + fclose( $file ); |
| 1054 | + } |
| 1055 | + |
| 1056 | + /** |
| 1057 | + * Colorize unified diff output if set for ANSI color output. |
| 1058 | + * Subtractions are colored blue, additions red. |
| 1059 | + * |
| 1060 | + * @param $text String |
| 1061 | + * @return String |
| 1062 | + */ |
| 1063 | + protected function colorDiff( $text ) { |
| 1064 | + return preg_replace( |
| 1065 | + array( '/^(-.*)$/m', '/^(\+.*)$/m' ), |
| 1066 | + array( $this->term->color( 34 ) . '$1' . $this->term->reset(), |
| 1067 | + $this->term->color( 31 ) . '$1' . $this->term->reset() ), |
| 1068 | + $text ); |
| 1069 | + } |
| 1070 | + |
| 1071 | + /** |
| 1072 | + * Show "Reading tests from ..." |
| 1073 | + * |
| 1074 | + * @param $path String |
| 1075 | + */ |
| 1076 | + public function showRunFile( $path ) { |
| 1077 | + print $this->term->color( 1 ) . |
| 1078 | + "Reading tests from \"$path\"..." . |
| 1079 | + $this->term->reset() . |
| 1080 | + "\n"; |
| 1081 | + } |
| 1082 | + |
| 1083 | + /** |
| 1084 | + * Insert a temporary test article |
| 1085 | + * @param $name String: the title, including any prefix |
| 1086 | + * @param $text String: the article text |
| 1087 | + * @param $line Integer: the input line number, for reporting errors |
| 1088 | + */ |
| 1089 | + public function addArticle( $name, $text, $line ) { |
| 1090 | + global $wgCapitalLinks; |
| 1091 | + $oldCapitalLinks = $wgCapitalLinks; |
| 1092 | + $wgCapitalLinks = true; // We only need this from SetupGlobals() See r70917#c8637 |
| 1093 | + |
| 1094 | + $title = Title::newFromText( $name ); |
| 1095 | + |
| 1096 | + if ( is_null( $title ) ) { |
| 1097 | + wfDie( "invalid title at line $line\n" ); |
| 1098 | + } |
| 1099 | + |
| 1100 | + $aid = $title->getArticleID( GAID_FOR_UPDATE ); |
| 1101 | + |
| 1102 | + if ( $aid != 0 ) { |
| 1103 | + wfDie( "duplicate article '$name' at line $line\n" ); |
| 1104 | + } |
| 1105 | + |
| 1106 | + $art = new Article( $title ); |
| 1107 | + $art->insertNewArticle( $text, '', false, false ); |
| 1108 | + |
| 1109 | + $wgCapitalLinks = $oldCapitalLinks; |
| 1110 | + } |
| 1111 | + |
| 1112 | + /** |
| 1113 | + * Steal a callback function from the primary parser, save it for |
| 1114 | + * application to our scary parser. If the hook is not installed, |
| 1115 | + * abort processing of this file. |
| 1116 | + * |
| 1117 | + * @param $name String |
| 1118 | + * @return Bool true if tag hook is present |
| 1119 | + */ |
| 1120 | + public function requireHook( $name ) { |
| 1121 | + global $wgParser; |
| 1122 | + |
| 1123 | + $wgParser->firstCallInit( ); // make sure hooks are loaded. |
| 1124 | + |
| 1125 | + if ( isset( $wgParser->mTagHooks[$name] ) ) { |
| 1126 | + $this->hooks[$name] = $wgParser->mTagHooks[$name]; |
| 1127 | + } else { |
| 1128 | + echo " This test suite requires the '$name' hook extension, skipping.\n"; |
| 1129 | + return false; |
| 1130 | + } |
| 1131 | + |
| 1132 | + return true; |
| 1133 | + } |
| 1134 | + |
| 1135 | + /** |
| 1136 | + * Steal a callback function from the primary parser, save it for |
| 1137 | + * application to our scary parser. If the hook is not installed, |
| 1138 | + * abort processing of this file. |
| 1139 | + * |
| 1140 | + * @param $name String |
| 1141 | + * @return Bool true if function hook is present |
| 1142 | + */ |
| 1143 | + public function requireFunctionHook( $name ) { |
| 1144 | + global $wgParser; |
| 1145 | + |
| 1146 | + $wgParser->firstCallInit( ); // make sure hooks are loaded. |
| 1147 | + |
| 1148 | + if ( isset( $wgParser->mFunctionHooks[$name] ) ) { |
| 1149 | + $this->functionHooks[$name] = $wgParser->mFunctionHooks[$name]; |
| 1150 | + } else { |
| 1151 | + echo " This test suite requires the '$name' function hook extension, skipping.\n"; |
| 1152 | + return false; |
| 1153 | + } |
| 1154 | + |
| 1155 | + return true; |
| 1156 | + } |
| 1157 | + |
| 1158 | + /* |
| 1159 | + * Run the "tidy" command on text if the $wgUseTidy |
| 1160 | + * global is true |
| 1161 | + * |
| 1162 | + * @param $text String: the text to tidy |
| 1163 | + * @return String |
| 1164 | + * @static |
| 1165 | + */ |
| 1166 | + private function tidy( $text ) { |
| 1167 | + global $wgUseTidy; |
| 1168 | + |
| 1169 | + if ( $wgUseTidy ) { |
| 1170 | + $text = MWTidy::tidy( $text ); |
| 1171 | + } |
| 1172 | + |
| 1173 | + return $text; |
| 1174 | + } |
| 1175 | + |
| 1176 | + private function wellFormed( $text ) { |
| 1177 | + $html = |
| 1178 | + Sanitizer::hackDocType() . |
| 1179 | + '<html>' . |
| 1180 | + $text . |
| 1181 | + '</html>'; |
| 1182 | + |
| 1183 | + $parser = xml_parser_create( "UTF-8" ); |
| 1184 | + |
| 1185 | + # case folding violates XML standard, turn it off |
| 1186 | + xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false ); |
| 1187 | + |
| 1188 | + if ( !xml_parse( $parser, $html, true ) ) { |
| 1189 | + $err = xml_error_string( xml_get_error_code( $parser ) ); |
| 1190 | + $position = xml_get_current_byte_index( $parser ); |
| 1191 | + $fragment = $this->extractFragment( $html, $position ); |
| 1192 | + $this->mXmlError = "$err at byte $position:\n$fragment"; |
| 1193 | + xml_parser_free( $parser ); |
| 1194 | + |
| 1195 | + return false; |
| 1196 | + } |
| 1197 | + |
| 1198 | + xml_parser_free( $parser ); |
| 1199 | + |
| 1200 | + return true; |
| 1201 | + } |
| 1202 | + |
| 1203 | + private function extractFragment( $text, $position ) { |
| 1204 | + $start = max( 0, $position - 10 ); |
| 1205 | + $before = $position - $start; |
| 1206 | + $fragment = '...' . |
| 1207 | + $this->term->color( 34 ) . |
| 1208 | + substr( $text, $start, $before ) . |
| 1209 | + $this->term->color( 0 ) . |
| 1210 | + $this->term->color( 31 ) . |
| 1211 | + $this->term->color( 1 ) . |
| 1212 | + substr( $text, $position, 1 ) . |
| 1213 | + $this->term->color( 0 ) . |
| 1214 | + $this->term->color( 34 ) . |
| 1215 | + substr( $text, $position + 1, 9 ) . |
| 1216 | + $this->term->color( 0 ) . |
| 1217 | + '...'; |
| 1218 | + $display = str_replace( "\n", ' ', $fragment ); |
| 1219 | + $caret = ' ' . |
| 1220 | + str_repeat( ' ', $before ) . |
| 1221 | + $this->term->color( 31 ) . |
| 1222 | + '^' . |
| 1223 | + $this->term->color( 0 ); |
| 1224 | + |
| 1225 | + return "$display\n$caret"; |
| 1226 | + } |
| 1227 | + |
| 1228 | + static function getFakeTimestamp( &$parser, &$ts ) { |
| 1229 | + $ts = 123; |
| 1230 | + return true; |
| 1231 | + } |
| 1232 | +} |
Property changes on: trunk/phase3/maintenance/tests/parser/parserTest.inc |
___________________________________________________________________ |
Added: svn:keywords |
1 | 1233 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 1234 | + native |
Index: trunk/phase3/maintenance/tests/parser/parserTestsStaticParserHook.php |
— | — | @@ -0,0 +1,58 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * A basic extension that's used by the parser tests to test whether the parser |
| 5 | + * calls extensions when they're called inside comments, it shouldn't do that |
| 6 | + * |
| 7 | + * Copyright © 2005, 2006 Ævar Arnfjörð Bjarmason |
| 8 | + * |
| 9 | + * This program is free software; you can redistribute it and/or modify |
| 10 | + * it under the terms of the GNU General Public License as published by |
| 11 | + * the Free Software Foundation; either version 2 of the License, or |
| 12 | + * (at your option) any later version. |
| 13 | + * |
| 14 | + * This program is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU General Public License along |
| 20 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 22 | + * http://www.gnu.org/copyleft/gpl.html |
| 23 | + * |
| 24 | + * @file |
| 25 | + * @ingroup Maintenance |
| 26 | + * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
| 27 | + */ |
| 28 | + |
| 29 | +class ParserTestStaticParserHook { |
| 30 | + static function setup( &$parser ) { |
| 31 | + $parser->setHook( 'statictag', array( __CLASS__, 'hook' ) ); |
| 32 | + |
| 33 | + return true; |
| 34 | + } |
| 35 | + |
| 36 | + static function hook( $in, $argv, $parser ) { |
| 37 | + if ( ! count( $argv ) ) { |
| 38 | + $parser->static_tag_buf = $in; |
| 39 | + return ''; |
| 40 | + } else if ( count( $argv ) === 1 && isset( $argv['action'] ) |
| 41 | + && $argv['action'] === 'flush' && $in === null ) |
| 42 | + { |
| 43 | + // Clear the buffer, we probably don't need to |
| 44 | + if ( isset( $parser->static_tag_buf ) ) { |
| 45 | + $tmp = $parser->static_tag_buf; |
| 46 | + } else { |
| 47 | + $tmp = ''; |
| 48 | + } |
| 49 | + $parser->static_tag_buf = null; |
| 50 | + return $tmp; |
| 51 | + } else |
| 52 | + // wtf? |
| 53 | + return |
| 54 | + "\nCall this extension as <statictag>string</statictag> or as" . |
| 55 | + " <statictag action=flush/>, not in any other way.\n" . |
| 56 | + "text: " . var_export( $in, true ) . "\n" . |
| 57 | + "argv: " . var_export( $argv, true ) . "\n"; |
| 58 | + } |
| 59 | +} |
Property changes on: trunk/phase3/maintenance/tests/parser/parserTestsStaticParserHook.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 60 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 61 | + native |
Index: trunk/phase3/maintenance/tests/parser/parserTests.txt |
— | — | @@ -0,0 +1,8224 @@ |
| 2 | +# MediaWiki Parser test cases |
| 3 | +# Some taken from http://meta.wikimedia.org/wiki/Parser_testing |
| 4 | +# All (C) their respective authors and released under the GPL |
| 5 | +# |
| 6 | +# The syntax should be fairly self-explanatory. |
| 7 | +# |
| 8 | +# Currently supported test options: |
| 9 | +# One of the following three: |
| 10 | +# |
| 11 | +# (default) generate HTML output |
| 12 | +# pst apply pre-save transform |
| 13 | +# msg apply message transform |
| 14 | +# |
| 15 | +# Plus any combination of these: |
| 16 | +# |
| 17 | +# cat add category links |
| 18 | +# ill add inter-language links |
| 19 | +# subpage enable subpages (disabled by default) |
| 20 | +# noxml don't check for XML well formdness |
| 21 | +# title=[[XXX]] run test using article title XXX |
| 22 | +# language=XXX set content language to XXX for this test |
| 23 | +# variant=XXX set the variant of language for this test (eg zh-tw) |
| 24 | +# disabled do not run test |
| 25 | +# showtitle make the first line the title |
| 26 | +# comment run through Linker::formatComment() instead of main parser |
| 27 | +# local format section links in edit comment text as local links |
| 28 | +# |
| 29 | +# For testing purposes, temporary articles can created: |
| 30 | +# !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle |
| 31 | +# where '/' denotes a newline. |
| 32 | + |
| 33 | +# This is the standard article assumed to exist. |
| 34 | +!! article |
| 35 | +Main Page |
| 36 | +!! text |
| 37 | +blah blah |
| 38 | +!! endarticle |
| 39 | + |
| 40 | +!!article |
| 41 | +Template:Foo |
| 42 | +!!text |
| 43 | +FOO |
| 44 | +!!endarticle |
| 45 | + |
| 46 | +!! article |
| 47 | +Template:Blank |
| 48 | +!! text |
| 49 | +!! endarticle |
| 50 | + |
| 51 | +!! article |
| 52 | +Template:! |
| 53 | +!! text |
| 54 | +| |
| 55 | +!! endarticle |
| 56 | + |
| 57 | +!!article |
| 58 | +MediaWiki:bad image list |
| 59 | +!!text |
| 60 | +* [[File:Bad.jpg]] except [[Nasty page]] |
| 61 | +!!endarticle |
| 62 | + |
| 63 | +### |
| 64 | +### Basic tests |
| 65 | +### |
| 66 | +!! test |
| 67 | +Blank input |
| 68 | +!! input |
| 69 | +!! result |
| 70 | +!! end |
| 71 | + |
| 72 | + |
| 73 | +!! test |
| 74 | +Simple paragraph |
| 75 | +!! input |
| 76 | +This is a simple paragraph. |
| 77 | +!! result |
| 78 | +<p>This is a simple paragraph. |
| 79 | +</p> |
| 80 | +!! end |
| 81 | + |
| 82 | +!! test |
| 83 | +Simple list |
| 84 | +!! input |
| 85 | +* Item 1 |
| 86 | +* Item 2 |
| 87 | +!! result |
| 88 | +<ul><li> Item 1 |
| 89 | +</li><li> Item 2 |
| 90 | +</li></ul> |
| 91 | + |
| 92 | +!! end |
| 93 | + |
| 94 | +!! test |
| 95 | +Italics and bold |
| 96 | +!! input |
| 97 | +* plain |
| 98 | +* plain''italic''plain |
| 99 | +* plain''italic''plain''italic''plain |
| 100 | +* plain'''bold'''plain |
| 101 | +* plain'''bold'''plain'''bold'''plain |
| 102 | +* plain''italic''plain'''bold'''plain |
| 103 | +* plain'''bold'''plain''italic''plain |
| 104 | +* plain''italic'''bold-italic'''italic''plain |
| 105 | +* plain'''bold''bold-italic''bold'''plain |
| 106 | +* plain'''''bold-italic'''italic''plain |
| 107 | +* plain'''''bold-italic''bold'''plain |
| 108 | +* plain''italic'''bold-italic'''''plain |
| 109 | +* plain'''bold''bold-italic'''''plain |
| 110 | +* plain l'''italic''plain |
| 111 | +* plain l''''bold''' plain |
| 112 | +!! result |
| 113 | +<ul><li> plain |
| 114 | +</li><li> plain<i>italic</i>plain |
| 115 | +</li><li> plain<i>italic</i>plain<i>italic</i>plain |
| 116 | +</li><li> plain<b>bold</b>plain |
| 117 | +</li><li> plain<b>bold</b>plain<b>bold</b>plain |
| 118 | +</li><li> plain<i>italic</i>plain<b>bold</b>plain |
| 119 | +</li><li> plain<b>bold</b>plain<i>italic</i>plain |
| 120 | +</li><li> plain<i>italic<b>bold-italic</b>italic</i>plain |
| 121 | +</li><li> plain<b>bold<i>bold-italic</i>bold</b>plain |
| 122 | +</li><li> plain<i><b>bold-italic</b>italic</i>plain |
| 123 | +</li><li> plain<b><i>bold-italic</i>bold</b>plain |
| 124 | +</li><li> plain<i>italic<b>bold-italic</b></i>plain |
| 125 | +</li><li> plain<b>bold<i>bold-italic</i></b>plain |
| 126 | +</li><li> plain l'<i>italic</i>plain |
| 127 | +</li><li> plain l'<b>bold</b> plain |
| 128 | +</li></ul> |
| 129 | + |
| 130 | +!! end |
| 131 | + |
| 132 | +### |
| 133 | +### <nowiki> test cases |
| 134 | +### |
| 135 | + |
| 136 | +!! test |
| 137 | +<nowiki> unordered list |
| 138 | +!! input |
| 139 | +<nowiki>* This is not an unordered list item.</nowiki> |
| 140 | +!! result |
| 141 | +<p>* This is not an unordered list item. |
| 142 | +</p> |
| 143 | +!! end |
| 144 | + |
| 145 | +!! test |
| 146 | +<nowiki> spacing |
| 147 | +!! input |
| 148 | +<nowiki>Lorem ipsum dolor |
| 149 | + |
| 150 | +sed abit. |
| 151 | + sed nullum. |
| 152 | + |
| 153 | +:and a colon |
| 154 | +</nowiki> |
| 155 | +!! result |
| 156 | +<p>Lorem ipsum dolor |
| 157 | + |
| 158 | +sed abit. |
| 159 | + sed nullum. |
| 160 | + |
| 161 | +:and a colon |
| 162 | + |
| 163 | +</p> |
| 164 | +!! end |
| 165 | + |
| 166 | +!! test |
| 167 | +nowiki 3 |
| 168 | +!! input |
| 169 | +:There is not nowiki. |
| 170 | +:There is <nowiki>nowiki</nowiki>. |
| 171 | + |
| 172 | +#There is not nowiki. |
| 173 | +#There is <nowiki>nowiki</nowiki>. |
| 174 | + |
| 175 | +*There is not nowiki. |
| 176 | +*There is <nowiki>nowiki</nowiki>. |
| 177 | +!! result |
| 178 | +<dl><dd>There is not nowiki. |
| 179 | +</dd><dd>There is nowiki. |
| 180 | +</dd></dl> |
| 181 | +<ol><li>There is not nowiki. |
| 182 | +</li><li>There is nowiki. |
| 183 | +</li></ol> |
| 184 | +<ul><li>There is not nowiki. |
| 185 | +</li><li>There is nowiki. |
| 186 | +</li></ul> |
| 187 | + |
| 188 | +!! end |
| 189 | + |
| 190 | + |
| 191 | +### |
| 192 | +### Comments |
| 193 | +### |
| 194 | +!! test |
| 195 | +Comment test 1 |
| 196 | +!! input |
| 197 | +<!-- comment 1 --> asdf |
| 198 | +<!-- comment 2 --> |
| 199 | +!! result |
| 200 | +<pre>asdf |
| 201 | +</pre> |
| 202 | + |
| 203 | +!! end |
| 204 | + |
| 205 | +!! test |
| 206 | +Comment test 2 |
| 207 | +!! input |
| 208 | +asdf |
| 209 | +<!-- comment 1 --> |
| 210 | +jkl |
| 211 | +!! result |
| 212 | +<p>asdf |
| 213 | +jkl |
| 214 | +</p> |
| 215 | +!! end |
| 216 | + |
| 217 | +!! test |
| 218 | +Comment test 3 |
| 219 | +!! input |
| 220 | +asdf |
| 221 | +<!-- comment 1 --> |
| 222 | +<!-- comment 2 --> |
| 223 | +jkl |
| 224 | +!! result |
| 225 | +<p>asdf |
| 226 | +jkl |
| 227 | +</p> |
| 228 | +!! end |
| 229 | + |
| 230 | +!! test |
| 231 | +Comment test 4 |
| 232 | +!! input |
| 233 | +asdf<!-- comment 1 -->jkl |
| 234 | +!! result |
| 235 | +<p>asdfjkl |
| 236 | +</p> |
| 237 | +!! end |
| 238 | + |
| 239 | +!! test |
| 240 | +Comment spacing |
| 241 | +!! input |
| 242 | +a |
| 243 | + <!-- foo --> b <!-- bar --> |
| 244 | +c |
| 245 | +!! result |
| 246 | +<p>a |
| 247 | +</p> |
| 248 | +<pre> b |
| 249 | +</pre> |
| 250 | +<p>c |
| 251 | +</p> |
| 252 | +!! end |
| 253 | + |
| 254 | +!! test |
| 255 | +Comment whitespace |
| 256 | +!! input |
| 257 | +<!-- returns a single newline, not nothing, since the newline after > is not stripped --> |
| 258 | +!! result |
| 259 | + |
| 260 | +!! end |
| 261 | + |
| 262 | +!! test |
| 263 | +Comment semantics and delimiters |
| 264 | +!! input |
| 265 | +<!-- --><!----><!-----><!------> |
| 266 | +!! result |
| 267 | + |
| 268 | +!! end |
| 269 | + |
| 270 | +!! test |
| 271 | +Comment semantics and delimiters, redux |
| 272 | +!! input |
| 273 | +<!-- In SGML every "foo" here would actually show up in the text -- foo -- bar |
| 274 | +-- foo -- funky huh? ... --> |
| 275 | +!! result |
| 276 | + |
| 277 | +!! end |
| 278 | + |
| 279 | +!! test |
| 280 | +Comment semantics and delimiters: directors cut |
| 281 | +!! input |
| 282 | +<!-- ... However we like to keep things simple and somewhat XML-ish so we eat |
| 283 | +everything starting with < followed by !-- until the first -- and > we see, |
| 284 | +that wouldn't be valid XML however, since in XML -- has to terminate a comment |
| 285 | +-->--> |
| 286 | +!! result |
| 287 | +<p>--> |
| 288 | +</p> |
| 289 | +!! end |
| 290 | + |
| 291 | +!! test |
| 292 | +Comment semantics: nesting |
| 293 | +!! input |
| 294 | +<!--<!-- no, we're not going to do anything fancy here -->--> |
| 295 | +!! result |
| 296 | +<p>--> |
| 297 | +</p> |
| 298 | +!! end |
| 299 | + |
| 300 | +!! test |
| 301 | +Comment semantics: unclosed comment at end |
| 302 | +!! input |
| 303 | +<!--This comment will run out to the end of the document |
| 304 | +!! result |
| 305 | + |
| 306 | +!! end |
| 307 | + |
| 308 | +!! test |
| 309 | +Comment in template title |
| 310 | +!! input |
| 311 | +{{f<!---->oo}} |
| 312 | +!! result |
| 313 | +<p>FOO |
| 314 | +</p> |
| 315 | +!! end |
| 316 | + |
| 317 | +!! test |
| 318 | +Comment on its own line post-expand |
| 319 | +!! input |
| 320 | +a |
| 321 | +{{blank}}<!----> |
| 322 | +b |
| 323 | +!! result |
| 324 | +<p>a |
| 325 | +</p><p>b |
| 326 | +</p> |
| 327 | +!! end |
| 328 | + |
| 329 | +### |
| 330 | +### Preformatted text |
| 331 | +### |
| 332 | +!! test |
| 333 | +Preformatted text |
| 334 | +!! input |
| 335 | + This is some |
| 336 | + Preformatted text |
| 337 | + With ''italic'' |
| 338 | + And '''bold''' |
| 339 | + And a [[Main Page|link]] |
| 340 | +!! result |
| 341 | +<pre>This is some |
| 342 | +Preformatted text |
| 343 | +With <i>italic</i> |
| 344 | +And <b>bold</b> |
| 345 | +And a <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> |
| 346 | +</pre> |
| 347 | +!! end |
| 348 | + |
| 349 | +!! test |
| 350 | +<pre> with <nowiki> inside (compatibility with 1.6 and earlier) |
| 351 | +!! input |
| 352 | +<pre><nowiki> |
| 353 | +<b> |
| 354 | +<cite> |
| 355 | +<em> |
| 356 | +</nowiki></pre> |
| 357 | +!! result |
| 358 | +<pre> |
| 359 | +<b> |
| 360 | +<cite> |
| 361 | +<em> |
| 362 | +</pre> |
| 363 | + |
| 364 | +!! end |
| 365 | + |
| 366 | +!! test |
| 367 | +Regression with preformatted in <center> |
| 368 | +!! input |
| 369 | +<center> |
| 370 | + Blah |
| 371 | +</center> |
| 372 | +!! result |
| 373 | +<center> |
| 374 | +<pre>Blah |
| 375 | +</pre> |
| 376 | +</center> |
| 377 | + |
| 378 | +!! end |
| 379 | + |
| 380 | +# Expected output in the following test is not really expected (there should be |
| 381 | +# <pre> in the output) -- it's only testing for well-formedness. |
| 382 | +!! test |
| 383 | +Bug 6200: Preformatted in <blockquote> |
| 384 | +!! input |
| 385 | +<blockquote> |
| 386 | + Blah |
| 387 | +</blockquote> |
| 388 | +!! result |
| 389 | +<blockquote> |
| 390 | + Blah |
| 391 | +</blockquote> |
| 392 | + |
| 393 | +!! end |
| 394 | + |
| 395 | +!! test |
| 396 | +<pre> with attributes (bug 3202) |
| 397 | +!! input |
| 398 | +<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre> |
| 399 | +!! result |
| 400 | +<pre style="background: blue; color:white">Bluescreen of WikiDeath</pre> |
| 401 | + |
| 402 | +!! end |
| 403 | + |
| 404 | +!! test |
| 405 | +<pre> with width attribute (bug 3202) |
| 406 | +!! input |
| 407 | +<pre width="8">Narrow screen goodies</pre> |
| 408 | +!! result |
| 409 | +<pre width="8">Narrow screen goodies</pre> |
| 410 | + |
| 411 | +!! end |
| 412 | + |
| 413 | +!! test |
| 414 | +<pre> with forbidden attribute (bug 3202) |
| 415 | +!! input |
| 416 | +<pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre> |
| 417 | +!! result |
| 418 | +<pre width="8">Narrow screen goodies</pre> |
| 419 | + |
| 420 | +!! end |
| 421 | + |
| 422 | +!! test |
| 423 | +<pre> with forbidden attribute values (bug 3202) |
| 424 | +!! input |
| 425 | +<pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre> |
| 426 | +!! result |
| 427 | +<pre width="8" style="/* insecure input */">Narrow screen goodies</pre> |
| 428 | + |
| 429 | +!! end |
| 430 | + |
| 431 | +### |
| 432 | +### Definition lists |
| 433 | +### |
| 434 | +!! test |
| 435 | +Simple definition |
| 436 | +!! input |
| 437 | +; name : Definition |
| 438 | +!! result |
| 439 | +<dl><dt> name </dt><dd> Definition |
| 440 | +</dd></dl> |
| 441 | + |
| 442 | +!! end |
| 443 | + |
| 444 | +!! test |
| 445 | +Definition list for indentation only |
| 446 | +!! input |
| 447 | +: Indented text |
| 448 | +!! result |
| 449 | +<dl><dd> Indented text |
| 450 | +</dd></dl> |
| 451 | + |
| 452 | +!! end |
| 453 | + |
| 454 | +!! test |
| 455 | +Definition list with no space |
| 456 | +!! input |
| 457 | +;name:Definition |
| 458 | +!! result |
| 459 | +<dl><dt>name</dt><dd>Definition |
| 460 | +</dd></dl> |
| 461 | + |
| 462 | +!!end |
| 463 | + |
| 464 | +!! test |
| 465 | +Definition list with URL link |
| 466 | +!! input |
| 467 | +; http://example.com/ : definition |
| 468 | +!! result |
| 469 | +<dl><dt> <a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> </dt><dd> definition |
| 470 | +</dd></dl> |
| 471 | + |
| 472 | +!! end |
| 473 | + |
| 474 | +!! test |
| 475 | +Definition list with bracketed URL link |
| 476 | +!! input |
| 477 | +;[http://www.example.com/ Example]:Something about it |
| 478 | +!! result |
| 479 | +<dl><dt><a href="http://www.example.com/" class="external text" rel="nofollow">Example</a></dt><dd>Something about it |
| 480 | +</dd></dl> |
| 481 | + |
| 482 | +!! end |
| 483 | + |
| 484 | +!! test |
| 485 | +Definition list with wikilink containing colon |
| 486 | +!! input |
| 487 | +; [[Help:FAQ]]: The least-read page on Wikipedia |
| 488 | +!! result |
| 489 | +<dl><dt> <a href="https://www.mediawiki.org/index.php?title=Help:FAQ&action=edit&redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia |
| 490 | +</dd></dl> |
| 491 | + |
| 492 | +!! end |
| 493 | + |
| 494 | +# At Brion's and JeLuF's insistence... :) |
| 495 | +!! test |
| 496 | +Definition list with news link containing colon |
| 497 | +!! input |
| 498 | +; news:alt.wikipedia.rox: This isn't even a real newsgroup! |
| 499 | +!! result |
| 500 | +<dl><dt> <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup! |
| 501 | +</dd></dl> |
| 502 | + |
| 503 | +!! end |
| 504 | + |
| 505 | +!! test |
| 506 | +Malformed definition list with colon |
| 507 | +!! input |
| 508 | +; news:alt.wikipedia.rox -- don't crash or enter an infinite loop |
| 509 | +!! result |
| 510 | +<dl><dt> <a href="news:alt.wikipedia.rox" class="external free" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop |
| 511 | +</dt></dl> |
| 512 | + |
| 513 | +!! end |
| 514 | + |
| 515 | +!! test |
| 516 | +Definition lists: colon in external link text |
| 517 | +!! input |
| 518 | +; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up |
| 519 | +!! result |
| 520 | +<dl><dt> <a href="http://www.wikipedia2.org/" class="external text" rel="nofollow">Wikipedia : The Next Generation</a></dt><dd> OK, I made that up |
| 521 | +</dd></dl> |
| 522 | + |
| 523 | +!! end |
| 524 | + |
| 525 | +!! test |
| 526 | +Definition lists: colon in HTML attribute |
| 527 | +!! input |
| 528 | +;<b style="display: inline">bold</b> |
| 529 | +!! result |
| 530 | +<dl><dt><b style="display: inline">bold</b> |
| 531 | +</dt></dl> |
| 532 | + |
| 533 | +!! end |
| 534 | + |
| 535 | + |
| 536 | +!! test |
| 537 | +Definition lists: self-closed tag |
| 538 | +!! input |
| 539 | +;one<br/>two : two-line fun |
| 540 | +!! result |
| 541 | +<dl><dt>one<br />two </dt><dd> two-line fun |
| 542 | +</dd></dl> |
| 543 | + |
| 544 | +!! end |
| 545 | + |
| 546 | + |
| 547 | +### |
| 548 | +### External links |
| 549 | +### |
| 550 | +!! test |
| 551 | +External links: non-bracketed |
| 552 | +!! input |
| 553 | +Non-bracketed: http://example.com |
| 554 | +!! result |
| 555 | +<p>Non-bracketed: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> |
| 556 | +</p> |
| 557 | +!! end |
| 558 | + |
| 559 | +!! test |
| 560 | +External links: numbered |
| 561 | +!! input |
| 562 | +Numbered: [http://example.com] |
| 563 | +Numbered: [http://example.net] |
| 564 | +Numbered: [http://example.com] |
| 565 | +!! result |
| 566 | +<p>Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[1]</a> |
| 567 | +Numbered: <a href="http://example.net" class="external autonumber" rel="nofollow">[2]</a> |
| 568 | +Numbered: <a href="http://example.com" class="external autonumber" rel="nofollow">[3]</a> |
| 569 | +</p> |
| 570 | +!!end |
| 571 | + |
| 572 | +!! test |
| 573 | +External links: specified text |
| 574 | +!! input |
| 575 | +Specified text: [http://example.com link] |
| 576 | +!! result |
| 577 | +<p>Specified text: <a href="http://example.com" class="external text" rel="nofollow">link</a> |
| 578 | +</p> |
| 579 | +!!end |
| 580 | + |
| 581 | +!! test |
| 582 | +External links: trail |
| 583 | +!! input |
| 584 | +Linktrails should not work for external links: [http://example.com link]s |
| 585 | +!! result |
| 586 | +<p>Linktrails should not work for external links: <a href="http://example.com" class="external text" rel="nofollow">link</a>s |
| 587 | +</p> |
| 588 | +!! end |
| 589 | + |
| 590 | +!! test |
| 591 | +External links: dollar sign in URL |
| 592 | +!! input |
| 593 | +http://example.com/1$2345 |
| 594 | +!! result |
| 595 | +<p><a href="http://example.com/1$2345" class="external free" rel="nofollow">http://example.com/1$2345</a> |
| 596 | +</p> |
| 597 | +!! end |
| 598 | + |
| 599 | +!! test |
| 600 | +External links: dollar sign in URL (named) |
| 601 | +!! input |
| 602 | +[http://example.com/1$2345] |
| 603 | +!! result |
| 604 | +<p><a href="http://example.com/1$2345" class="external autonumber" rel="nofollow">[1]</a> |
| 605 | +</p> |
| 606 | +!!end |
| 607 | + |
| 608 | +!! test |
| 609 | +External links: open square bracket forbidden in URL (bug 4377) |
| 610 | +!! input |
| 611 | +http://example.com/1[2345 |
| 612 | +!! result |
| 613 | +<p><a href="http://example.com/1" class="external free" rel="nofollow">http://example.com/1</a>[2345 |
| 614 | +</p> |
| 615 | +!! end |
| 616 | + |
| 617 | +!! test |
| 618 | +External links: open square bracket forbidden in URL (named) (bug 4377) |
| 619 | +!! input |
| 620 | +[http://example.com/1[2345] |
| 621 | +!! result |
| 622 | +<p><a href="http://example.com/1" class="external text" rel="nofollow">[2345</a> |
| 623 | +</p> |
| 624 | +!!end |
| 625 | + |
| 626 | +!! test |
| 627 | +External links: nowiki in URL link text (bug 6230) |
| 628 | +!!input |
| 629 | +[http://example.com/ <nowiki>''example site''</nowiki>] |
| 630 | +!! result |
| 631 | +<p><a href="http://example.com/" class="external text" rel="nofollow">''example site''</a> |
| 632 | +</p> |
| 633 | +!! end |
| 634 | + |
| 635 | +!! test |
| 636 | +External links: newline forbidden in text (bug 6230 regression check) |
| 637 | +!! input |
| 638 | +[http://example.com/ first |
| 639 | +second] |
| 640 | +!! result |
| 641 | +<p>[<a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> first |
| 642 | +second] |
| 643 | +</p> |
| 644 | +!!end |
| 645 | + |
| 646 | +!! test |
| 647 | +External image |
| 648 | +!! input |
| 649 | +External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png |
| 650 | +!! result |
| 651 | +<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /> |
| 652 | +</p> |
| 653 | +!! end |
| 654 | + |
| 655 | +!! test |
| 656 | +External image from https |
| 657 | +!! input |
| 658 | +External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png |
| 659 | +!! result |
| 660 | +<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /> |
| 661 | +</p> |
| 662 | +!! end |
| 663 | + |
| 664 | +!! test |
| 665 | +Link to non-http image, no img tag |
| 666 | +!! input |
| 667 | +Link to non-http image, no img tag: ftp://example.com/test.jpg |
| 668 | +!! result |
| 669 | +<p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" rel="nofollow">ftp://example.com/test.jpg</a> |
| 670 | +</p> |
| 671 | +!! end |
| 672 | + |
| 673 | +!! test |
| 674 | +External links: terminating separator |
| 675 | +!! input |
| 676 | +Terminating separator: http://example.com/thing, |
| 677 | +!! result |
| 678 | +<p>Terminating separator: <a href="http://example.com/thing" class="external free" rel="nofollow">http://example.com/thing</a>, |
| 679 | +</p> |
| 680 | +!! end |
| 681 | + |
| 682 | +!! test |
| 683 | +External links: intervening separator |
| 684 | +!! input |
| 685 | +Intervening separator: http://example.com/1,2,3 |
| 686 | +!! result |
| 687 | +<p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" rel="nofollow">http://example.com/1,2,3</a> |
| 688 | +</p> |
| 689 | +!! end |
| 690 | + |
| 691 | +!! test |
| 692 | +External links: old bug with URL in query |
| 693 | +!! input |
| 694 | +Old bug with URL in query: [http://example.com/thing?url=http://example.com link] |
| 695 | +!! result |
| 696 | +<p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" rel="nofollow">link</a> |
| 697 | +</p> |
| 698 | +!! end |
| 699 | + |
| 700 | +!! test |
| 701 | +External links: old URL-in-URL bug, mixed protocols |
| 702 | +!! input |
| 703 | +And again with mixed protocols: [ftp://example.com?url=http://example.com link] |
| 704 | +!! result |
| 705 | +<p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" rel="nofollow">link</a> |
| 706 | +</p> |
| 707 | +!!end |
| 708 | + |
| 709 | +!! test |
| 710 | +External links: URL in text |
| 711 | +!! input |
| 712 | +URL in text: [http://example.com http://example.com] |
| 713 | +!! result |
| 714 | +<p>URL in text: <a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> |
| 715 | +</p> |
| 716 | +!! end |
| 717 | + |
| 718 | +!! test |
| 719 | +External links: Clickable images |
| 720 | +!! input |
| 721 | +ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] |
| 722 | +!! result |
| 723 | +<p>ja-style clickable images: <a href="http://example.com" class="external text" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a> |
| 724 | +</p> |
| 725 | +!!end |
| 726 | + |
| 727 | +!! test |
| 728 | +External links: raw ampersand |
| 729 | +!! input |
| 730 | +Old & use: http://x&y |
| 731 | +!! result |
| 732 | +<p>Old & use: <a href="http://x&y" class="external free" rel="nofollow">http://x&y</a> |
| 733 | +</p> |
| 734 | +!! end |
| 735 | + |
| 736 | +!! test |
| 737 | +External links: encoded ampersand |
| 738 | +!! input |
| 739 | +Old & use: http://x&y |
| 740 | +!! result |
| 741 | +<p>Old & use: <a href="http://x&y" class="external free" rel="nofollow">http://x&y</a> |
| 742 | +</p> |
| 743 | +!! end |
| 744 | + |
| 745 | +!! test |
| 746 | +External links: encoded equals (bug 6102) |
| 747 | +!! input |
| 748 | +http://example.com/?foo=bar |
| 749 | +!! result |
| 750 | +<p><a href="http://example.com/?foo=bar" class="external free" rel="nofollow">http://example.com/?foo=bar</a> |
| 751 | +</p> |
| 752 | +!! end |
| 753 | + |
| 754 | +!! test |
| 755 | +External links: [raw ampersand] |
| 756 | +!! input |
| 757 | +Old & use: [http://x&y] |
| 758 | +!! result |
| 759 | +<p>Old & use: <a href="http://x&y" class="external autonumber" rel="nofollow">[1]</a> |
| 760 | +</p> |
| 761 | +!! end |
| 762 | + |
| 763 | +!! test |
| 764 | +External links: [encoded ampersand] |
| 765 | +!! input |
| 766 | +Old & use: [http://x&y] |
| 767 | +!! result |
| 768 | +<p>Old & use: <a href="http://x&y" class="external autonumber" rel="nofollow">[1]</a> |
| 769 | +</p> |
| 770 | +!! end |
| 771 | + |
| 772 | +!! test |
| 773 | +External links: [encoded equals] (bug 6102) |
| 774 | +!! input |
| 775 | +[http://example.com/?foo=bar] |
| 776 | +!! result |
| 777 | +<p><a href="http://example.com/?foo=bar" class="external autonumber" rel="nofollow">[1]</a> |
| 778 | +</p> |
| 779 | +!! end |
| 780 | + |
| 781 | +!! test |
| 782 | +External links: [IDN ignored character reference in hostname; strip it right off] |
| 783 | +!! input |
| 784 | +[http://e‌xample.com/] |
| 785 | +!! result |
| 786 | +<p><a href="http://example.com/" class="external autonumber" rel="nofollow">[1]</a> |
| 787 | +</p> |
| 788 | +!! end |
| 789 | + |
| 790 | +!! test |
| 791 | +External links: IDN ignored character reference in hostname; strip it right off |
| 792 | +!! input |
| 793 | +http://e‌xample.com/ |
| 794 | +!! result |
| 795 | +<p><a href="http://example.com/" class="external free" rel="nofollow">http://example.com/</a> |
| 796 | +</p> |
| 797 | +!! end |
| 798 | + |
| 799 | +!! test |
| 800 | +External links: www.jpeg.org (bug 554) |
| 801 | +!! input |
| 802 | +http://www.jpeg.org |
| 803 | +!!result |
| 804 | +<p><a href="http://www.jpeg.org" class="external free" rel="nofollow">http://www.jpeg.org</a> |
| 805 | +</p> |
| 806 | +!! end |
| 807 | + |
| 808 | +!! test |
| 809 | +External links: URL within URL (original bug 2) |
| 810 | +!! input |
| 811 | +[http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] |
| 812 | +!! result |
| 813 | +<p><a href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp" class="external autonumber" rel="nofollow">[1]</a> |
| 814 | +</p> |
| 815 | +!! end |
| 816 | + |
| 817 | +!! test |
| 818 | +BUG 361: URL inside bracketed URL |
| 819 | +!! input |
| 820 | +[http://www.example.com/foo http://www.example.com/bar] |
| 821 | +!! result |
| 822 | +<p><a href="http://www.example.com/foo" class="external text" rel="nofollow">http://www.example.com/bar</a> |
| 823 | +</p> |
| 824 | +!! end |
| 825 | + |
| 826 | +!! test |
| 827 | +BUG 361: URL within URL, not bracketed |
| 828 | +!! input |
| 829 | +http://www.example.com/foo?=http://www.example.com/bar |
| 830 | +!! result |
| 831 | +<p><a href="http://www.example.com/foo?=http://www.example.com/bar" class="external free" rel="nofollow">http://www.example.com/foo?=http://www.example.com/bar</a> |
| 832 | +</p> |
| 833 | +!! end |
| 834 | + |
| 835 | +!! test |
| 836 | +BUG 289: ">"-token in URL-tail |
| 837 | +!! input |
| 838 | +http://www.example.com/<hello> |
| 839 | +!! result |
| 840 | +<p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a><hello> |
| 841 | +</p> |
| 842 | +!!end |
| 843 | + |
| 844 | +!! test |
| 845 | +BUG 289: literal ">"-token in URL-tail |
| 846 | +!! input |
| 847 | +http://www.example.com/<b>html</b> |
| 848 | +!! result |
| 849 | +<p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a><b>html</b> |
| 850 | +</p> |
| 851 | +!!end |
| 852 | + |
| 853 | +!! test |
| 854 | +BUG 289: ">"-token in bracketed URL |
| 855 | +!! input |
| 856 | +[http://www.example.com/<hello> stuff] |
| 857 | +!! result |
| 858 | +<p><a href="http://www.example.com/" class="external text" rel="nofollow"><hello> stuff</a> |
| 859 | +</p> |
| 860 | +!!end |
| 861 | + |
| 862 | +!! test |
| 863 | +BUG 289: literal ">"-token in bracketed URL |
| 864 | +!! input |
| 865 | +[http://www.example.com/<b>html</b> stuff] |
| 866 | +!! result |
| 867 | +<p><a href="http://www.example.com/" class="external text" rel="nofollow"><b>html</b> stuff</a> |
| 868 | +</p> |
| 869 | +!!end |
| 870 | + |
| 871 | +!! test |
| 872 | +BUG 289: literal double quote at end of URL |
| 873 | +!! input |
| 874 | +http://www.example.com/"hello" |
| 875 | +!! result |
| 876 | +<p><a href="http://www.example.com/" class="external free" rel="nofollow">http://www.example.com/</a>"hello" |
| 877 | +</p> |
| 878 | +!!end |
| 879 | + |
| 880 | +!! test |
| 881 | +BUG 289: literal double quote in bracketed URL |
| 882 | +!! input |
| 883 | +[http://www.example.com/"hello" stuff] |
| 884 | +!! result |
| 885 | +<p><a href="http://www.example.com/" class="external text" rel="nofollow">"hello" stuff</a> |
| 886 | +</p> |
| 887 | +!!end |
| 888 | + |
| 889 | +!! test |
| 890 | +External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081) |
| 891 | +!! input |
| 892 | +[http://www.example.com test] |
| 893 | +!! result |
| 894 | +<p><a href="http://www.example.com" class="external text" rel="nofollow">test</a> |
| 895 | +</p> |
| 896 | +!! end |
| 897 | + |
| 898 | +!! test |
| 899 | +External links: wiki links within external link (Bug 3695) |
| 900 | +!! input |
| 901 | +[http://example.com [[wikilink]] embedded in ext link] |
| 902 | +!! result |
| 903 | +<p><a href="http://example.com" class="external text" rel="nofollow"></a><a href="https://www.mediawiki.org/index.php?title=Wikilink&action=edit&redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a href="http://example.com" class="external text" rel="nofollow"> embedded in ext link</a> |
| 904 | +</p> |
| 905 | +!! end |
| 906 | + |
| 907 | +!! test |
| 908 | +BUG 787: Links with one slash after the url protocol are invalid |
| 909 | +!! input |
| 910 | +http:/example.com |
| 911 | + |
| 912 | +[http:/example.com title] |
| 913 | +!! result |
| 914 | +<p>http:/example.com |
| 915 | +</p><p>[http:/example.com title] |
| 916 | +</p> |
| 917 | +!! end |
| 918 | + |
| 919 | +!! test |
| 920 | +Bug 2702: Mismatched <i>, <b> and <a> tags are invalid |
| 921 | +!! input |
| 922 | +''[http://example.com text''] |
| 923 | +[http://example.com '''text]''' |
| 924 | +''Something [http://example.com in italic''] |
| 925 | +''Something [http://example.com mixed''''', even bold]''' |
| 926 | +'''''Now [http://example.com both'''''] |
| 927 | +!! result |
| 928 | +<p><a href="http://example.com" class="external text" rel="nofollow"><i>text</i></a> |
| 929 | +<a href="http://example.com" class="external text" rel="nofollow"><b>text</b></a> |
| 930 | +<i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>in italic</i></a> |
| 931 | +<i>Something </i><a href="http://example.com" class="external text" rel="nofollow"><i>mixed</i><b>, even bold</b></a> |
| 932 | +<i><b>Now </b></i><a href="http://example.com" class="external text" rel="nofollow"><i><b>both</b></i></a> |
| 933 | +</p> |
| 934 | +!! end |
| 935 | + |
| 936 | + |
| 937 | +!! test |
| 938 | +Bug 4781: %26 in URL |
| 939 | +!! input |
| 940 | +http://www.example.com/?title=AT%26T |
| 941 | +!! result |
| 942 | +<p><a href="http://www.example.com/?title=AT%26T" class="external free" rel="nofollow">http://www.example.com/?title=AT%26T</a> |
| 943 | +</p> |
| 944 | +!! end |
| 945 | + |
| 946 | +!! test |
| 947 | +Bug 4781, 5267: %26 in URL |
| 948 | +!! input |
| 949 | +http://www.example.com/?title=100%25_Bran |
| 950 | +!! result |
| 951 | +<p><a href="http://www.example.com/?title=100%25_Bran" class="external free" rel="nofollow">http://www.example.com/?title=100%25_Bran</a> |
| 952 | +</p> |
| 953 | +!! end |
| 954 | + |
| 955 | +!! test |
| 956 | +Bug 4781, 5267: %28, %29 in URL |
| 957 | +!! input |
| 958 | +http://www.example.com/?title=Ben-Hur_%281959_film%29 |
| 959 | +!! result |
| 960 | +<p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external free" rel="nofollow">http://www.example.com/?title=Ben-Hur_%281959_film%29</a> |
| 961 | +</p> |
| 962 | +!! end |
| 963 | + |
| 964 | + |
| 965 | +!! test |
| 966 | +Bug 4781: %26 in autonumber URL |
| 967 | +!! input |
| 968 | +[http://www.example.com/?title=AT%26T] |
| 969 | +!! result |
| 970 | +<p><a href="http://www.example.com/?title=AT%26T" class="external autonumber" rel="nofollow">[1]</a> |
| 971 | +</p> |
| 972 | +!! end |
| 973 | + |
| 974 | +!! test |
| 975 | +Bug 4781, 5267: %26 in autonumber URL |
| 976 | +!! input |
| 977 | +[http://www.example.com/?title=100%25_Bran] |
| 978 | +!! result |
| 979 | +<p><a href="http://www.example.com/?title=100%25_Bran" class="external autonumber" rel="nofollow">[1]</a> |
| 980 | +</p> |
| 981 | +!! end |
| 982 | + |
| 983 | +!! test |
| 984 | +Bug 4781, 5267: %28, %29 in autonumber URL |
| 985 | +!! input |
| 986 | +[http://www.example.com/?title=Ben-Hur_%281959_film%29] |
| 987 | +!! result |
| 988 | +<p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external autonumber" rel="nofollow">[1]</a> |
| 989 | +</p> |
| 990 | +!! end |
| 991 | + |
| 992 | + |
| 993 | +!! test |
| 994 | +Bug 4781: %26 in bracketed URL |
| 995 | +!! input |
| 996 | +[http://www.example.com/?title=AT%26T link] |
| 997 | +!! result |
| 998 | +<p><a href="http://www.example.com/?title=AT%26T" class="external text" rel="nofollow">link</a> |
| 999 | +</p> |
| 1000 | +!! end |
| 1001 | + |
| 1002 | +!! test |
| 1003 | +Bug 4781, 5267: %26 in bracketed URL |
| 1004 | +!! input |
| 1005 | +[http://www.example.com/?title=100%25_Bran link] |
| 1006 | +!! result |
| 1007 | +<p><a href="http://www.example.com/?title=100%25_Bran" class="external text" rel="nofollow">link</a> |
| 1008 | +</p> |
| 1009 | +!! end |
| 1010 | + |
| 1011 | +!! test |
| 1012 | +Bug 4781, 5267: %28, %29 in bracketed URL |
| 1013 | +!! input |
| 1014 | +[http://www.example.com/?title=Ben-Hur_%281959_film%29 link] |
| 1015 | +!! result |
| 1016 | +<p><a href="http://www.example.com/?title=Ben-Hur_%281959_film%29" class="external text" rel="nofollow">link</a> |
| 1017 | +</p> |
| 1018 | +!! end |
| 1019 | + |
| 1020 | +!! test |
| 1021 | +External link containing double-single-quotes in text '' (bug 4598 sanity check) |
| 1022 | +!! input |
| 1023 | +Some [http://example.com/ pretty ''italics'' and stuff]! |
| 1024 | +!! result |
| 1025 | +<p>Some <a href="http://example.com/" class="external text" rel="nofollow">pretty <i>italics</i> and stuff</a>! |
| 1026 | +</p> |
| 1027 | +!! end |
| 1028 | + |
| 1029 | +!! test |
| 1030 | +External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check) |
| 1031 | +!! input |
| 1032 | +''Some [http://example.com/ pretty ''italics'' and stuff]!'' |
| 1033 | +!! result |
| 1034 | +<p><i>Some </i><a href="http://example.com/" class="external text" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i> |
| 1035 | +</p> |
| 1036 | +!! end |
| 1037 | + |
| 1038 | +!! test |
| 1039 | +External link containing double-single-quotes with no space separating the url from text in italics |
| 1040 | +!! input |
| 1041 | +[http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].] |
| 1042 | +!! result |
| 1043 | +<p><a href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm" class="external text" rel="nofollow"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="https://www.mediawiki.org/index.php?title=Museo_Picasso_(Par%C3%ADs)&action=edit&redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a> |
| 1044 | +</p> |
| 1045 | +!! end |
| 1046 | + |
| 1047 | +!! test |
| 1048 | +URL-encoding in URL functions (single parameter) |
| 1049 | +!! input |
| 1050 | +{{localurl:Some page|amp=&}} |
| 1051 | +!! result |
| 1052 | +<p>/index.php?title=Some_page&amp=& |
| 1053 | +</p> |
| 1054 | +!! end |
| 1055 | + |
| 1056 | +!! test |
| 1057 | +URL-encoding in URL functions (multiple parameters) |
| 1058 | +!! input |
| 1059 | +{{localurl:Some page|q=?&=&}} |
| 1060 | +!! result |
| 1061 | +<p>/index.php?title=Some_page&q=?&amp=& |
| 1062 | +</p> |
| 1063 | +!! end |
| 1064 | + |
| 1065 | +### |
| 1066 | +### Quotes |
| 1067 | +### |
| 1068 | + |
| 1069 | +!! test |
| 1070 | +Quotes |
| 1071 | +!! input |
| 1072 | +Normal text. '''Bold text.''' Normal text. ''Italic text.'' |
| 1073 | + |
| 1074 | +Normal text. '''''Bold italic text.''''' Normal text. |
| 1075 | +!!result |
| 1076 | +<p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i> |
| 1077 | +</p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text. |
| 1078 | +</p> |
| 1079 | +!! end |
| 1080 | + |
| 1081 | + |
| 1082 | +!! test |
| 1083 | +Unclosed and unmatched quotes |
| 1084 | +!! input |
| 1085 | +'''''Bold italic text '''with bold deactivated''' in between.''''' |
| 1086 | + |
| 1087 | +'''''Bold italic text ''with italic deactivated'' in between.''''' |
| 1088 | + |
| 1089 | +'''Bold text.. |
| 1090 | + |
| 1091 | +..spanning two paragraphs (should not work).''' |
| 1092 | + |
| 1093 | +'''Bold tag left open |
| 1094 | + |
| 1095 | +''Italic tag left open |
| 1096 | + |
| 1097 | +Normal text. |
| 1098 | + |
| 1099 | +<!-- Unmatching number of opening, closing tags: --> |
| 1100 | +'''This year''''s election ''should'' beat '''last year''''s. |
| 1101 | + |
| 1102 | +''Tom'''s car is bigger than ''Susan'''s. |
| 1103 | +!! result |
| 1104 | +<p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i> |
| 1105 | +</p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b> |
| 1106 | +</p><p><b>Bold text..</b> |
| 1107 | +</p><p>..spanning two paragraphs (should not work). |
| 1108 | +</p><p><b>Bold tag left open</b> |
| 1109 | +</p><p><i>Italic tag left open</i> |
| 1110 | +</p><p>Normal text. |
| 1111 | +</p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s. |
| 1112 | +</p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s. |
| 1113 | +</p> |
| 1114 | +!! end |
| 1115 | + |
| 1116 | +### |
| 1117 | +### Tables |
| 1118 | +### |
| 1119 | +### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables |
| 1120 | +### |
| 1121 | + |
| 1122 | +# This should not produce <table></table> as <table><tr><td></td></tr></table> |
| 1123 | +# is the bare minimun required by the spec, see: |
| 1124 | +# http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables |
| 1125 | +!! test |
| 1126 | +A table with no data. |
| 1127 | +!! input |
| 1128 | +{||} |
| 1129 | +!! result |
| 1130 | +!! end |
| 1131 | + |
| 1132 | +# A table with nothing but a caption is invalid XHTML, we might want to render |
| 1133 | +# this as <p>caption</p> |
| 1134 | +!! test |
| 1135 | +A table with nothing but a caption |
| 1136 | +!! input |
| 1137 | +{| |
| 1138 | +|+ caption |
| 1139 | +|} |
| 1140 | +!! result |
| 1141 | +<table> |
| 1142 | +<caption> caption |
| 1143 | +</caption><tr><td></td></tr></table> |
| 1144 | + |
| 1145 | +!! end |
| 1146 | + |
| 1147 | +!! test |
| 1148 | +Simple table |
| 1149 | +!! input |
| 1150 | +{| |
| 1151 | +| 1 || 2 |
| 1152 | +|- |
| 1153 | +| 3 || 4 |
| 1154 | +|} |
| 1155 | +!! result |
| 1156 | +<table> |
| 1157 | +<tr> |
| 1158 | +<td> 1 </td> |
| 1159 | +<td> 2 |
| 1160 | +</td></tr> |
| 1161 | +<tr> |
| 1162 | +<td> 3 </td> |
| 1163 | +<td> 4 |
| 1164 | +</td></tr></table> |
| 1165 | + |
| 1166 | +!! end |
| 1167 | + |
| 1168 | +!! test |
| 1169 | +Multiplication table |
| 1170 | +!! input |
| 1171 | +{| border="1" cellpadding="2" |
| 1172 | +|+Multiplication table |
| 1173 | +|- |
| 1174 | +! × !! 1 !! 2 !! 3 |
| 1175 | +|- |
| 1176 | +! 1 |
| 1177 | +| 1 || 2 || 3 |
| 1178 | +|- |
| 1179 | +! 2 |
| 1180 | +| 2 || 4 || 6 |
| 1181 | +|- |
| 1182 | +! 3 |
| 1183 | +| 3 || 6 || 9 |
| 1184 | +|- |
| 1185 | +! 4 |
| 1186 | +| 4 || 8 || 12 |
| 1187 | +|- |
| 1188 | +! 5 |
| 1189 | +| 5 || 10 || 15 |
| 1190 | +|} |
| 1191 | +!! result |
| 1192 | +<table border="1" cellpadding="2"> |
| 1193 | +<caption>Multiplication table |
| 1194 | +</caption> |
| 1195 | +<tr> |
| 1196 | +<th> × </th> |
| 1197 | +<th> 1 </th> |
| 1198 | +<th> 2 </th> |
| 1199 | +<th> 3 |
| 1200 | +</th></tr> |
| 1201 | +<tr> |
| 1202 | +<th> 1 |
| 1203 | +</th> |
| 1204 | +<td> 1 </td> |
| 1205 | +<td> 2 </td> |
| 1206 | +<td> 3 |
| 1207 | +</td></tr> |
| 1208 | +<tr> |
| 1209 | +<th> 2 |
| 1210 | +</th> |
| 1211 | +<td> 2 </td> |
| 1212 | +<td> 4 </td> |
| 1213 | +<td> 6 |
| 1214 | +</td></tr> |
| 1215 | +<tr> |
| 1216 | +<th> 3 |
| 1217 | +</th> |
| 1218 | +<td> 3 </td> |
| 1219 | +<td> 6 </td> |
| 1220 | +<td> 9 |
| 1221 | +</td></tr> |
| 1222 | +<tr> |
| 1223 | +<th> 4 |
| 1224 | +</th> |
| 1225 | +<td> 4 </td> |
| 1226 | +<td> 8 </td> |
| 1227 | +<td> 12 |
| 1228 | +</td></tr> |
| 1229 | +<tr> |
| 1230 | +<th> 5 |
| 1231 | +</th> |
| 1232 | +<td> 5 </td> |
| 1233 | +<td> 10 </td> |
| 1234 | +<td> 15 |
| 1235 | +</td></tr></table> |
| 1236 | + |
| 1237 | +!! end |
| 1238 | + |
| 1239 | +!! test |
| 1240 | +Table rowspan |
| 1241 | +!! input |
| 1242 | +{| align=right border=1 |
| 1243 | +| Cell 1, row 1 |
| 1244 | +|rowspan=2| Cell 2, row 1 (and 2) |
| 1245 | +| Cell 3, row 1 |
| 1246 | +|- |
| 1247 | +| Cell 1, row 2 |
| 1248 | +| Cell 3, row 2 |
| 1249 | +|} |
| 1250 | +!! result |
| 1251 | +<table align="right" border="1"> |
| 1252 | +<tr> |
| 1253 | +<td> Cell 1, row 1 |
| 1254 | +</td> |
| 1255 | +<td rowspan="2"> Cell 2, row 1 (and 2) |
| 1256 | +</td> |
| 1257 | +<td> Cell 3, row 1 |
| 1258 | +</td></tr> |
| 1259 | +<tr> |
| 1260 | +<td> Cell 1, row 2 |
| 1261 | +</td> |
| 1262 | +<td> Cell 3, row 2 |
| 1263 | +</td></tr></table> |
| 1264 | + |
| 1265 | +!! end |
| 1266 | + |
| 1267 | +!! test |
| 1268 | +Nested table |
| 1269 | +!! input |
| 1270 | +{| border=1 |
| 1271 | +| α |
| 1272 | +| |
| 1273 | +{| bgcolor=#ABCDEF border=2 |
| 1274 | +|nested |
| 1275 | +|- |
| 1276 | +|table |
| 1277 | +|} |
| 1278 | +|the original table again |
| 1279 | +|} |
| 1280 | +!! result |
| 1281 | +<table border="1"> |
| 1282 | +<tr> |
| 1283 | +<td> α |
| 1284 | +</td> |
| 1285 | +<td> |
| 1286 | +<table bgcolor="#ABCDEF" border="2"> |
| 1287 | +<tr> |
| 1288 | +<td>nested |
| 1289 | +</td></tr> |
| 1290 | +<tr> |
| 1291 | +<td>table |
| 1292 | +</td></tr></table> |
| 1293 | +</td> |
| 1294 | +<td>the original table again |
| 1295 | +</td></tr></table> |
| 1296 | + |
| 1297 | +!! end |
| 1298 | + |
| 1299 | +!! test |
| 1300 | +Invalid attributes in table cell (bug 1830) |
| 1301 | +!! input |
| 1302 | +{| |
| 1303 | +|Cell:|broken |
| 1304 | +|} |
| 1305 | +!! result |
| 1306 | +<table> |
| 1307 | +<tr> |
| 1308 | +<td>broken |
| 1309 | +</td></tr></table> |
| 1310 | + |
| 1311 | +!! end |
| 1312 | + |
| 1313 | + |
| 1314 | +!! test |
| 1315 | +Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html) |
| 1316 | +!! input |
| 1317 | +{| |
| 1318 | +| |[ftp://|x||]" onmouseover="alert(document.cookie)">test |
| 1319 | +!! result |
| 1320 | +<table> |
| 1321 | +<tr> |
| 1322 | +<td>[<a href="ftp://%7Cx" class="external free" rel="nofollow">ftp://%7Cx</a></td> |
| 1323 | +<td>]" onmouseover="alert(document.cookie)">test |
| 1324 | +</td> |
| 1325 | +</tr> |
| 1326 | +</table> |
| 1327 | + |
| 1328 | +!! end |
| 1329 | + |
| 1330 | + |
| 1331 | +### |
| 1332 | +### Internal links |
| 1333 | +### |
| 1334 | +!! test |
| 1335 | +Plain link, capitalized |
| 1336 | +!! input |
| 1337 | +[[Main Page]] |
| 1338 | +!! result |
| 1339 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
| 1340 | +</p> |
| 1341 | +!! end |
| 1342 | + |
| 1343 | +!! test |
| 1344 | +Plain link, uncapitalized |
| 1345 | +!! input |
| 1346 | +[[main Page]] |
| 1347 | +!! result |
| 1348 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a> |
| 1349 | +</p> |
| 1350 | +!! end |
| 1351 | + |
| 1352 | +!! test |
| 1353 | +Piped link |
| 1354 | +!! input |
| 1355 | +[[Main Page|The Main Page]] |
| 1356 | +!! result |
| 1357 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">The Main Page</a> |
| 1358 | +</p> |
| 1359 | +!! end |
| 1360 | + |
| 1361 | +!! test |
| 1362 | +Broken link |
| 1363 | +!! input |
| 1364 | +[[Zigzagzogzagzig]] |
| 1365 | +!! result |
| 1366 | +<p><a href="https://www.mediawiki.org/index.php?title=Zigzagzogzagzig&action=edit&redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a> |
| 1367 | +</p> |
| 1368 | +!! end |
| 1369 | + |
| 1370 | +!! test |
| 1371 | +Broken link with fragment |
| 1372 | +!! input |
| 1373 | +[[Zigzagzogzagzig#zug]] |
| 1374 | +!! result |
| 1375 | +<p><a href="https://www.mediawiki.org/index.php?title=Zigzagzogzagzig&action=edit&redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a> |
| 1376 | +</p> |
| 1377 | +!! end |
| 1378 | + |
| 1379 | +!! test |
| 1380 | +Special page link with fragment |
| 1381 | +!! input |
| 1382 | +[[Special:Version#anchor]] |
| 1383 | +!! result |
| 1384 | +<p><a href="https://www.mediawiki.org/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a> |
| 1385 | +</p> |
| 1386 | +!! end |
| 1387 | + |
| 1388 | +!! test |
| 1389 | +Nonexistent special page link with fragment |
| 1390 | +!! input |
| 1391 | +[[Special:ThisNameWillHopefullyNeverBeUsed#anchor]] |
| 1392 | +!! result |
| 1393 | +<p><a href="https://www.mediawiki.org/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a> |
| 1394 | +</p> |
| 1395 | +!! end |
| 1396 | + |
| 1397 | +!! test |
| 1398 | +Link with prefix |
| 1399 | +!! input |
| 1400 | +xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]] |
| 1401 | +!! result |
| 1402 | +<p>xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
| 1403 | +</p> |
| 1404 | +!! end |
| 1405 | + |
| 1406 | +!! test |
| 1407 | +Link with suffix |
| 1408 | +!! input |
| 1409 | +[[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!! |
| 1410 | +!! result |
| 1411 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>!!! |
| 1412 | +</p> |
| 1413 | +!! end |
| 1414 | + |
| 1415 | +!! test |
| 1416 | +Link with 3 brackets |
| 1417 | +!! input |
| 1418 | +[[[main page]]] |
| 1419 | +!! result |
| 1420 | +<p>[[[main page]]] |
| 1421 | +</p> |
| 1422 | +!! end |
| 1423 | + |
| 1424 | +!! test |
| 1425 | +Piped link with 3 brackets |
| 1426 | +!! input |
| 1427 | +[[[main page|the main page]]] |
| 1428 | +!! result |
| 1429 | +<p>[[[main page|the main page]]] |
| 1430 | +</p> |
| 1431 | +!! end |
| 1432 | + |
| 1433 | +!! test |
| 1434 | +Link with multiple pipes |
| 1435 | +!! input |
| 1436 | +[[Main Page|The|Main|Page]] |
| 1437 | +!! result |
| 1438 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">The|Main|Page</a> |
| 1439 | +</p> |
| 1440 | +!! end |
| 1441 | + |
| 1442 | +!! test |
| 1443 | +Link to namespaces |
| 1444 | +!! input |
| 1445 | +[[Talk:Parser testing]], [[Meta:Disclaimers]] |
| 1446 | +!! result |
| 1447 | +<p><a href="https://www.mediawiki.org/index.php?title=Talk:Parser_testing&action=edit&redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="https://www.mediawiki.org/index.php?title=Meta:Disclaimers&action=edit&redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a> |
| 1448 | +</p> |
| 1449 | +!! end |
| 1450 | + |
| 1451 | +!! test |
| 1452 | +Piped link to namespace |
| 1453 | +!! input |
| 1454 | +[[Meta:Disclaimers|The disclaimers]] |
| 1455 | +!! result |
| 1456 | +<p><a href="https://www.mediawiki.org/index.php?title=Meta:Disclaimers&action=edit&redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a> |
| 1457 | +</p> |
| 1458 | +!! end |
| 1459 | + |
| 1460 | +!! test |
| 1461 | +Link containing } |
| 1462 | +!! input |
| 1463 | +[[Usually caused by a typo (oops}]] |
| 1464 | +!! result |
| 1465 | +<p>[[Usually caused by a typo (oops}]] |
| 1466 | +</p> |
| 1467 | +!! end |
| 1468 | + |
| 1469 | +!! test |
| 1470 | +Link containing % (not as a hex sequence) |
| 1471 | +!! input |
| 1472 | +[[7% Solution]] |
| 1473 | +!! result |
| 1474 | +<p><a href="https://www.mediawiki.org/index.php?title=7%25_Solution&action=edit&redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a> |
| 1475 | +</p> |
| 1476 | +!! end |
| 1477 | + |
| 1478 | +!! test |
| 1479 | +Link containing % as a single hex sequence interpreted to char |
| 1480 | +!! input |
| 1481 | +[[7%25 Solution]] |
| 1482 | +!! result |
| 1483 | +<p><a href="https://www.mediawiki.org/index.php?title=7%25_Solution&action=edit&redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a> |
| 1484 | +</p> |
| 1485 | +!!end |
| 1486 | + |
| 1487 | +!! test |
| 1488 | +Link containing % as a double hex sequence interpreted to hex sequence |
| 1489 | +!! input |
| 1490 | +[[7%2525 Solution]] |
| 1491 | +!! result |
| 1492 | +<p>[[7%2525 Solution]] |
| 1493 | +</p> |
| 1494 | +!!end |
| 1495 | + |
| 1496 | +!! test |
| 1497 | +Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors |
| 1498 | +Example for such a section: == < == |
| 1499 | +!! input |
| 1500 | +[[%23%3c]][[%23%3e]] |
| 1501 | +!! result |
| 1502 | +<p><a href="#.3C">#<</a><a href="#.3E">#></a> |
| 1503 | +</p> |
| 1504 | +!! end |
| 1505 | + |
| 1506 | +!! test |
| 1507 | +Link containing "<#" and ">#" as a hex sequences |
| 1508 | +!! input |
| 1509 | +[[%3c%23]][[%3e%23]] |
| 1510 | +!! result |
| 1511 | +<p>[[%3c%23]][[%3e%23]] |
| 1512 | +</p> |
| 1513 | +!! end |
| 1514 | + |
| 1515 | +!! test |
| 1516 | +Link containing double-single-quotes '' (bug 4598) |
| 1517 | +!! input |
| 1518 | +[[Lista d''e paise d''o munno]] |
| 1519 | +!! result |
| 1520 | +<p><a href="https://www.mediawiki.org/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&action=edit&redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a> |
| 1521 | +</p> |
| 1522 | +!! end |
| 1523 | + |
| 1524 | +!! test |
| 1525 | +Link containing double-single-quotes '' in text (bug 4598 sanity check) |
| 1526 | +!! input |
| 1527 | +Some [[Link|pretty ''italics'' and stuff]]! |
| 1528 | +!! result |
| 1529 | +<p>Some <a href="https://www.mediawiki.org/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>! |
| 1530 | +</p> |
| 1531 | +!! end |
| 1532 | + |
| 1533 | +!! test |
| 1534 | +Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check) |
| 1535 | +!! input |
| 1536 | +''Some [[Link|pretty ''italics'' and stuff]]! |
| 1537 | +!! result |
| 1538 | +<p><i>Some <a href="https://www.mediawiki.org/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i> |
| 1539 | +</p> |
| 1540 | +!! end |
| 1541 | + |
| 1542 | +!! test |
| 1543 | +Link with double quotes in title part (literal) and alternate part (interpreted) |
| 1544 | +!! input |
| 1545 | +[[File:Denys Savchenko ''Pentecoste''.jpg]] |
| 1546 | + |
| 1547 | +[[''Pentecoste'']] |
| 1548 | + |
| 1549 | +[[''Pentecoste''|Pentecoste]] |
| 1550 | + |
| 1551 | +[[''Pentecoste''|''Pentecoste'']] |
| 1552 | +!! result |
| 1553 | +<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko ''Pentecoste''.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a> |
| 1554 | +</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a> |
| 1555 | +</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a> |
| 1556 | +</p><p><a href="https://www.mediawiki.org/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a> |
| 1557 | +</p> |
| 1558 | +!! end |
| 1559 | + |
| 1560 | +!! test |
| 1561 | +Plain link to URL |
| 1562 | +!! input |
| 1563 | +[[http://www.example.com]] |
| 1564 | +!! result |
| 1565 | +<p>[<a href="http://www.example.com" class="external autonumber" rel="nofollow">[1]</a>] |
| 1566 | +</p> |
| 1567 | +!! end |
| 1568 | + |
| 1569 | +# I'm fairly sure the expected result here is wrong. |
| 1570 | +# We want these to be URL links, not pseudo-pages with URLs for titles.... |
| 1571 | +# However the current output is also pretty screwy. |
| 1572 | +# |
| 1573 | +# ---- |
| 1574 | +# I'm changing it to match the current output--it arguably makes more |
| 1575 | +# sense in the light of the test above. Old expected result was: |
| 1576 | +#<p>Piped link to URL: <a href="https://www.mediawiki.org/index.php?title=Http://www.example.com&action=edit" class="new">an example URL</a> |
| 1577 | +#</p> |
| 1578 | +# But I think this test is bordering on "garbage in, garbage out" anyway. |
| 1579 | +# -- wtm |
| 1580 | +!! test |
| 1581 | +Piped link to URL |
| 1582 | +!! input |
| 1583 | +Piped link to URL: [[http://www.example.com|an example URL]] |
| 1584 | +!! result |
| 1585 | +<p>Piped link to URL: [<a href="http://www.example.com%7Can" class="external text" rel="nofollow">example URL</a>] |
| 1586 | +</p> |
| 1587 | +!! end |
| 1588 | + |
| 1589 | +!! test |
| 1590 | +BUG 2: [[page|http://url/]] should link to page, not http://url/ |
| 1591 | +!! input |
| 1592 | +[[Main Page|http://url/]] |
| 1593 | +!! result |
| 1594 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">http://url/</a> |
| 1595 | +</p> |
| 1596 | +!! end |
| 1597 | + |
| 1598 | +!! test |
| 1599 | +BUG 337: Escaped self-links should be bold |
| 1600 | +!! options |
| 1601 | +title=[[Bug462]] |
| 1602 | +!! input |
| 1603 | +[[Bug462]] [[Bug462]] |
| 1604 | +!! result |
| 1605 | +<p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong> |
| 1606 | +</p> |
| 1607 | +!! end |
| 1608 | + |
| 1609 | +!! test |
| 1610 | +Self-link to section should not be bold |
| 1611 | +!! options |
| 1612 | +title=[[Main Page]] |
| 1613 | +!! input |
| 1614 | +[[Main Page#section]] |
| 1615 | +!! result |
| 1616 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page#section" title="Main Page">Main Page#section</a> |
| 1617 | +</p> |
| 1618 | +!! end |
| 1619 | + |
| 1620 | +!! article |
| 1621 | +00 |
| 1622 | +!! text |
| 1623 | +This is 00. |
| 1624 | +!! endarticle |
| 1625 | + |
| 1626 | +!!test |
| 1627 | +Self-link to numeric title |
| 1628 | +!!options |
| 1629 | +title=[[0]] |
| 1630 | +!!input |
| 1631 | +[[0]] |
| 1632 | +!!result |
| 1633 | +<p><strong class="selflink">0</strong> |
| 1634 | +</p> |
| 1635 | +!!end |
| 1636 | + |
| 1637 | +!!test |
| 1638 | +Link to numeric-equivalent title |
| 1639 | +!!options |
| 1640 | +title=[[0]] |
| 1641 | +!!input |
| 1642 | +[[00]] |
| 1643 | +!!result |
| 1644 | +<p><a href="https://www.mediawiki.org/wiki/00" title="00">00</a> |
| 1645 | +</p> |
| 1646 | +!!end |
| 1647 | + |
| 1648 | +!! test |
| 1649 | +<nowiki> inside a link |
| 1650 | +!! input |
| 1651 | +[[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]] |
| 1652 | +!! result |
| 1653 | +<p>[[Main Page]] <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a> |
| 1654 | +</p> |
| 1655 | +!! end |
| 1656 | + |
| 1657 | +!! test |
| 1658 | +Non-breaking spaces in title |
| 1659 | +!! input |
| 1660 | +[[ Main Page ]] |
| 1661 | +!! result |
| 1662 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page"> Main Page </a> |
| 1663 | +</p> |
| 1664 | +!!end |
| 1665 | + |
| 1666 | + |
| 1667 | +### |
| 1668 | +### Interwiki links (see maintenance/interwiki.sql) |
| 1669 | +### |
| 1670 | + |
| 1671 | +!! test |
| 1672 | +Inline interwiki link |
| 1673 | +!! input |
| 1674 | +[[MeatBall:SoftSecurity]] |
| 1675 | +!! result |
| 1676 | +<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a> |
| 1677 | +</p> |
| 1678 | +!! end |
| 1679 | + |
| 1680 | +!! test |
| 1681 | +Inline interwiki link with empty title (bug 2372) |
| 1682 | +!! input |
| 1683 | +[[MeatBall:]] |
| 1684 | +!! result |
| 1685 | +<p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a> |
| 1686 | +</p> |
| 1687 | +!! end |
| 1688 | + |
| 1689 | +!! test |
| 1690 | +Interwiki link encoding conversion (bug 1636) |
| 1691 | +!! input |
| 1692 | +*[[Wikipedia:ro:Olteniţa]] |
| 1693 | +*[[Wikipedia:ro:Olteniţa]] |
| 1694 | +!! result |
| 1695 | +<ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a> |
| 1696 | +</li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a> |
| 1697 | +</li></ul> |
| 1698 | + |
| 1699 | +!! end |
| 1700 | + |
| 1701 | +!! test |
| 1702 | +Interwiki link with fragment (bug 2130) |
| 1703 | +!! input |
| 1704 | +[[MeatBall:SoftSecurity#foo]] |
| 1705 | +!! result |
| 1706 | +<p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a> |
| 1707 | +</p> |
| 1708 | +!! end |
| 1709 | + |
| 1710 | +!! test |
| 1711 | +Interlanguage link |
| 1712 | +!! input |
| 1713 | +Blah blah blah |
| 1714 | +[[zh:Chinese]] |
| 1715 | +!!result |
| 1716 | +<p>Blah blah blah |
| 1717 | +</p> |
| 1718 | +!! end |
| 1719 | + |
| 1720 | +!! test |
| 1721 | +Double interlanguage link |
| 1722 | +!! input |
| 1723 | +Blah blah blah |
| 1724 | +[[es:Spanish]] |
| 1725 | +[[zh:Chinese]] |
| 1726 | +!!result |
| 1727 | +<p>Blah blah blah |
| 1728 | +</p> |
| 1729 | +!! end |
| 1730 | + |
| 1731 | +!! test |
| 1732 | +Interlanguage link, with prefix links |
| 1733 | +!! options |
| 1734 | +language=ln |
| 1735 | +!! input |
| 1736 | +Blah blah blah |
| 1737 | +[[zh:Chinese]] |
| 1738 | +!!result |
| 1739 | +<p>Blah blah blah |
| 1740 | +</p> |
| 1741 | +!! end |
| 1742 | + |
| 1743 | +!! test |
| 1744 | +Double interlanguage link, with prefix links (bug 8897) |
| 1745 | +!! options |
| 1746 | +language=ln |
| 1747 | +!! input |
| 1748 | +Blah blah blah |
| 1749 | +[[es:Spanish]] |
| 1750 | +[[zh:Chinese]] |
| 1751 | +!!result |
| 1752 | +<p>Blah blah blah |
| 1753 | +</p> |
| 1754 | +!! end |
| 1755 | + |
| 1756 | + |
| 1757 | +## |
| 1758 | +## XHTML tidiness |
| 1759 | +### |
| 1760 | + |
| 1761 | +!! test |
| 1762 | +<br> to <br /> |
| 1763 | +!! input |
| 1764 | +1<br>2<br />3 |
| 1765 | +!! result |
| 1766 | +<p>1<br />2<br />3 |
| 1767 | +</p> |
| 1768 | +!! end |
| 1769 | + |
| 1770 | +!! test |
| 1771 | +Incorrecly removing closing slashes from correctly formed XHTML |
| 1772 | +!! input |
| 1773 | +<br style="clear:both;" /> |
| 1774 | +!! result |
| 1775 | +<p><br style="clear:both;" /> |
| 1776 | +</p> |
| 1777 | +!! end |
| 1778 | + |
| 1779 | +!! test |
| 1780 | +Failing to transform badly formed HTML into correct XHTML |
| 1781 | +!! input |
| 1782 | +<br clear=left> |
| 1783 | +<br clear=right> |
| 1784 | +<br clear=all> |
| 1785 | +!! result |
| 1786 | +<p><br clear="left" /> |
| 1787 | +<br clear="right" /> |
| 1788 | +<br clear="all" /> |
| 1789 | +</p> |
| 1790 | +!!end |
| 1791 | + |
| 1792 | +!! test |
| 1793 | +Horizontal ruler (should it add that extra space?) |
| 1794 | +!! input |
| 1795 | +<hr> |
| 1796 | +<hr > |
| 1797 | +foo <hr |
| 1798 | +> bar |
| 1799 | +!! result |
| 1800 | +<hr /> |
| 1801 | +<hr /> |
| 1802 | +foo <hr /> bar |
| 1803 | + |
| 1804 | +!! end |
| 1805 | + |
| 1806 | +### |
| 1807 | +### Block-level elements |
| 1808 | +### |
| 1809 | +!! test |
| 1810 | +Common list |
| 1811 | +!! input |
| 1812 | +*Common list |
| 1813 | +* item 2 |
| 1814 | +*item 3 |
| 1815 | +!! result |
| 1816 | +<ul><li>Common list |
| 1817 | +</li><li> item 2 |
| 1818 | +</li><li>item 3 |
| 1819 | +</li></ul> |
| 1820 | + |
| 1821 | +!! end |
| 1822 | + |
| 1823 | +!! test |
| 1824 | +Numbered list |
| 1825 | +!! input |
| 1826 | +#Numbered list |
| 1827 | +#item 2 |
| 1828 | +# item 3 |
| 1829 | +!! result |
| 1830 | +<ol><li>Numbered list |
| 1831 | +</li><li>item 2 |
| 1832 | +</li><li> item 3 |
| 1833 | +</li></ol> |
| 1834 | + |
| 1835 | +!! end |
| 1836 | + |
| 1837 | +!! test |
| 1838 | +Mixed list |
| 1839 | +!! input |
| 1840 | +*Mixed list |
| 1841 | +*# with numbers |
| 1842 | +** and bullets |
| 1843 | +*# and numbers |
| 1844 | +*bullets again |
| 1845 | +**bullet level 2 |
| 1846 | +***bullet level 3 |
| 1847 | +***#Number on level 4 |
| 1848 | +**bullet level 2 |
| 1849 | +**#Number on level 3 |
| 1850 | +**#Number on level 3 |
| 1851 | +*#number level 2 |
| 1852 | +*Level 1 |
| 1853 | +!! result |
| 1854 | +<ul><li>Mixed list |
| 1855 | +<ol><li> with numbers |
| 1856 | +</li></ol> |
| 1857 | +<ul><li> and bullets |
| 1858 | +</li></ul> |
| 1859 | +<ol><li> and numbers |
| 1860 | +</li></ol> |
| 1861 | +</li><li>bullets again |
| 1862 | +<ul><li>bullet level 2 |
| 1863 | +<ul><li>bullet level 3 |
| 1864 | +<ol><li>Number on level 4 |
| 1865 | +</li></ol> |
| 1866 | +</li></ul> |
| 1867 | +</li><li>bullet level 2 |
| 1868 | +<ol><li>Number on level 3 |
| 1869 | +</li><li>Number on level 3 |
| 1870 | +</li></ol> |
| 1871 | +</li></ul> |
| 1872 | +<ol><li>number level 2 |
| 1873 | +</li></ol> |
| 1874 | +</li><li>Level 1 |
| 1875 | +</li></ul> |
| 1876 | + |
| 1877 | +!! end |
| 1878 | + |
| 1879 | +!! test |
| 1880 | +List items are not parsed correctly following a <pre> block (bug 785) |
| 1881 | +!! input |
| 1882 | +* <pre>foo</pre> |
| 1883 | +* <pre>bar</pre> |
| 1884 | +* zar |
| 1885 | +!! result |
| 1886 | +<ul><li> <pre>foo</pre> |
| 1887 | +</li><li> <pre>bar</pre> |
| 1888 | +</li><li> zar |
| 1889 | +</li></ul> |
| 1890 | + |
| 1891 | +!! end |
| 1892 | + |
| 1893 | +### |
| 1894 | +### Magic Words |
| 1895 | +### |
| 1896 | + |
| 1897 | +!! test |
| 1898 | +Magic Word: {{CURRENTDAY}} |
| 1899 | +!! input |
| 1900 | +{{CURRENTDAY}} |
| 1901 | +!! result |
| 1902 | +<p>1 |
| 1903 | +</p> |
| 1904 | +!! end |
| 1905 | + |
| 1906 | +!! test |
| 1907 | +Magic Word: {{CURRENTDAY2}} |
| 1908 | +!! input |
| 1909 | +{{CURRENTDAY2}} |
| 1910 | +!! result |
| 1911 | +<p>01 |
| 1912 | +</p> |
| 1913 | +!! end |
| 1914 | + |
| 1915 | +!! test |
| 1916 | +Magic Word: {{CURRENTDAYNAME}} |
| 1917 | +!! input |
| 1918 | +{{CURRENTDAYNAME}} |
| 1919 | +!! result |
| 1920 | +<p>Thursday |
| 1921 | +</p> |
| 1922 | +!! end |
| 1923 | + |
| 1924 | +!! test |
| 1925 | +Magic Word: {{CURRENTDOW}} |
| 1926 | +!! input |
| 1927 | +{{CURRENTDOW}} |
| 1928 | +!! result |
| 1929 | +<p>4 |
| 1930 | +</p> |
| 1931 | +!! end |
| 1932 | + |
| 1933 | +!! test |
| 1934 | +Magic Word: {{CURRENTMONTH}} |
| 1935 | +!! input |
| 1936 | +{{CURRENTMONTH}} |
| 1937 | +!! result |
| 1938 | +<p>01 |
| 1939 | +</p> |
| 1940 | +!! end |
| 1941 | + |
| 1942 | +!! test |
| 1943 | +Magic Word: {{CURRENTMONTHABBREV}} |
| 1944 | +!! input |
| 1945 | +{{CURRENTMONTHABBREV}} |
| 1946 | +!! result |
| 1947 | +<p>Jan |
| 1948 | +</p> |
| 1949 | +!! end |
| 1950 | + |
| 1951 | +!! test |
| 1952 | +Magic Word: {{CURRENTMONTHNAME}} |
| 1953 | +!! input |
| 1954 | +{{CURRENTMONTHNAME}} |
| 1955 | +!! result |
| 1956 | +<p>January |
| 1957 | +</p> |
| 1958 | +!! end |
| 1959 | + |
| 1960 | +!! test |
| 1961 | +Magic Word: {{CURRENTMONTHNAMEGEN}} |
| 1962 | +!! input |
| 1963 | +{{CURRENTMONTHNAMEGEN}} |
| 1964 | +!! result |
| 1965 | +<p>January |
| 1966 | +</p> |
| 1967 | +!! end |
| 1968 | + |
| 1969 | +!! test |
| 1970 | +Magic Word: {{CURRENTTIME}} |
| 1971 | +!! input |
| 1972 | +{{CURRENTTIME}} |
| 1973 | +!! result |
| 1974 | +<p>00:02 |
| 1975 | +</p> |
| 1976 | +!! end |
| 1977 | + |
| 1978 | +!! test |
| 1979 | +Magic Word: {{CURRENTWEEK}} (@bug 4594) |
| 1980 | +!! input |
| 1981 | +{{CURRENTWEEK}} |
| 1982 | +!! result |
| 1983 | +<p>1 |
| 1984 | +</p> |
| 1985 | +!! end |
| 1986 | + |
| 1987 | +!! test |
| 1988 | +Magic Word: {{CURRENTYEAR}} |
| 1989 | +!! input |
| 1990 | +{{CURRENTYEAR}} |
| 1991 | +!! result |
| 1992 | +<p>1970 |
| 1993 | +</p> |
| 1994 | +!! end |
| 1995 | + |
| 1996 | +!! test |
| 1997 | +Magic Word: {{FULLPAGENAME}} |
| 1998 | +!! options |
| 1999 | +title=[[User:Ævar Arnfjörð Bjarmason]] |
| 2000 | +!! input |
| 2001 | +{{FULLPAGENAME}} |
| 2002 | +!! result |
| 2003 | +<p>User:Ævar Arnfjörð Bjarmason |
| 2004 | +</p> |
| 2005 | +!! end |
| 2006 | + |
| 2007 | +!! test |
| 2008 | +Magic Word: {{FULLPAGENAMEE}} |
| 2009 | +!! options |
| 2010 | +title=[[User:Ævar Arnfjörð Bjarmason]] |
| 2011 | +!! input |
| 2012 | +{{FULLPAGENAMEE}} |
| 2013 | +!! result |
| 2014 | +<p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason |
| 2015 | +</p> |
| 2016 | +!! end |
| 2017 | + |
| 2018 | +!! test |
| 2019 | +Magic Word: {{NAMESPACE}} |
| 2020 | +!! options |
| 2021 | +title=[[User:Ævar Arnfjörð Bjarmason]] |
| 2022 | +!! input |
| 2023 | +{{NAMESPACE}} |
| 2024 | +!! result |
| 2025 | +<p>User |
| 2026 | +</p> |
| 2027 | +!! end |
| 2028 | + |
| 2029 | +!! test |
| 2030 | +Magic Word: {{NAMESPACEE}} |
| 2031 | +!! options |
| 2032 | +title=[[User:Ævar Arnfjörð Bjarmason]] |
| 2033 | +!! input |
| 2034 | +{{NAMESPACEE}} |
| 2035 | +!! result |
| 2036 | +<p>User |
| 2037 | +</p> |
| 2038 | +!! end |
| 2039 | + |
| 2040 | +!! test |
| 2041 | +Magic Word: {{NUMBEROFFILES}} |
| 2042 | +!! input |
| 2043 | +{{NUMBEROFFILES}} |
| 2044 | +!! result |
| 2045 | +<p>2 |
| 2046 | +</p> |
| 2047 | +!! end |
| 2048 | + |
| 2049 | +!! test |
| 2050 | +Magic Word: {{PAGENAME}} |
| 2051 | +!! options |
| 2052 | +title=[[User:Ævar Arnfjörð Bjarmason]] |
| 2053 | +!! input |
| 2054 | +{{PAGENAME}} |
| 2055 | +!! result |
| 2056 | +<p>Ævar Arnfjörð Bjarmason |
| 2057 | +</p> |
| 2058 | +!! end |
| 2059 | + |
| 2060 | +!! test |
| 2061 | +Magic Word: {{PAGENAMEE}} |
| 2062 | +!! options |
| 2063 | +title=[[User:Ævar Arnfjörð Bjarmason]] |
| 2064 | +!! input |
| 2065 | +{{PAGENAMEE}} |
| 2066 | +!! result |
| 2067 | +<p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason |
| 2068 | +</p> |
| 2069 | +!! end |
| 2070 | + |
| 2071 | +!! test |
| 2072 | +Magic Word: {{REVISIONID}} |
| 2073 | +!! input |
| 2074 | +{{REVISIONID}} |
| 2075 | +!! result |
| 2076 | +<p>1337 |
| 2077 | +</p> |
| 2078 | +!! end |
| 2079 | + |
| 2080 | +!! test |
| 2081 | +Magic Word: {{SCRIPTPATH}} |
| 2082 | +!! input |
| 2083 | +{{SCRIPTPATH}} |
| 2084 | +!! result |
| 2085 | +<p>/ |
| 2086 | +</p> |
| 2087 | +!! end |
| 2088 | + |
| 2089 | +!! test |
| 2090 | +Magic Word: {{SERVER}} |
| 2091 | +!! input |
| 2092 | +{{SERVER}} |
| 2093 | +!! result |
| 2094 | +<p><a href="http://localhost" class="external free" rel="nofollow">http://localhost</a> |
| 2095 | +</p> |
| 2096 | +!! end |
| 2097 | + |
| 2098 | +!! test |
| 2099 | +Magic Word: {{SERVERNAME}} |
| 2100 | +!! input |
| 2101 | +{{SERVERNAME}} |
| 2102 | +!! result |
| 2103 | +<p>Britney-Spears |
| 2104 | +</p> |
| 2105 | +!! end |
| 2106 | + |
| 2107 | +!! test |
| 2108 | +Magic Word: {{SITENAME}} |
| 2109 | +!! input |
| 2110 | +{{SITENAME}} |
| 2111 | +!! result |
| 2112 | +<p>MediaWiki |
| 2113 | +</p> |
| 2114 | +!! end |
| 2115 | + |
| 2116 | +!! test |
| 2117 | +Namespace 1 {{ns:1}} |
| 2118 | +!! input |
| 2119 | +{{ns:1}} |
| 2120 | +!! result |
| 2121 | +<p>Talk |
| 2122 | +</p> |
| 2123 | +!! end |
| 2124 | + |
| 2125 | +!! test |
| 2126 | +Namespace 1 {{ns:01}} |
| 2127 | +!! input |
| 2128 | +{{ns:01}} |
| 2129 | +!! result |
| 2130 | +<p>Talk |
| 2131 | +</p> |
| 2132 | +!! end |
| 2133 | + |
| 2134 | +!! test |
| 2135 | +Namespace 0 {{ns:0}} (bug 4783) |
| 2136 | +!! input |
| 2137 | +{{ns:0}} |
| 2138 | +!! result |
| 2139 | + |
| 2140 | +!! end |
| 2141 | + |
| 2142 | +!! test |
| 2143 | +Namespace 0 {{ns:00}} (bug 4783) |
| 2144 | +!! input |
| 2145 | +{{ns:00}} |
| 2146 | +!! result |
| 2147 | + |
| 2148 | +!! end |
| 2149 | + |
| 2150 | +!! test |
| 2151 | +Namespace -1 {{ns:-1}} |
| 2152 | +!! input |
| 2153 | +{{ns:-1}} |
| 2154 | +!! result |
| 2155 | +<p>Special |
| 2156 | +</p> |
| 2157 | +!! end |
| 2158 | + |
| 2159 | +!! test |
| 2160 | +Namespace User {{ns:User}} |
| 2161 | +!! input |
| 2162 | +{{ns:User}} |
| 2163 | +!! result |
| 2164 | +<p>User |
| 2165 | +</p> |
| 2166 | +!! end |
| 2167 | + |
| 2168 | +!! test |
| 2169 | +Namespace User talk {{ns:User_talk}} |
| 2170 | +!! input |
| 2171 | +{{ns:User_talk}} |
| 2172 | +!! result |
| 2173 | +<p>User talk |
| 2174 | +</p> |
| 2175 | +!! end |
| 2176 | + |
| 2177 | +!! test |
| 2178 | +Namespace User talk {{ns:uSeR tAlK}} |
| 2179 | +!! input |
| 2180 | +{{ns:uSeR tAlK}} |
| 2181 | +!! result |
| 2182 | +<p>User talk |
| 2183 | +</p> |
| 2184 | +!! end |
| 2185 | + |
| 2186 | +!! test |
| 2187 | +Namespace File {{ns:File}} |
| 2188 | +!! input |
| 2189 | +{{ns:File}} |
| 2190 | +!! result |
| 2191 | +<p>File |
| 2192 | +</p> |
| 2193 | +!! end |
| 2194 | + |
| 2195 | +!! test |
| 2196 | +Namespace File {{ns:Image}} |
| 2197 | +!! input |
| 2198 | +{{ns:Image}} |
| 2199 | +!! result |
| 2200 | +<p>File |
| 2201 | +</p> |
| 2202 | +!! end |
| 2203 | + |
| 2204 | +!! test |
| 2205 | +Namespace (lang=de) Benutzer {{ns:User}} |
| 2206 | +!! options |
| 2207 | +language=de |
| 2208 | +!! input |
| 2209 | +{{ns:User}} |
| 2210 | +!! result |
| 2211 | +<p>Benutzer |
| 2212 | +</p> |
| 2213 | +!! end |
| 2214 | + |
| 2215 | +!! test |
| 2216 | +Namespace (lang=de) Benutzer Diskussion {{ns:3}} |
| 2217 | +!! options |
| 2218 | +language=de |
| 2219 | +!! input |
| 2220 | +{{ns:3}} |
| 2221 | +!! result |
| 2222 | +<p>Benutzer Diskussion |
| 2223 | +</p> |
| 2224 | +!! end |
| 2225 | + |
| 2226 | + |
| 2227 | +!! test |
| 2228 | +Urlencode |
| 2229 | +!! input |
| 2230 | +{{urlencode:hi world?!}} |
| 2231 | +{{urlencode:hi world?!|WIKI}} |
| 2232 | +{{urlencode:hi world?!|PATH}} |
| 2233 | +{{urlencode:hi world?!|QUERY}} |
| 2234 | +!! result |
| 2235 | +<p>hi+world%3F%21 |
| 2236 | +hi_world%3F! |
| 2237 | +hi%20world%3F%21 |
| 2238 | +hi+world%3F%21 |
| 2239 | +</p> |
| 2240 | +!! end |
| 2241 | + |
| 2242 | +### |
| 2243 | +### Magic links |
| 2244 | +### |
| 2245 | +!! test |
| 2246 | +Magic links: internal link to RFC (bug 479) |
| 2247 | +!! input |
| 2248 | +[[RFC 123]] |
| 2249 | +!! result |
| 2250 | +<p><a href="https://www.mediawiki.org/index.php?title=RFC_123&action=edit&redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a> |
| 2251 | +</p> |
| 2252 | +!! end |
| 2253 | + |
| 2254 | +!! test |
| 2255 | +Magic links: RFC (bug 479) |
| 2256 | +!! input |
| 2257 | +RFC 822 |
| 2258 | +!! result |
| 2259 | +<p><a href="http://tools.ietf.org/html/rfc822" class="external mw-magiclink-rfc">RFC 822</a> |
| 2260 | +</p> |
| 2261 | +!! end |
| 2262 | + |
| 2263 | +!! test |
| 2264 | +Magic links: ISBN (bug 1937) |
| 2265 | +!! input |
| 2266 | +ISBN 0-306-40615-2 |
| 2267 | +!! result |
| 2268 | +<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a> |
| 2269 | +</p> |
| 2270 | +!! end |
| 2271 | + |
| 2272 | +!! test |
| 2273 | +Magic links: PMID incorrectly converts space to underscore |
| 2274 | +!! input |
| 2275 | +PMID 1234 |
| 2276 | +!! result |
| 2277 | +<p><a href="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" class="external mw-magiclink-pmid">PMID 1234</a> |
| 2278 | +</p> |
| 2279 | +!! end |
| 2280 | + |
| 2281 | +### |
| 2282 | +### Templates |
| 2283 | +#### |
| 2284 | + |
| 2285 | +!! test |
| 2286 | +Nonexistent template |
| 2287 | +!! input |
| 2288 | +{{thistemplatedoesnotexist}} |
| 2289 | +!! result |
| 2290 | +<p><a href="https://www.mediawiki.org/index.php?title=Template:Thistemplatedoesnotexist&action=edit&redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a> |
| 2291 | +</p> |
| 2292 | +!! end |
| 2293 | + |
| 2294 | +!! article |
| 2295 | +Template:test |
| 2296 | +!! text |
| 2297 | +This is a test template |
| 2298 | +!! endarticle |
| 2299 | + |
| 2300 | +!! test |
| 2301 | +Simple template |
| 2302 | +!! input |
| 2303 | +{{test}} |
| 2304 | +!! result |
| 2305 | +<p>This is a test template |
| 2306 | +</p> |
| 2307 | +!! end |
| 2308 | + |
| 2309 | +!! test |
| 2310 | +Template with explicit namespace |
| 2311 | +!! input |
| 2312 | +{{Template:test}} |
| 2313 | +!! result |
| 2314 | +<p>This is a test template |
| 2315 | +</p> |
| 2316 | +!! end |
| 2317 | + |
| 2318 | + |
| 2319 | +!! article |
| 2320 | +Template:paramtest |
| 2321 | +!! text |
| 2322 | +This is a test template with parameter {{{param}}} |
| 2323 | +!! endarticle |
| 2324 | + |
| 2325 | +!! test |
| 2326 | +Template parameter |
| 2327 | +!! input |
| 2328 | +{{paramtest|param=foo}} |
| 2329 | +!! result |
| 2330 | +<p>This is a test template with parameter foo |
| 2331 | +</p> |
| 2332 | +!! end |
| 2333 | + |
| 2334 | +!! article |
| 2335 | +Template:paramtestnum |
| 2336 | +!! text |
| 2337 | +[[{{{1}}}|{{{2}}}]] |
| 2338 | +!! endarticle |
| 2339 | + |
| 2340 | +!! test |
| 2341 | +Template unnamed parameter |
| 2342 | +!! input |
| 2343 | +{{paramtestnum|Main Page|the main page}} |
| 2344 | +!! result |
| 2345 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">the main page</a> |
| 2346 | +</p> |
| 2347 | +!! end |
| 2348 | + |
| 2349 | +!! article |
| 2350 | +Template:templatesimple |
| 2351 | +!! text |
| 2352 | +(test) |
| 2353 | +!! endarticle |
| 2354 | + |
| 2355 | +!! article |
| 2356 | +Template:templateredirect |
| 2357 | +!! text |
| 2358 | +#redirect [[Template:templatesimple]] |
| 2359 | +!! endarticle |
| 2360 | + |
| 2361 | +!! article |
| 2362 | +Template:templateasargtestnum |
| 2363 | +!! text |
| 2364 | +{{{{{1}}}}} |
| 2365 | +!! endarticle |
| 2366 | + |
| 2367 | +!! article |
| 2368 | +Template:templateasargtest |
| 2369 | +!! text |
| 2370 | +{{template{{{templ}}}}} |
| 2371 | +!! endarticle |
| 2372 | + |
| 2373 | +!! article |
| 2374 | +Template:templateasargtest2 |
| 2375 | +!! text |
| 2376 | +{{{{{templ}}}}} |
| 2377 | +!! endarticle |
| 2378 | + |
| 2379 | +!! test |
| 2380 | +Template with template name as unnamed argument |
| 2381 | +!! input |
| 2382 | +{{templateasargtestnum|templatesimple}} |
| 2383 | +!! result |
| 2384 | +<p>(test) |
| 2385 | +</p> |
| 2386 | +!! end |
| 2387 | + |
| 2388 | +!! test |
| 2389 | +Template with template name as argument |
| 2390 | +!! input |
| 2391 | +{{templateasargtest|templ=simple}} |
| 2392 | +!! result |
| 2393 | +<p>(test) |
| 2394 | +</p> |
| 2395 | +!! end |
| 2396 | + |
| 2397 | +!! test |
| 2398 | +Template with template name as argument (2) |
| 2399 | +!! input |
| 2400 | +{{templateasargtest2|templ=templatesimple}} |
| 2401 | +!! result |
| 2402 | +<p>(test) |
| 2403 | +</p> |
| 2404 | +!! end |
| 2405 | + |
| 2406 | +!! article |
| 2407 | +Template:templateasargtestdefault |
| 2408 | +!! text |
| 2409 | +{{{{{templ|templatesimple}}}}} |
| 2410 | +!! endarticle |
| 2411 | + |
| 2412 | +!! article |
| 2413 | +Template:templa |
| 2414 | +!! text |
| 2415 | +'''templ''' |
| 2416 | +!! endarticle |
| 2417 | + |
| 2418 | +!! test |
| 2419 | +Template with default value |
| 2420 | +!! input |
| 2421 | +{{templateasargtestdefault}} |
| 2422 | +!! result |
| 2423 | +<p>(test) |
| 2424 | +</p> |
| 2425 | +!! end |
| 2426 | + |
| 2427 | +!! test |
| 2428 | +Template with default value (value set) |
| 2429 | +!! input |
| 2430 | +{{templateasargtestdefault|templ=templa}} |
| 2431 | +!! result |
| 2432 | +<p><b>templ</b> |
| 2433 | +</p> |
| 2434 | +!! end |
| 2435 | + |
| 2436 | +!! test |
| 2437 | +Template redirect |
| 2438 | +!! input |
| 2439 | +{{templateredirect}} |
| 2440 | +!! result |
| 2441 | +<p>(test) |
| 2442 | +</p> |
| 2443 | +!! end |
| 2444 | + |
| 2445 | +!! test |
| 2446 | +Template with argument in separate line |
| 2447 | +!! input |
| 2448 | +{{ templateasargtest | |
| 2449 | + templ = simple }} |
| 2450 | +!! result |
| 2451 | +<p>(test) |
| 2452 | +</p> |
| 2453 | +!! end |
| 2454 | + |
| 2455 | +!! test |
| 2456 | +Template with complex template as argument |
| 2457 | +!! input |
| 2458 | +{{paramtest| |
| 2459 | + param ={{ templateasargtest | |
| 2460 | + templ = simple }}}} |
| 2461 | +!! result |
| 2462 | +<p>This is a test template with parameter (test) |
| 2463 | +</p> |
| 2464 | +!! end |
| 2465 | + |
| 2466 | +!! test |
| 2467 | +Template with thumb image (with link in description) |
| 2468 | +!! input |
| 2469 | +{{paramtest| |
| 2470 | + param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} |
| 2471 | +!! result |
| 2472 | +This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="https://www.mediawiki.org/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="https://www.mediawiki.org/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div> |
| 2473 | + |
| 2474 | +!! end |
| 2475 | + |
| 2476 | +!! article |
| 2477 | +Template:complextemplate |
| 2478 | +!! text |
| 2479 | +{{{1}}} {{paramtest| |
| 2480 | + param ={{{param}}}}} |
| 2481 | +!! endarticle |
| 2482 | + |
| 2483 | +!! test |
| 2484 | +Template with complex arguments |
| 2485 | +!! input |
| 2486 | +{{complextemplate| |
| 2487 | + param ={{ templateasargtest | |
| 2488 | + templ = simple }}|[[Template:complextemplate|link]]}} |
| 2489 | +!! result |
| 2490 | +<p><a href="https://www.mediawiki.org/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test) |
| 2491 | +</p> |
| 2492 | +!! end |
| 2493 | + |
| 2494 | +!! test |
| 2495 | +BUG 553: link with two variables in a piped link |
| 2496 | +!! input |
| 2497 | +{| |
| 2498 | +|[[{{{1}}}|{{{2}}}]] |
| 2499 | +|} |
| 2500 | +!! result |
| 2501 | +<table> |
| 2502 | +<tr> |
| 2503 | +<td>[[{{{1}}}|{{{2}}}]] |
| 2504 | +</td></tr></table> |
| 2505 | + |
| 2506 | +!! end |
| 2507 | + |
| 2508 | +!! test |
| 2509 | +Magic variable as template parameter |
| 2510 | +!! input |
| 2511 | +{{paramtest|param={{SITENAME}}}} |
| 2512 | +!! result |
| 2513 | +<p>This is a test template with parameter MediaWiki |
| 2514 | +</p> |
| 2515 | +!! end |
| 2516 | + |
| 2517 | +!! article |
| 2518 | +Template:linktest |
| 2519 | +!! text |
| 2520 | +[[{{{param}}}|link]] |
| 2521 | +!! endarticle |
| 2522 | + |
| 2523 | +!! test |
| 2524 | +Template parameter as link source |
| 2525 | +!! input |
| 2526 | +{{linktest|param=Main Page}} |
| 2527 | +!! result |
| 2528 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> |
| 2529 | +</p> |
| 2530 | +!! end |
| 2531 | + |
| 2532 | + |
| 2533 | +!!article |
| 2534 | +Template:paramtest2 |
| 2535 | +!! text |
| 2536 | +including another template, {{paramtest|param={{{arg}}}}} |
| 2537 | +!! endarticle |
| 2538 | + |
| 2539 | +!! test |
| 2540 | +Template passing argument to another template |
| 2541 | +!! input |
| 2542 | +{{paramtest2|arg='hmm'}} |
| 2543 | +!! result |
| 2544 | +<p>including another template, This is a test template with parameter 'hmm' |
| 2545 | +</p> |
| 2546 | +!! end |
| 2547 | + |
| 2548 | +!! article |
| 2549 | +Template:Linktest2 |
| 2550 | +!! text |
| 2551 | +Main Page |
| 2552 | +!! endarticle |
| 2553 | + |
| 2554 | +!! test |
| 2555 | +Template as link source |
| 2556 | +!! input |
| 2557 | +[[{{linktest2}}]] |
| 2558 | +!! result |
| 2559 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
| 2560 | +</p> |
| 2561 | +!! end |
| 2562 | + |
| 2563 | + |
| 2564 | +!! article |
| 2565 | +Template:loop1 |
| 2566 | +!! text |
| 2567 | +{{loop2}} |
| 2568 | +!! endarticle |
| 2569 | + |
| 2570 | +!! article |
| 2571 | +Template:loop2 |
| 2572 | +!! text |
| 2573 | +{{loop1}} |
| 2574 | +!! endarticle |
| 2575 | + |
| 2576 | +!! test |
| 2577 | +Template infinite loop |
| 2578 | +!! input |
| 2579 | +{{loop1}} |
| 2580 | +!! result |
| 2581 | +<p><span class="error">Template loop detected: <a href="https://www.mediawiki.org/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span> |
| 2582 | +</p> |
| 2583 | +!! end |
| 2584 | + |
| 2585 | +!! test |
| 2586 | +Template from main namespace |
| 2587 | +!! input |
| 2588 | +{{:Main Page}} |
| 2589 | +!! result |
| 2590 | +<p>blah blah |
| 2591 | +</p> |
| 2592 | +!! end |
| 2593 | + |
| 2594 | +!! article |
| 2595 | +Template:table |
| 2596 | +!! text |
| 2597 | +{| |
| 2598 | +| 1 || 2 |
| 2599 | +|- |
| 2600 | +| 3 || 4 |
| 2601 | +|} |
| 2602 | +!! endarticle |
| 2603 | + |
| 2604 | +!! test |
| 2605 | +BUG 529: Template with table, not included at beginning of line |
| 2606 | +!! input |
| 2607 | +foo {{table}} |
| 2608 | +!! result |
| 2609 | +<p>foo |
| 2610 | +</p> |
| 2611 | +<table> |
| 2612 | +<tr> |
| 2613 | +<td> 1 </td> |
| 2614 | +<td> 2 |
| 2615 | +</td></tr> |
| 2616 | +<tr> |
| 2617 | +<td> 3 </td> |
| 2618 | +<td> 4 |
| 2619 | +</td></tr></table> |
| 2620 | + |
| 2621 | +!! end |
| 2622 | + |
| 2623 | +!! test |
| 2624 | +BUG 523: Template shouldn't eat newline (or add an extra one before table) |
| 2625 | +!! input |
| 2626 | +foo |
| 2627 | +{{table}} |
| 2628 | +!! result |
| 2629 | +<p>foo |
| 2630 | +</p> |
| 2631 | +<table> |
| 2632 | +<tr> |
| 2633 | +<td> 1 </td> |
| 2634 | +<td> 2 |
| 2635 | +</td></tr> |
| 2636 | +<tr> |
| 2637 | +<td> 3 </td> |
| 2638 | +<td> 4 |
| 2639 | +</td></tr></table> |
| 2640 | + |
| 2641 | +!! end |
| 2642 | + |
| 2643 | +!! test |
| 2644 | +BUG 41: Template parameters shown as broken links |
| 2645 | +!! input |
| 2646 | +{{{parameter}}} |
| 2647 | +!! result |
| 2648 | +<p>{{{parameter}}} |
| 2649 | +</p> |
| 2650 | +!! end |
| 2651 | + |
| 2652 | + |
| 2653 | +!! article |
| 2654 | +Template:MSGNW test |
| 2655 | +!! text |
| 2656 | +''None'' of '''this''' should be |
| 2657 | +* interpreted |
| 2658 | + but rather passed unmodified |
| 2659 | +{{test}} |
| 2660 | +!! endarticle |
| 2661 | + |
| 2662 | +# hmm, fix this or just deprecate msgnw and document its behavior? |
| 2663 | +!! test |
| 2664 | +msgnw keyword |
| 2665 | +!! options |
| 2666 | +disabled |
| 2667 | +!! input |
| 2668 | +{{msgnw:MSGNW test}} |
| 2669 | +!! result |
| 2670 | +<p>''None'' of '''this''' should be |
| 2671 | +* interpreted |
| 2672 | + but rather passed unmodified |
| 2673 | +{{test}} |
| 2674 | +</p> |
| 2675 | +!! end |
| 2676 | + |
| 2677 | +!! test |
| 2678 | +int keyword |
| 2679 | +!! input |
| 2680 | +{{int:youhavenewmessages|lots of money|not!}} |
| 2681 | +!! result |
| 2682 | +<p>You have lots of money (not!). |
| 2683 | +</p> |
| 2684 | +!! end |
| 2685 | + |
| 2686 | +!! article |
| 2687 | +Template:Includes |
| 2688 | +!! text |
| 2689 | +Foo<noinclude>zar</noinclude><includeonly>bar</includeonly> |
| 2690 | +!! endarticle |
| 2691 | + |
| 2692 | +!! test |
| 2693 | +<includeonly> and <noinclude> being included |
| 2694 | +!! input |
| 2695 | +{{Includes}} |
| 2696 | +!! result |
| 2697 | +<p>Foobar |
| 2698 | +</p> |
| 2699 | +!! end |
| 2700 | + |
| 2701 | +!! article |
| 2702 | +Template:Includes2 |
| 2703 | +!! text |
| 2704 | +<onlyinclude>Foo</onlyinclude>bar |
| 2705 | +!! endarticle |
| 2706 | + |
| 2707 | +!! test |
| 2708 | +<onlyinclude> being included |
| 2709 | +!! input |
| 2710 | +{{Includes2}} |
| 2711 | +!! result |
| 2712 | +<p>Foo |
| 2713 | +</p> |
| 2714 | +!! end |
| 2715 | + |
| 2716 | + |
| 2717 | +!! article |
| 2718 | +Template:Includes3 |
| 2719 | +!! text |
| 2720 | +<onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly> |
| 2721 | +!! endarticle |
| 2722 | + |
| 2723 | +!! test |
| 2724 | +<onlyinclude> and <includeonly> being included |
| 2725 | +!! input |
| 2726 | +{{Includes3}} |
| 2727 | +!! result |
| 2728 | +<p>Foo |
| 2729 | +</p> |
| 2730 | +!! end |
| 2731 | + |
| 2732 | +!! test |
| 2733 | +<includeonly> and <noinclude> on a page |
| 2734 | +!! input |
| 2735 | +Foo<noinclude>zar</noinclude><includeonly>bar</includeonly> |
| 2736 | +!! result |
| 2737 | +<p>Foozar |
| 2738 | +</p> |
| 2739 | +!! end |
| 2740 | + |
| 2741 | +!! test |
| 2742 | +<onlyinclude> on a page |
| 2743 | +!! input |
| 2744 | +<onlyinclude>Foo</onlyinclude>bar |
| 2745 | +!! result |
| 2746 | +<p>Foobar |
| 2747 | +</p> |
| 2748 | +!! end |
| 2749 | + |
| 2750 | +!! article |
| 2751 | +Template:Includeonly section |
| 2752 | +!! text |
| 2753 | +<includeonly> |
| 2754 | +==Includeonly section== |
| 2755 | +</includeonly> |
| 2756 | +==Section T-1== |
| 2757 | +!!endarticle |
| 2758 | + |
| 2759 | +!! test |
| 2760 | +Bug 6563: Edit link generation for section shown by <includeonly> |
| 2761 | +!! input |
| 2762 | +{{includeonly section}} |
| 2763 | +!! result |
| 2764 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&action=edit&section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Includeonly_section">Includeonly section</span></h2> |
| 2765 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Includeonly_section&action=edit&section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline" id="Section_T-1">Section T-1</span></h2> |
| 2766 | + |
| 2767 | +!! end |
| 2768 | + |
| 2769 | +# Uses same input as the contents of [[Template:Includeonly section]] |
| 2770 | +!! test |
| 2771 | +Bug 6563: Section extraction for section shown by <includeonly> |
| 2772 | +!! options |
| 2773 | +section=T-2 |
| 2774 | +!! input |
| 2775 | +<includeonly> |
| 2776 | +==Includeonly section== |
| 2777 | +</includeonly> |
| 2778 | +==Section T-2== |
| 2779 | +!! result |
| 2780 | +==Section T-2== |
| 2781 | +!! end |
| 2782 | + |
| 2783 | +!! test |
| 2784 | +Bug 6563: Edit link generation for section suppressed by <includeonly> |
| 2785 | +!! input |
| 2786 | +<includeonly> |
| 2787 | +==Includeonly section== |
| 2788 | +</includeonly> |
| 2789 | +==Section 1== |
| 2790 | +!! result |
| 2791 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2> |
| 2792 | + |
| 2793 | +!! end |
| 2794 | + |
| 2795 | +!! test |
| 2796 | +Bug 6563: Section extraction for section suppressed by <includeonly> |
| 2797 | +!! options |
| 2798 | +section=1 |
| 2799 | +!! input |
| 2800 | +<includeonly> |
| 2801 | +==Includeonly section== |
| 2802 | +</includeonly> |
| 2803 | +==Section 1== |
| 2804 | +!! result |
| 2805 | +==Section 1== |
| 2806 | +!! end |
| 2807 | + |
| 2808 | +### |
| 2809 | +### Pre-save transform tests |
| 2810 | +### |
| 2811 | +!! test |
| 2812 | +pre-save transform: subst: |
| 2813 | +!! options |
| 2814 | +PST |
| 2815 | +!! input |
| 2816 | +{{subst:test}} |
| 2817 | +!! result |
| 2818 | +This is a test template |
| 2819 | +!! end |
| 2820 | + |
| 2821 | +!! test |
| 2822 | +pre-save transform: normal template |
| 2823 | +!! options |
| 2824 | +PST |
| 2825 | +!! input |
| 2826 | +{{test}} |
| 2827 | +!! result |
| 2828 | +{{test}} |
| 2829 | +!! end |
| 2830 | + |
| 2831 | +!! test |
| 2832 | +pre-save transform: nonexistent template |
| 2833 | +!! options |
| 2834 | +PST |
| 2835 | +!! input |
| 2836 | +{{thistemplatedoesnotexist}} |
| 2837 | +!! result |
| 2838 | +{{thistemplatedoesnotexist}} |
| 2839 | +!! end |
| 2840 | + |
| 2841 | + |
| 2842 | +!! test |
| 2843 | +pre-save transform: subst magic variables |
| 2844 | +!! options |
| 2845 | +PST |
| 2846 | +!! input |
| 2847 | +{{subst:SITENAME}} |
| 2848 | +!! result |
| 2849 | +MediaWiki |
| 2850 | +!! end |
| 2851 | + |
| 2852 | +# This is bug 89, which I fixed. -- wtm |
| 2853 | +!! test |
| 2854 | +pre-save transform: subst: templates with parameters |
| 2855 | +!! options |
| 2856 | +pst |
| 2857 | +!! input |
| 2858 | +{{subst:paramtest|param="something else"}} |
| 2859 | +!! result |
| 2860 | +This is a test template with parameter "something else" |
| 2861 | +!! end |
| 2862 | + |
| 2863 | +!! article |
| 2864 | +Template:nowikitest |
| 2865 | +!! text |
| 2866 | +<nowiki>'''not wiki'''</nowiki> |
| 2867 | +!! endarticle |
| 2868 | + |
| 2869 | +!! test |
| 2870 | +pre-save transform: nowiki in subst (bug 1188) |
| 2871 | +!! options |
| 2872 | +pst |
| 2873 | +!! input |
| 2874 | +{{subst:nowikitest}} |
| 2875 | +!! result |
| 2876 | +<nowiki>'''not wiki'''</nowiki> |
| 2877 | +!! end |
| 2878 | + |
| 2879 | + |
| 2880 | +!! article |
| 2881 | +Template:commenttest |
| 2882 | +!! text |
| 2883 | +This template has <!-- a comment --> in it. |
| 2884 | +!! endarticle |
| 2885 | + |
| 2886 | +!! test |
| 2887 | +pre-save transform: comment in subst (bug 1936) |
| 2888 | +!! options |
| 2889 | +pst |
| 2890 | +!! input |
| 2891 | +{{subst:commenttest}} |
| 2892 | +!! result |
| 2893 | +This template has <!-- a comment --> in it. |
| 2894 | +!! end |
| 2895 | + |
| 2896 | +!! test |
| 2897 | +pre-save transform: unclosed tag |
| 2898 | +!! options |
| 2899 | +pst noxml |
| 2900 | +!! input |
| 2901 | +<nowiki>'''not wiki''' |
| 2902 | +!! result |
| 2903 | +<nowiki>'''not wiki''' |
| 2904 | +!! end |
| 2905 | + |
| 2906 | +!! test |
| 2907 | +pre-save transform: mixed tag case |
| 2908 | +!! options |
| 2909 | +pst noxml |
| 2910 | +!! input |
| 2911 | +<NOwiki>'''not wiki'''</noWIKI> |
| 2912 | +!! result |
| 2913 | +<NOwiki>'''not wiki'''</noWIKI> |
| 2914 | +!! end |
| 2915 | + |
| 2916 | +!! test |
| 2917 | +pre-save transform: unclosed comment in <nowiki> |
| 2918 | +!! options |
| 2919 | +pst noxml |
| 2920 | +!! input |
| 2921 | +wiki<nowiki>nowiki<!--nowiki</nowiki>wiki |
| 2922 | +!! result |
| 2923 | +wiki<nowiki>nowiki<!--nowiki</nowiki>wiki |
| 2924 | +!!end |
| 2925 | + |
| 2926 | +!! article |
| 2927 | +Template:dangerous |
| 2928 | +!!text |
| 2929 | +<span onmouseover="alert('crap')">Oh no</span> |
| 2930 | +!!endarticle |
| 2931 | + |
| 2932 | +!!test |
| 2933 | +(confirming safety of fix for subst bug 1936) |
| 2934 | +!! input |
| 2935 | +{{Template:dangerous}} |
| 2936 | +!! result |
| 2937 | +<p><span>Oh no</span> |
| 2938 | +</p> |
| 2939 | +!! end |
| 2940 | + |
| 2941 | +!! test |
| 2942 | +pre-save transform: comment containing gallery (bug 5024) |
| 2943 | +!! options |
| 2944 | +pst |
| 2945 | +!! input |
| 2946 | +<!-- <gallery>data</gallery> --> |
| 2947 | +!!result |
| 2948 | +<!-- <gallery>data</gallery> --> |
| 2949 | +!!end |
| 2950 | + |
| 2951 | +!! test |
| 2952 | +pre-save transform: comment containing extension |
| 2953 | +!! options |
| 2954 | +pst |
| 2955 | +!! input |
| 2956 | +<!-- <tag>data</tag> --> |
| 2957 | +!!result |
| 2958 | +<!-- <tag>data</tag> --> |
| 2959 | +!!end |
| 2960 | + |
| 2961 | +!! test |
| 2962 | +pre-save transform: comment containing nowiki |
| 2963 | +!! options |
| 2964 | +pst |
| 2965 | +!! input |
| 2966 | +<!-- <nowiki>data</nowiki> --> |
| 2967 | +!!result |
| 2968 | +<!-- <nowiki>data</nowiki> --> |
| 2969 | +!!end |
| 2970 | + |
| 2971 | +!! test |
| 2972 | +pre-save transform: comment containing math |
| 2973 | +!! options |
| 2974 | +pst |
| 2975 | +!! input |
| 2976 | +<!-- <math>data</math> --> |
| 2977 | +!!result |
| 2978 | +<!-- <math>data</math> --> |
| 2979 | +!!end |
| 2980 | + |
| 2981 | +!! test |
| 2982 | +pre-save transform: <noinclude> in subst (bug 3298) |
| 2983 | +!! options |
| 2984 | +pst |
| 2985 | +!! input |
| 2986 | +{{subst:Includes}} |
| 2987 | +!! result |
| 2988 | +Foobar |
| 2989 | +!! end |
| 2990 | + |
| 2991 | +!! test |
| 2992 | +pre-save transform: <onlyinclude> in subst (bug 3298) |
| 2993 | +!! options |
| 2994 | +pst |
| 2995 | +!! input |
| 2996 | +{{subst:Includes2}} |
| 2997 | +!! result |
| 2998 | +Foo |
| 2999 | +!! end |
| 3000 | + |
| 3001 | +!! article |
| 3002 | +Template:SubstTest |
| 3003 | +!!text |
| 3004 | +{{<includeonly>subst:</includeonly>Includes}} |
| 3005 | +!! endarticle |
| 3006 | + |
| 3007 | +!! article |
| 3008 | +Template:SafeSubstTest |
| 3009 | +!! text |
| 3010 | +{{<includeonly>safesubst:</includeonly>Includes}} |
| 3011 | +!! endarticle |
| 3012 | + |
| 3013 | +!! test |
| 3014 | +bug 22297: safesubst: works during PST |
| 3015 | +!! options |
| 3016 | +pst |
| 3017 | +!! input |
| 3018 | +{{subst:SafeSubstTest}}{{safesubst:SubstTest}} |
| 3019 | +!! result |
| 3020 | +FoobarFoobar |
| 3021 | +!! end |
| 3022 | + |
| 3023 | +!! test |
| 3024 | +bug 22297: safesubst: works during normal parse |
| 3025 | +!! input |
| 3026 | +{{SafeSubstTest}} |
| 3027 | +!! result |
| 3028 | +<p>Foobar |
| 3029 | +</p> |
| 3030 | +!! end |
| 3031 | + |
| 3032 | +!! test: |
| 3033 | +subst: does not work during normal parse |
| 3034 | +!! input |
| 3035 | +{{SubstTest}} |
| 3036 | +!! result |
| 3037 | +<p>{{subst:Includes}} |
| 3038 | +</p> |
| 3039 | +!! end |
| 3040 | + |
| 3041 | +!! test |
| 3042 | +pre-save transform: context links ("pipe trick") |
| 3043 | +!! options |
| 3044 | +pst |
| 3045 | +!! input |
| 3046 | +[[Article (context)|]] |
| 3047 | +[[Bar:Article|]] |
| 3048 | +[[:Bar:Article|]] |
| 3049 | +[[Bar:Article (context)|]] |
| 3050 | +[[:Bar:Article (context)|]] |
| 3051 | +[[|Article]] |
| 3052 | +[[|Article (context)]] |
| 3053 | +[[Bar:X (Y) Z|]] |
| 3054 | +[[:Bar:X (Y) Z|]] |
| 3055 | +!! result |
| 3056 | +[[Article (context)|Article]] |
| 3057 | +[[Bar:Article|Article]] |
| 3058 | +[[:Bar:Article|Article]] |
| 3059 | +[[Bar:Article (context)|Article]] |
| 3060 | +[[:Bar:Article (context)|Article]] |
| 3061 | +[[Article]] |
| 3062 | +[[Article (context)]] |
| 3063 | +[[Bar:X (Y) Z|X (Y) Z]] |
| 3064 | +[[:Bar:X (Y) Z|X (Y) Z]] |
| 3065 | +!! end |
| 3066 | + |
| 3067 | +!! test |
| 3068 | +pre-save transform: context links ("pipe trick") with interwiki prefix |
| 3069 | +!! options |
| 3070 | +pst |
| 3071 | +!! input |
| 3072 | +[[interwiki:Article|]] |
| 3073 | +[[:interwiki:Article|]] |
| 3074 | +[[interwiki:Bar:Article|]] |
| 3075 | +[[:interwiki:Bar:Article|]] |
| 3076 | +!! result |
| 3077 | +[[interwiki:Article|Article]] |
| 3078 | +[[:interwiki:Article|Article]] |
| 3079 | +[[interwiki:Bar:Article|Bar:Article]] |
| 3080 | +[[:interwiki:Bar:Article|Bar:Article]] |
| 3081 | +!! end |
| 3082 | + |
| 3083 | +!! test |
| 3084 | +pre-save transform: context links ("pipe trick") with parens in title |
| 3085 | +!! options |
| 3086 | +pst title=[[Somearticle (context)]] |
| 3087 | +!! input |
| 3088 | +[[|Article]] |
| 3089 | +!! result |
| 3090 | +[[Article (context)|Article]] |
| 3091 | +!! end |
| 3092 | + |
| 3093 | +!! test |
| 3094 | +pre-save transform: context links ("pipe trick") with comma in title |
| 3095 | +!! options |
| 3096 | +pst title=[[Someplace, Somewhere]] |
| 3097 | +!! input |
| 3098 | +[[|Otherplace]] |
| 3099 | +[[Otherplace, Elsewhere|]] |
| 3100 | +[[Otherplace, Elsewhere, Anywhere|]] |
| 3101 | +!! result |
| 3102 | +[[Otherplace, Somewhere|Otherplace]] |
| 3103 | +[[Otherplace, Elsewhere|Otherplace]] |
| 3104 | +[[Otherplace, Elsewhere, Anywhere|Otherplace]] |
| 3105 | +!! end |
| 3106 | + |
| 3107 | +!! test |
| 3108 | +pre-save transform: context links ("pipe trick") with parens and comma |
| 3109 | +!! options |
| 3110 | +pst title=[[Someplace (IGNORED), Somewhere]] |
| 3111 | +!! input |
| 3112 | +[[|Otherplace]] |
| 3113 | +[[Otherplace (place), Elsewhere|]] |
| 3114 | +!! result |
| 3115 | +[[Otherplace, Somewhere|Otherplace]] |
| 3116 | +[[Otherplace (place), Elsewhere|Otherplace]] |
| 3117 | +!! end |
| 3118 | + |
| 3119 | +!! test |
| 3120 | +pre-save transform: context links ("pipe trick") with comma and parens |
| 3121 | +!! options |
| 3122 | +pst title=[[Who, me? (context)]] |
| 3123 | +!! input |
| 3124 | +[[|Yes, you.]] |
| 3125 | +[[Me, Myself, and I (1937 song)|]] |
| 3126 | +!! result |
| 3127 | +[[Yes, you. (context)|Yes, you.]] |
| 3128 | +[[Me, Myself, and I (1937 song)|Me, Myself, and I]] |
| 3129 | +!! end |
| 3130 | + |
| 3131 | +!! test |
| 3132 | +pre-save transform: context links ("pipe trick") with namespace |
| 3133 | +!! options |
| 3134 | +pst title=[[Ns:Somearticle]] |
| 3135 | +!! input |
| 3136 | +[[|Article]] |
| 3137 | +!! result |
| 3138 | +[[Ns:Article|Article]] |
| 3139 | +!! end |
| 3140 | + |
| 3141 | +!! test |
| 3142 | +pre-save transform: context links ("pipe trick") with namespace and parens |
| 3143 | +!! options |
| 3144 | +pst title=[[Ns:Somearticle (context)]] |
| 3145 | +!! input |
| 3146 | +[[|Article]] |
| 3147 | +!! result |
| 3148 | +[[Ns:Article (context)|Article]] |
| 3149 | +!! end |
| 3150 | + |
| 3151 | +!! test |
| 3152 | +pre-save transform: context links ("pipe trick") with namespace and comma |
| 3153 | +!! options |
| 3154 | +pst title=[[Ns:Somearticle, Context, Whatever]] |
| 3155 | +!! input |
| 3156 | +[[|Article]] |
| 3157 | +!! result |
| 3158 | +[[Ns:Article, Context, Whatever|Article]] |
| 3159 | +!! end |
| 3160 | + |
| 3161 | +!! test |
| 3162 | +pre-save transform: context links ("pipe trick") with namespace, comma and parens |
| 3163 | +!! options |
| 3164 | +pst title=[[Ns:Somearticle, Context (context)]] |
| 3165 | +!! input |
| 3166 | +[[|Article]] |
| 3167 | +!! result |
| 3168 | +[[Ns:Article (context)|Article]] |
| 3169 | +!! end |
| 3170 | + |
| 3171 | +!! test |
| 3172 | +pre-save transform: context links ("pipe trick") with namespace, parens and comma |
| 3173 | +!! options |
| 3174 | +pst title=[[Ns:Somearticle (IGNORED), Context]] |
| 3175 | +!! input |
| 3176 | +[[|Article]] |
| 3177 | +!! result |
| 3178 | +[[Ns:Article, Context|Article]] |
| 3179 | +!! end |
| 3180 | + |
| 3181 | + |
| 3182 | +### |
| 3183 | +### Message transform tests |
| 3184 | +### |
| 3185 | +!! test |
| 3186 | +message transform: magic variables |
| 3187 | +!! options |
| 3188 | +msg |
| 3189 | +!! input |
| 3190 | +{{SITENAME}} |
| 3191 | +!! result |
| 3192 | +MediaWiki |
| 3193 | +!! end |
| 3194 | + |
| 3195 | +!! test |
| 3196 | +message transform: should not transform wiki markup |
| 3197 | +!! options |
| 3198 | +msg |
| 3199 | +!! input |
| 3200 | +''test'' |
| 3201 | +!! result |
| 3202 | +''test'' |
| 3203 | +!! end |
| 3204 | + |
| 3205 | +!! test |
| 3206 | +message transform: <noinclude> in transcluded template (bug 4926) |
| 3207 | +!! options |
| 3208 | +msg |
| 3209 | +!! input |
| 3210 | +{{Includes}} |
| 3211 | +!! result |
| 3212 | +Foobar |
| 3213 | +!! end |
| 3214 | + |
| 3215 | +!! test |
| 3216 | +message transform: <onlyinclude> in transcluded template (bug 4926) |
| 3217 | +!! options |
| 3218 | +msg |
| 3219 | +!! input |
| 3220 | +{{Includes2}} |
| 3221 | +!! result |
| 3222 | +Foo |
| 3223 | +!! end |
| 3224 | + |
| 3225 | +!! test |
| 3226 | +{{#special:}} page name, known |
| 3227 | +!! options |
| 3228 | +msg |
| 3229 | +!! input |
| 3230 | +{{#special:Recentchanges}} |
| 3231 | +!! result |
| 3232 | +Special:RecentChanges |
| 3233 | +!! end |
| 3234 | + |
| 3235 | +!! test |
| 3236 | +{{#special:}} page name with subpage, known |
| 3237 | +!! options |
| 3238 | +msg |
| 3239 | +!! input |
| 3240 | +{{#special:Recentchanges/param}} |
| 3241 | +!! result |
| 3242 | +Special:RecentChanges/param |
| 3243 | +!! end |
| 3244 | + |
| 3245 | +!! test |
| 3246 | +{{#special:}} page name, unknown |
| 3247 | +!! options |
| 3248 | +msg |
| 3249 | +!! input |
| 3250 | +{{#special:foobarnonexistent}} |
| 3251 | +!! result |
| 3252 | +No such special page |
| 3253 | +!! end |
| 3254 | + |
| 3255 | +### |
| 3256 | +### Images |
| 3257 | +### |
| 3258 | +!! test |
| 3259 | +Simple image |
| 3260 | +!! input |
| 3261 | +[[Image:foobar.jpg]] |
| 3262 | +!! result |
| 3263 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3264 | +</p> |
| 3265 | +!! end |
| 3266 | + |
| 3267 | +!! test |
| 3268 | +Right-aligned image |
| 3269 | +!! input |
| 3270 | +[[Image:foobar.jpg|right]] |
| 3271 | +!! result |
| 3272 | +<div class="floatright"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> |
| 3273 | + |
| 3274 | +!! end |
| 3275 | + |
| 3276 | +!! test |
| 3277 | +Simple image (using File: namespace, now canonical) |
| 3278 | +!! input |
| 3279 | +[[File:foobar.jpg]] |
| 3280 | +!! result |
| 3281 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3282 | +</p> |
| 3283 | +!! end |
| 3284 | + |
| 3285 | +!! test |
| 3286 | +Image with caption |
| 3287 | +!! input |
| 3288 | +[[Image:foobar.jpg|right|Caption text]] |
| 3289 | +!! result |
| 3290 | +<div class="floatright"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> |
| 3291 | + |
| 3292 | +!! end |
| 3293 | + |
| 3294 | +!! test |
| 3295 | +Image with link parameter, wiki target |
| 3296 | +!! input |
| 3297 | +[[Image:foobar.jpg|link=Target page]] |
| 3298 | +!! result |
| 3299 | +<p><a href="https://www.mediawiki.org/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3300 | +</p> |
| 3301 | +!! end |
| 3302 | + |
| 3303 | +!! test |
| 3304 | +Image with link parameter, URL target |
| 3305 | +!! input |
| 3306 | +[[Image:foobar.jpg|link=http://example.com/]] |
| 3307 | +!! result |
| 3308 | +<p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3309 | +</p> |
| 3310 | +!! end |
| 3311 | + |
| 3312 | +!! test |
| 3313 | +Image with empty link parameter |
| 3314 | +!! input |
| 3315 | +[[Image:foobar.jpg|link=]] |
| 3316 | +!! result |
| 3317 | +<p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /> |
| 3318 | +</p> |
| 3319 | +!! end |
| 3320 | + |
| 3321 | +!! test |
| 3322 | +Image with link parameter (wiki target) and unnamed parameter |
| 3323 | +!! input |
| 3324 | +[[Image:foobar.jpg|link=Target page|Title]] |
| 3325 | +!! result |
| 3326 | +<p><a href="https://www.mediawiki.org/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3327 | +</p> |
| 3328 | +!! end |
| 3329 | + |
| 3330 | +!! test |
| 3331 | +Image with link parameter (URL target) and unnamed parameter |
| 3332 | +!! input |
| 3333 | +[[Image:foobar.jpg|link=http://example.com/|Title]] |
| 3334 | +!! result |
| 3335 | +<p><a href="http://example.com/" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3336 | +</p> |
| 3337 | +!! end |
| 3338 | + |
| 3339 | +!! test |
| 3340 | +Thumbnail image with link parameter |
| 3341 | +!! input |
| 3342 | +[[Image:foobar.jpg|thumb|link=http://example.com/|Title]] |
| 3343 | +!! result |
| 3344 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div> |
| 3345 | + |
| 3346 | +!! end |
| 3347 | + |
| 3348 | +!! test |
| 3349 | +Image with frame and link |
| 3350 | +!! input |
| 3351 | +[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] |
| 3352 | +!! result |
| 3353 | +<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
| 3354 | + |
| 3355 | +!! end |
| 3356 | + |
| 3357 | +!! test |
| 3358 | +Image with frame and link and explicit alt |
| 3359 | +!! input |
| 3360 | +[[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]] |
| 3361 | +!! result |
| 3362 | +<div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div> |
| 3363 | + |
| 3364 | +!! end |
| 3365 | + |
| 3366 | +!! test |
| 3367 | +Image with wiki markup in implicit alt |
| 3368 | +!! input |
| 3369 | +[[Image:Foobar.jpg|testing '''bold''' in alt]] |
| 3370 | +!! result |
| 3371 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3372 | +</p> |
| 3373 | +!! end |
| 3374 | + |
| 3375 | +!! test |
| 3376 | +Image with wiki markup in explicit alt |
| 3377 | +!! input |
| 3378 | +[[Image:Foobar.jpg|alt=testing '''bold''' in alt]] |
| 3379 | +!! result |
| 3380 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3381 | +</p> |
| 3382 | +!! end |
| 3383 | + |
| 3384 | +!! test |
| 3385 | +Link to image page- image page normally doesn't exists, hence edit link |
| 3386 | +Add test with existing image page |
| 3387 | +#<p><a href="https://www.mediawiki.org/wiki/File:Test" title="Image:Test">Image:test</a> |
| 3388 | +!! input |
| 3389 | +[[:Image:test]] |
| 3390 | +!! result |
| 3391 | +<p><a href="https://www.mediawiki.org/index.php?title=File:Test&action=edit&redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a> |
| 3392 | +</p> |
| 3393 | +!! end |
| 3394 | + |
| 3395 | +!! test |
| 3396 | +bug 18784 Link to non-existent image page with caption should use caption as link text |
| 3397 | +!! input |
| 3398 | +[[:Image:test|caption]] |
| 3399 | +!! result |
| 3400 | +<p><a href="https://www.mediawiki.org/index.php?title=File:Test&action=edit&redlink=1" class="new" title="File:Test (page does not exist)">caption</a> |
| 3401 | +</p> |
| 3402 | +!! end |
| 3403 | + |
| 3404 | +!! test |
| 3405 | +Frameless image caption with a free URL |
| 3406 | +!! input |
| 3407 | +[[Image:foobar.jpg|http://example.com]] |
| 3408 | +!! result |
| 3409 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3410 | +</p> |
| 3411 | +!! end |
| 3412 | + |
| 3413 | +!! test |
| 3414 | +Thumbnail image caption with a free URL |
| 3415 | +!! input |
| 3416 | +[[Image:foobar.jpg|thumb|http://example.com]] |
| 3417 | +!! result |
| 3418 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div> |
| 3419 | + |
| 3420 | +!! end |
| 3421 | + |
| 3422 | +!! test |
| 3423 | +Thumbnail image caption with a free URL and explicit alt |
| 3424 | +!! input |
| 3425 | +[[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]] |
| 3426 | +!! result |
| 3427 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a></div></div></div> |
| 3428 | + |
| 3429 | +!! end |
| 3430 | + |
| 3431 | +!! test |
| 3432 | +BUG 1887: A ISBN with a thumbnail |
| 3433 | +!! input |
| 3434 | +[[Image:foobar.jpg|thumb|ISBN 1235467890]] |
| 3435 | +!! result |
| 3436 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="https://www.mediawiki.org/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div> |
| 3437 | + |
| 3438 | +!! end |
| 3439 | + |
| 3440 | +!! test |
| 3441 | +BUG 1887: A RFC with a thumbnail |
| 3442 | +!! input |
| 3443 | +[[Image:foobar.jpg|thumb|This is RFC 12354]] |
| 3444 | +!! result |
| 3445 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external mw-magiclink-rfc">RFC 12354</a></div></div></div> |
| 3446 | + |
| 3447 | +!! end |
| 3448 | + |
| 3449 | +!! test |
| 3450 | +BUG 1887: A mailto link with a thumbnail |
| 3451 | +!! input |
| 3452 | +[[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]] |
| 3453 | +!! result |
| 3454 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" rel="nofollow">mailto:nobody@example.com</a></div></div></div> |
| 3455 | + |
| 3456 | +!! end |
| 3457 | + |
| 3458 | +!! test |
| 3459 | +BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default, |
| 3460 | +so math is not stripped and turns up as escaped <math> tags. |
| 3461 | +!! input |
| 3462 | +[[Image:foobar.jpg|thumb|<math>2+2</math>]] |
| 3463 | +!! result |
| 3464 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><math>2+2</math></div></div></div> |
| 3465 | + |
| 3466 | +!! end |
| 3467 | + |
| 3468 | +!! test |
| 3469 | +BUG 1887, part 2: A <math> with a thumbnail- math enabled |
| 3470 | +!! options |
| 3471 | +math |
| 3472 | +!! input |
| 3473 | +[[Image:foobar.jpg|thumb|<math>2+2</math>]] |
| 3474 | +!! result |
| 3475 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div> |
| 3476 | + |
| 3477 | +!! end |
| 3478 | + |
| 3479 | +# Pending resolution to bug 368 |
| 3480 | +!! test |
| 3481 | +BUG 648: Frameless image caption with a link |
| 3482 | +!! input |
| 3483 | +[[Image:foobar.jpg|text with a [[link]] in it]] |
| 3484 | +!! result |
| 3485 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3486 | +</p> |
| 3487 | +!! end |
| 3488 | + |
| 3489 | +!! test |
| 3490 | +BUG 648: Frameless image caption with a link (suffix) |
| 3491 | +!! input |
| 3492 | +[[Image:foobar.jpg|text with a [[link]]foo in it]] |
| 3493 | +!! result |
| 3494 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3495 | +</p> |
| 3496 | +!! end |
| 3497 | + |
| 3498 | +!! test |
| 3499 | +BUG 648: Frameless image caption with an interwiki link |
| 3500 | +!! input |
| 3501 | +[[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]] |
| 3502 | +!! result |
| 3503 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3504 | +</p> |
| 3505 | +!! end |
| 3506 | + |
| 3507 | +!! test |
| 3508 | +BUG 648: Frameless image caption with a piped interwiki link |
| 3509 | +!! input |
| 3510 | +[[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]] |
| 3511 | +!! result |
| 3512 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3513 | +</p> |
| 3514 | +!! end |
| 3515 | + |
| 3516 | +!! test |
| 3517 | +Escape HTML special chars in image alt text |
| 3518 | +!! input |
| 3519 | +[[Image:foobar.jpg|& < > "]] |
| 3520 | +!! result |
| 3521 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="& < > ""><img alt="& < > "" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3522 | +</p> |
| 3523 | +!! end |
| 3524 | + |
| 3525 | +!! test |
| 3526 | +BUG 499: Alt text should have Ӓ, not &1234; |
| 3527 | +!! input |
| 3528 | +[[Image:foobar.jpg|♀]] |
| 3529 | +!! result |
| 3530 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3531 | +</p> |
| 3532 | +!! end |
| 3533 | + |
| 3534 | +!! test |
| 3535 | +Broken image caption with link |
| 3536 | +!! input |
| 3537 | +[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link. |
| 3538 | +!! result |
| 3539 | +<p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link. |
| 3540 | +</p> |
| 3541 | +!! end |
| 3542 | + |
| 3543 | +!! test |
| 3544 | +Image caption containing another image |
| 3545 | +!! input |
| 3546 | +[[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] |
| 3547 | +!! result |
| 3548 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div> |
| 3549 | + |
| 3550 | +!! end |
| 3551 | + |
| 3552 | +!! test |
| 3553 | +Image caption containing a newline |
| 3554 | +!! input |
| 3555 | +[[Image:Foobar.jpg|This |
| 3556 | +*is some text]] |
| 3557 | +!! result |
| 3558 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 3559 | +</p> |
| 3560 | +!!end |
| 3561 | + |
| 3562 | + |
| 3563 | +!! test |
| 3564 | +Bug 3090: External links other than http: in image captions |
| 3565 | +!! input |
| 3566 | +[[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]] |
| 3567 | +!! result |
| 3568 | +<div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="200" height="23" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" rel="nofollow">Secure</a> ext links in it.</div></div></div> |
| 3569 | + |
| 3570 | +!! end |
| 3571 | + |
| 3572 | +!! article |
| 3573 | +File:Barfoo.jpg |
| 3574 | +!! text |
| 3575 | +#REDIRECT [[File:Barfoo.jpg]] |
| 3576 | +!! endarticle |
| 3577 | + |
| 3578 | +!! test |
| 3579 | +Redirected image |
| 3580 | +!! input |
| 3581 | +[[Image:Barfoo.jpg]] |
| 3582 | +!! result |
| 3583 | +<p><a href="https://www.mediawiki.org/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a> |
| 3584 | +</p> |
| 3585 | +!! end |
| 3586 | + |
| 3587 | +!! test |
| 3588 | +Missing image with uploads disabled |
| 3589 | +!! options |
| 3590 | +wgEnableUploads=0 |
| 3591 | +!! input |
| 3592 | +[[Image:Foobaz.jpg]] |
| 3593 | +!! result |
| 3594 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a> |
| 3595 | +</p> |
| 3596 | +!! end |
| 3597 | + |
| 3598 | + |
| 3599 | +### |
| 3600 | +### Subpages |
| 3601 | +### |
| 3602 | +!! article |
| 3603 | +Subpage test/subpage |
| 3604 | +!! text |
| 3605 | +foo |
| 3606 | +!! endarticle |
| 3607 | + |
| 3608 | +!! test |
| 3609 | +Subpage link |
| 3610 | +!! options |
| 3611 | +subpage title=[[Subpage test]] |
| 3612 | +!! input |
| 3613 | +[[/subpage]] |
| 3614 | +!! result |
| 3615 | +<p><a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> |
| 3616 | +</p> |
| 3617 | +!! end |
| 3618 | + |
| 3619 | +!! test |
| 3620 | +Subpage noslash link |
| 3621 | +!! options |
| 3622 | +subpage title=[[Subpage test]] |
| 3623 | +!!input |
| 3624 | +[[/subpage/]] |
| 3625 | +!! result |
| 3626 | +<p><a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a> |
| 3627 | +</p> |
| 3628 | +!! end |
| 3629 | + |
| 3630 | +!! test |
| 3631 | +Disabled subpages |
| 3632 | +!! input |
| 3633 | +[[/subpage]] |
| 3634 | +!! result |
| 3635 | +<p><a href="https://www.mediawiki.org/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> |
| 3636 | +</p> |
| 3637 | +!! end |
| 3638 | + |
| 3639 | +!! test |
| 3640 | +BUG 561: {{/Subpage}} |
| 3641 | +!! options |
| 3642 | +subpage title=[[Page]] |
| 3643 | +!! input |
| 3644 | +{{/Subpage}} |
| 3645 | +!! result |
| 3646 | +<p><a href="https://www.mediawiki.org/index.php?title=Page/Subpage&action=edit&redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a> |
| 3647 | +</p> |
| 3648 | +!! end |
| 3649 | + |
| 3650 | +### |
| 3651 | +### Categories |
| 3652 | +### |
| 3653 | +!! article |
| 3654 | +Category:MediaWiki User's Guide |
| 3655 | +!! text |
| 3656 | +blah |
| 3657 | +!! endarticle |
| 3658 | + |
| 3659 | +!! test |
| 3660 | +Link to category |
| 3661 | +!! input |
| 3662 | +[[:Category:MediaWiki User's Guide]] |
| 3663 | +!! result |
| 3664 | +<p><a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a> |
| 3665 | +</p> |
| 3666 | +!! end |
| 3667 | + |
| 3668 | +!! test |
| 3669 | +Simple category |
| 3670 | +!! options |
| 3671 | +cat |
| 3672 | +!! input |
| 3673 | +[[Category:MediaWiki User's Guide]] |
| 3674 | +!! result |
| 3675 | +<a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a> |
| 3676 | +!! end |
| 3677 | + |
| 3678 | +!! test |
| 3679 | +PAGESINCATEGORY invalid title fatal (r33546 fix) |
| 3680 | +!! input |
| 3681 | +{{PAGESINCATEGORY:<bogus>}} |
| 3682 | +!! result |
| 3683 | +<p>0 |
| 3684 | +</p> |
| 3685 | +!! end |
| 3686 | + |
| 3687 | +### |
| 3688 | +### Inter-language links |
| 3689 | +### |
| 3690 | +!! test |
| 3691 | +Inter-language links |
| 3692 | +!! options |
| 3693 | +ill |
| 3694 | +!! input |
| 3695 | +[[es:Alimento]] |
| 3696 | +[[fr:Nourriture]] |
| 3697 | +[[zh:食品]] |
| 3698 | +!! result |
| 3699 | +es:Alimento fr:Nourriture zh:食品 |
| 3700 | +!! end |
| 3701 | + |
| 3702 | +### |
| 3703 | +### Sections |
| 3704 | +### |
| 3705 | +!! test |
| 3706 | +Basic section headings |
| 3707 | +!! input |
| 3708 | +== Headline 1 == |
| 3709 | +Some text |
| 3710 | + |
| 3711 | +==Headline 2== |
| 3712 | +More |
| 3713 | +===Smaller headline=== |
| 3714 | +Blah blah |
| 3715 | +!! result |
| 3716 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2> |
| 3717 | +<p>Some text |
| 3718 | +</p> |
| 3719 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2">Headline 2</span></h2> |
| 3720 | +<p>More |
| 3721 | +</p> |
| 3722 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline" id="Smaller_headline">Smaller headline</span></h3> |
| 3723 | +<p>Blah blah |
| 3724 | +</p> |
| 3725 | +!! end |
| 3726 | + |
| 3727 | +!! test |
| 3728 | +Section headings with TOC |
| 3729 | +!! input |
| 3730 | +== Headline 1 == |
| 3731 | +=== Subheadline 1 === |
| 3732 | +===== Skipping a level ===== |
| 3733 | +====== Skipping a level ====== |
| 3734 | + |
| 3735 | +== Headline 2 == |
| 3736 | +Some text |
| 3737 | +===Another headline=== |
| 3738 | +!! result |
| 3739 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 3740 | +<ul> |
| 3741 | +<li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a> |
| 3742 | +<ul> |
| 3743 | +<li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a> |
| 3744 | +<ul> |
| 3745 | +<li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a> |
| 3746 | +<ul> |
| 3747 | +<li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li> |
| 3748 | +</ul> |
| 3749 | +</li> |
| 3750 | +</ul> |
| 3751 | +</li> |
| 3752 | +</ul> |
| 3753 | +</li> |
| 3754 | +<li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a> |
| 3755 | +<ul> |
| 3756 | +<li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li> |
| 3757 | +</ul> |
| 3758 | +</li> |
| 3759 | +</ul> |
| 3760 | +</td></tr></table> |
| 3761 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline" id="Headline_1"> Headline 1 </span></h2> |
| 3762 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline" id="Subheadline_1"> Subheadline 1 </span></h3> |
| 3763 | +<h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level"> Skipping a level </span></h5> |
| 3764 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline" id="Skipping_a_level_2"> Skipping a level </span></h6> |
| 3765 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline" id="Headline_2"> Headline 2 </span></h2> |
| 3766 | +<p>Some text |
| 3767 | +</p> |
| 3768 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline" id="Another_headline">Another headline</span></h3> |
| 3769 | + |
| 3770 | +!! end |
| 3771 | + |
| 3772 | +# perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' |
| 3773 | +!! test |
| 3774 | +Handling of sections up to level 6 and beyond |
| 3775 | +!! input |
| 3776 | += Level 1 Heading= |
| 3777 | +== Level 2 Heading== |
| 3778 | +=== Level 3 Heading=== |
| 3779 | +==== Level 4 Heading==== |
| 3780 | +===== Level 5 Heading===== |
| 3781 | +====== Level 6 Heading====== |
| 3782 | +======= Level 7 Heading======= |
| 3783 | +======== Level 8 Heading======== |
| 3784 | +========= Level 9 Heading========= |
| 3785 | +========== Level 10 Heading========== |
| 3786 | +!! result |
| 3787 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 3788 | +<ul> |
| 3789 | +<li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a> |
| 3790 | +<ul> |
| 3791 | +<li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a> |
| 3792 | +<ul> |
| 3793 | +<li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a> |
| 3794 | +<ul> |
| 3795 | +<li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a> |
| 3796 | +<ul> |
| 3797 | +<li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a> |
| 3798 | +<ul> |
| 3799 | +<li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li> |
| 3800 | +<li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li> |
| 3801 | +<li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li> |
| 3802 | +<li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li> |
| 3803 | +<li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li> |
| 3804 | +</ul> |
| 3805 | +</li> |
| 3806 | +</ul> |
| 3807 | +</li> |
| 3808 | +</ul> |
| 3809 | +</li> |
| 3810 | +</ul> |
| 3811 | +</li> |
| 3812 | +</ul> |
| 3813 | +</li> |
| 3814 | +</ul> |
| 3815 | +</td></tr></table> |
| 3816 | +<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline" id="Level_1_Heading"> Level 1 Heading</span></h1> |
| 3817 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline" id="Level_2_Heading"> Level 2 Heading</span></h2> |
| 3818 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline" id="Level_3_Heading"> Level 3 Heading</span></h3> |
| 3819 | +<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline" id="Level_4_Heading"> Level 4 Heading</span></h4> |
| 3820 | +<h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline" id="Level_5_Heading"> Level 5 Heading</span></h5> |
| 3821 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline" id="Level_6_Heading"> Level 6 Heading</span></h6> |
| 3822 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span></h6> |
| 3823 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span></h6> |
| 3824 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span></h6> |
| 3825 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span></h6> |
| 3826 | + |
| 3827 | +!! end |
| 3828 | + |
| 3829 | +!! test |
| 3830 | +TOC regression (bug 9764) |
| 3831 | +!! input |
| 3832 | +== title 1 == |
| 3833 | +=== title 1.1 === |
| 3834 | +==== title 1.1.1 ==== |
| 3835 | +=== title 1.2 === |
| 3836 | +== title 2 == |
| 3837 | +=== title 2.1 === |
| 3838 | +!! result |
| 3839 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 3840 | +<ul> |
| 3841 | +<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a> |
| 3842 | +<ul> |
| 3843 | +<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a> |
| 3844 | +<ul> |
| 3845 | +<li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li> |
| 3846 | +</ul> |
| 3847 | +</li> |
| 3848 | +<li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li> |
| 3849 | +</ul> |
| 3850 | +</li> |
| 3851 | +<li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a> |
| 3852 | +<ul> |
| 3853 | +<li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li> |
| 3854 | +</ul> |
| 3855 | +</li> |
| 3856 | +</ul> |
| 3857 | +</td></tr></table> |
| 3858 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2> |
| 3859 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3> |
| 3860 | +<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4> |
| 3861 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3> |
| 3862 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2> |
| 3863 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3> |
| 3864 | + |
| 3865 | +!! end |
| 3866 | + |
| 3867 | +!! test |
| 3868 | +TOC with wgMaxTocLevel=3 (bug 6204) |
| 3869 | +!! options |
| 3870 | +wgMaxTocLevel=3 |
| 3871 | +!! input |
| 3872 | +== title 1 == |
| 3873 | +=== title 1.1 === |
| 3874 | +==== title 1.1.1 ==== |
| 3875 | +=== title 1.2 === |
| 3876 | +== title 2 == |
| 3877 | +=== title 2.1 === |
| 3878 | +!! result |
| 3879 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 3880 | +<ul> |
| 3881 | +<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a> |
| 3882 | +<ul> |
| 3883 | +<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li> |
| 3884 | +<li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li> |
| 3885 | +</ul> |
| 3886 | +</li> |
| 3887 | +<li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a> |
| 3888 | +<ul> |
| 3889 | +<li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li> |
| 3890 | +</ul> |
| 3891 | +</li> |
| 3892 | +</ul> |
| 3893 | +</td></tr></table> |
| 3894 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2> |
| 3895 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3> |
| 3896 | +<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 1.1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1.1"> title 1.1.1 </span></h4> |
| 3897 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: title 1.2">edit</a>]</span> <span class="mw-headline" id="title_1.2"> title 1.2 </span></h3> |
| 3898 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2> |
| 3899 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: title 2.1">edit</a>]</span> <span class="mw-headline" id="title_2.1"> title 2.1 </span></h3> |
| 3900 | + |
| 3901 | +!! end |
| 3902 | + |
| 3903 | +!! test |
| 3904 | +TOC with wgMaxTocLevel=3 and two level four headings (bug 6204) |
| 3905 | +!! options |
| 3906 | +wgMaxTocLevel=3 |
| 3907 | +!! input |
| 3908 | +==Section 1== |
| 3909 | +===Section 1.1=== |
| 3910 | +====Section 1.1.1==== |
| 3911 | +====Section 1.1.1.1==== |
| 3912 | +==Section 2== |
| 3913 | +!! result |
| 3914 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 3915 | +<ul> |
| 3916 | +<li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a> |
| 3917 | +<ul> |
| 3918 | +<li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li> |
| 3919 | +</ul> |
| 3920 | +</li> |
| 3921 | +<li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li> |
| 3922 | +</ul> |
| 3923 | +</td></tr></table> |
| 3924 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h2> |
| 3925 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1">Section 1.1</span></h3> |
| 3926 | +<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Section 1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span></h4> |
| 3927 | +<h4><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span> <span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span></h4> |
| 3928 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: Section 2">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2> |
| 3929 | + |
| 3930 | +!! end |
| 3931 | + |
| 3932 | + |
| 3933 | +!! test |
| 3934 | +Resolving duplicate section names |
| 3935 | +!! input |
| 3936 | +== Foo bar == |
| 3937 | +== Foo bar == |
| 3938 | +!! result |
| 3939 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2> |
| 3940 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar_2"> Foo bar </span></h2> |
| 3941 | + |
| 3942 | +!! end |
| 3943 | + |
| 3944 | +!! test |
| 3945 | +Resolving duplicate section names with differing case (bug 10721) |
| 3946 | +!! input |
| 3947 | +== Foo bar == |
| 3948 | +== Foo Bar == |
| 3949 | +!! result |
| 3950 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline" id="Foo_bar"> Foo bar </span></h2> |
| 3951 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Foo Bar">edit</a>]</span> <span class="mw-headline" id="Foo_Bar_2"> Foo Bar </span></h2> |
| 3952 | + |
| 3953 | +!! end |
| 3954 | + |
| 3955 | +!! article |
| 3956 | +Template:sections |
| 3957 | +!! text |
| 3958 | +===Section 1=== |
| 3959 | +==Section 2== |
| 3960 | +!! endarticle |
| 3961 | + |
| 3962 | +!! test |
| 3963 | +Template with sections, __NOTOC__ |
| 3964 | +!! input |
| 3965 | +__NOTOC__ |
| 3966 | +==Section 0== |
| 3967 | +{{sections}} |
| 3968 | +==Section 4== |
| 3969 | +!! result |
| 3970 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline" id="Section_0">Section 0</span></h2> |
| 3971 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&action=edit&section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_1">Section 1</span></h3> |
| 3972 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Template:Sections&action=edit&section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline" id="Section_2">Section 2</span></h2> |
| 3973 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline" id="Section_4">Section 4</span></h2> |
| 3974 | + |
| 3975 | +!! end |
| 3976 | + |
| 3977 | +!! test |
| 3978 | +__NOEDITSECTION__ keyword |
| 3979 | +!! input |
| 3980 | +__NOEDITSECTION__ |
| 3981 | +==Section 1== |
| 3982 | +==Section 2== |
| 3983 | +!! result |
| 3984 | +<h2> <span class="mw-headline" id="Section_1">Section 1</span></h2> |
| 3985 | +<h2> <span class="mw-headline" id="Section_2">Section 2</span></h2> |
| 3986 | + |
| 3987 | +!! end |
| 3988 | + |
| 3989 | +!! test |
| 3990 | +Link inside a section heading |
| 3991 | +!! input |
| 3992 | +==Section with a [[Main Page|link]] in it== |
| 3993 | +!! result |
| 3994 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a> in it</span></h2> |
| 3995 | + |
| 3996 | +!! end |
| 3997 | + |
| 3998 | +!! test |
| 3999 | +TOC regression (bug 12077) |
| 4000 | +!! input |
| 4001 | +__TOC__ |
| 4002 | +== title 1 == |
| 4003 | +=== title 1.1 === |
| 4004 | +== title 2 == |
| 4005 | +!! result |
| 4006 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 4007 | +<ul> |
| 4008 | +<li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a> |
| 4009 | +<ul> |
| 4010 | +<li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li> |
| 4011 | +</ul> |
| 4012 | +</li> |
| 4013 | +<li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li> |
| 4014 | +</ul> |
| 4015 | +</td></tr></table> |
| 4016 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: title 1">edit</a>]</span> <span class="mw-headline" id="title_1"> title 1 </span></h2> |
| 4017 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: title 1.1">edit</a>]</span> <span class="mw-headline" id="title_1.1"> title 1.1 </span></h3> |
| 4018 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: title 2">edit</a>]</span> <span class="mw-headline" id="title_2"> title 2 </span></h2> |
| 4019 | + |
| 4020 | +!! end |
| 4021 | + |
| 4022 | +!! test |
| 4023 | +BUG 1219 URL next to image (good) |
| 4024 | +!! input |
| 4025 | +http://example.com [[Image:foobar.jpg]] |
| 4026 | +!! result |
| 4027 | +<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> <a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 4028 | +</p> |
| 4029 | +!!end |
| 4030 | + |
| 4031 | +!! test |
| 4032 | +Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910) |
| 4033 | +!! input |
| 4034 | +=== |
| 4035 | +The line above must have a trailing space! |
| 4036 | +=== <!-- |
| 4037 | +--> <!-- --> |
| 4038 | +But just in case it doesn't... |
| 4039 | +!! result |
| 4040 | +<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D">=</span></h1> |
| 4041 | +<p>The line above must have a trailing space! |
| 4042 | +</p> |
| 4043 | +<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: =">edit</a>]</span> <span class="mw-headline" id=".3D_2">=</span></h1> |
| 4044 | +<p>But just in case it doesn't... |
| 4045 | +</p> |
| 4046 | +!! end |
| 4047 | + |
| 4048 | +!! test |
| 4049 | +BUG 1219 URL next to image (broken) |
| 4050 | +!! input |
| 4051 | +http://example.com[[Image:foobar.jpg]] |
| 4052 | +!! result |
| 4053 | +<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a> |
| 4054 | +</p> |
| 4055 | +!!end |
| 4056 | + |
| 4057 | +!! test |
| 4058 | +Bug 1186 news: in the middle of text |
| 4059 | +!! input |
| 4060 | +http://en.wikinews.org/wiki/Wikinews:Workplace |
| 4061 | +!! result |
| 4062 | +<p><a href="http://en.wikinews.org/wiki/Wikinews:Workplace" class="external free" rel="nofollow">http://en.wikinews.org/wiki/Wikinews:Workplace</a> |
| 4063 | +</p> |
| 4064 | +!!end |
| 4065 | + |
| 4066 | + |
| 4067 | +!! test |
| 4068 | +Namespaced link must have a title |
| 4069 | +!! input |
| 4070 | +[[Project:]] |
| 4071 | +!! result |
| 4072 | +<p>[[Project:]] |
| 4073 | +</p> |
| 4074 | +!!end |
| 4075 | + |
| 4076 | +!! test |
| 4077 | +Namespaced link must have a title (bad fragment version) |
| 4078 | +!! input |
| 4079 | +[[Project:#fragment]] |
| 4080 | +!! result |
| 4081 | +<p>[[Project:#fragment]] |
| 4082 | +</p> |
| 4083 | +!!end |
| 4084 | + |
| 4085 | + |
| 4086 | +!! test |
| 4087 | +div with no attributes |
| 4088 | +!! input |
| 4089 | +<div>HTML rocks</div> |
| 4090 | +!! result |
| 4091 | +<div>HTML rocks</div> |
| 4092 | + |
| 4093 | +!! end |
| 4094 | + |
| 4095 | +!! test |
| 4096 | +div with double-quoted attribute |
| 4097 | +!! input |
| 4098 | +<div id="rock">HTML rocks</div> |
| 4099 | +!! result |
| 4100 | +<div id="rock">HTML rocks</div> |
| 4101 | + |
| 4102 | +!! end |
| 4103 | + |
| 4104 | +!! test |
| 4105 | +div with single-quoted attribute |
| 4106 | +!! input |
| 4107 | +<div id='rock'>HTML rocks</div> |
| 4108 | +!! result |
| 4109 | +<div id="rock">HTML rocks</div> |
| 4110 | + |
| 4111 | +!! end |
| 4112 | + |
| 4113 | +!! test |
| 4114 | +div with unquoted attribute |
| 4115 | +!! input |
| 4116 | +<div id=rock>HTML rocks</div> |
| 4117 | +!! result |
| 4118 | +<div id="rock">HTML rocks</div> |
| 4119 | + |
| 4120 | +!! end |
| 4121 | + |
| 4122 | +!! test |
| 4123 | +div with illegal double attributes |
| 4124 | +!! input |
| 4125 | +<div align="center" align="right">HTML rocks</div> |
| 4126 | +!! result |
| 4127 | +<div align="right">HTML rocks</div> |
| 4128 | + |
| 4129 | +!!end |
| 4130 | + |
| 4131 | +!! test |
| 4132 | +HTML multiple attributes correction |
| 4133 | +!! input |
| 4134 | +<p class="error" class="awesome">Awesome!</p> |
| 4135 | +!! result |
| 4136 | +<p class="awesome">Awesome!</p> |
| 4137 | + |
| 4138 | +!!end |
| 4139 | + |
| 4140 | +!! test |
| 4141 | +Table multiple attributes correction |
| 4142 | +!! input |
| 4143 | +{| |
| 4144 | +!+ class="error" class="awesome"| status |
| 4145 | +|} |
| 4146 | +!! result |
| 4147 | +<table> |
| 4148 | +<tr> |
| 4149 | +<th class="awesome"> status |
| 4150 | +</th></tr></table> |
| 4151 | + |
| 4152 | +!!end |
| 4153 | + |
| 4154 | +!! test |
| 4155 | +DIV IN UPPERCASE |
| 4156 | +!! input |
| 4157 | +<DIV ALIGN="center">HTML ROCKS</DIV> |
| 4158 | +!! result |
| 4159 | +<div align="center">HTML ROCKS</div> |
| 4160 | + |
| 4161 | +!!end |
| 4162 | + |
| 4163 | + |
| 4164 | +!! test |
| 4165 | +text with amp in the middle of nowhere |
| 4166 | +!! input |
| 4167 | +Remember AT&T? |
| 4168 | +!!result |
| 4169 | +<p>Remember AT&T? |
| 4170 | +</p> |
| 4171 | +!! end |
| 4172 | + |
| 4173 | +!! test |
| 4174 | +text with character entity: eacute |
| 4175 | +!! input |
| 4176 | +I always thought é was a cute letter. |
| 4177 | +!! result |
| 4178 | +<p>I always thought é was a cute letter. |
| 4179 | +</p> |
| 4180 | +!! end |
| 4181 | + |
| 4182 | +!! test |
| 4183 | +text with undefined character entity: xacute |
| 4184 | +!! input |
| 4185 | +I always thought &xacute; was a cute letter. |
| 4186 | +!! result |
| 4187 | +<p>I always thought &xacute; was a cute letter. |
| 4188 | +</p> |
| 4189 | +!! end |
| 4190 | + |
| 4191 | + |
| 4192 | +### |
| 4193 | +### Media links |
| 4194 | +### |
| 4195 | + |
| 4196 | +!! test |
| 4197 | +Media link |
| 4198 | +!! input |
| 4199 | +[[Media:Foobar.jpg]] |
| 4200 | +!! result |
| 4201 | +<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a> |
| 4202 | +</p> |
| 4203 | +!! end |
| 4204 | + |
| 4205 | +!! test |
| 4206 | +Media link with text |
| 4207 | +!! input |
| 4208 | +[[Media:Foobar.jpg|A neat file to look at]] |
| 4209 | +!! result |
| 4210 | +<p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a> |
| 4211 | +</p> |
| 4212 | +!! end |
| 4213 | + |
| 4214 | +# FIXME: this is still bad HTML tag nesting |
| 4215 | +!! test |
| 4216 | +Media link with nasty text |
| 4217 | +fixme: doBlockLevels won't wrap this in a paragraph because it contains a div |
| 4218 | +!! input |
| 4219 | +[[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]] |
| 4220 | +!! result |
| 4221 | +<a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a> |
| 4222 | + |
| 4223 | +!! end |
| 4224 | + |
| 4225 | +!! test |
| 4226 | +Media link to nonexistent file (bug 1702) |
| 4227 | +!! input |
| 4228 | +[[Media:No such.jpg]] |
| 4229 | +!! result |
| 4230 | +<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a> |
| 4231 | +</p> |
| 4232 | +!! end |
| 4233 | + |
| 4234 | +!! test |
| 4235 | +Image link to nonexistent file (bug 1850 - good) |
| 4236 | +!! input |
| 4237 | +[[Image:No such.jpg]] |
| 4238 | +!! result |
| 4239 | +<p><a href="https://www.mediawiki.org/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a> |
| 4240 | +</p> |
| 4241 | +!! end |
| 4242 | + |
| 4243 | +!! test |
| 4244 | +:Image link to nonexistent file (bug 1850 - bad) |
| 4245 | +!! input |
| 4246 | +[[:Image:No such.jpg]] |
| 4247 | +!! result |
| 4248 | +<p><a href="https://www.mediawiki.org/index.php?title=File:No_such.jpg&action=edit&redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a> |
| 4249 | +</p> |
| 4250 | +!! end |
| 4251 | + |
| 4252 | + |
| 4253 | + |
| 4254 | +!! test |
| 4255 | +Character reference normalization in link text (bug 1938) |
| 4256 | +!! input |
| 4257 | +[[Main Page|this&that]] |
| 4258 | +!! result |
| 4259 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">this&that</a> |
| 4260 | +</p> |
| 4261 | +!!end |
| 4262 | + |
| 4263 | +!! article |
| 4264 | +אַ |
| 4265 | +!! text |
| 4266 | +Test for unicode normalization |
| 4267 | + |
| 4268 | +The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E |
| 4269 | +!! endarticle |
| 4270 | + |
| 4271 | +!! test |
| 4272 | +(bug 19451) Links should refer to the normalized form. |
| 4273 | +!! input |
| 4274 | +[[אַ]] |
| 4275 | +[[אַ]] |
| 4276 | +[[אַ]] |
| 4277 | +[[אַ]] |
| 4278 | +[[אַ]] |
| 4279 | +!! result |
| 4280 | +<p><a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
| 4281 | +<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
| 4282 | +<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
| 4283 | +<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
| 4284 | +<a href="https://www.mediawiki.org/wiki/%D7%90%D6%B7" title="אַ">אַ</a> |
| 4285 | +</p> |
| 4286 | +!! end |
| 4287 | + |
| 4288 | +!! test |
| 4289 | +Empty attribute crash test (bug 2067) |
| 4290 | +!! input |
| 4291 | +<font color="">foo</font> |
| 4292 | +!! result |
| 4293 | +<p><font color="">foo</font> |
| 4294 | +</p> |
| 4295 | +!! end |
| 4296 | + |
| 4297 | +!! test |
| 4298 | +Empty attribute crash test single-quotes (bug 2067) |
| 4299 | +!! input |
| 4300 | +<font color=''>foo</font> |
| 4301 | +!! result |
| 4302 | +<p><font color="">foo</font> |
| 4303 | +</p> |
| 4304 | +!! end |
| 4305 | + |
| 4306 | +!! test |
| 4307 | +Attribute test: equals, then nothing |
| 4308 | +!! input |
| 4309 | +<font color=>foo</font> |
| 4310 | +!! result |
| 4311 | +<p><font>foo</font> |
| 4312 | +</p> |
| 4313 | +!! end |
| 4314 | + |
| 4315 | +!! test |
| 4316 | +Attribute test: unquoted value |
| 4317 | +!! input |
| 4318 | +<font color=x>foo</font> |
| 4319 | +!! result |
| 4320 | +<p><font color="x">foo</font> |
| 4321 | +</p> |
| 4322 | +!! end |
| 4323 | + |
| 4324 | +!! test |
| 4325 | +Attribute test: unquoted but illegal value (hash) |
| 4326 | +!! input |
| 4327 | +<font color=#x>foo</font> |
| 4328 | +!! result |
| 4329 | +<p><font color="#x">foo</font> |
| 4330 | +</p> |
| 4331 | +!! end |
| 4332 | + |
| 4333 | +!! test |
| 4334 | +Attribute test: no value |
| 4335 | +!! input |
| 4336 | +<font color>foo</font> |
| 4337 | +!! result |
| 4338 | +<p><font color="color">foo</font> |
| 4339 | +</p> |
| 4340 | +!! end |
| 4341 | + |
| 4342 | +!! test |
| 4343 | +Bug 2095: link with three closing brackets |
| 4344 | +!! input |
| 4345 | +[[Main Page]]] |
| 4346 | +!! result |
| 4347 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a>] |
| 4348 | +</p> |
| 4349 | +!! end |
| 4350 | + |
| 4351 | +!! test |
| 4352 | +Bug 2095: link with pipe and three closing brackets |
| 4353 | +!! input |
| 4354 | +[[Main Page|link]]] |
| 4355 | +!! result |
| 4356 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">link</a>] |
| 4357 | +</p> |
| 4358 | +!! end |
| 4359 | + |
| 4360 | +!! test |
| 4361 | +Bug 2095: link with pipe and three closing brackets, version 2 |
| 4362 | +!! input |
| 4363 | +[[Main Page|[http://example.com/]]] |
| 4364 | +!! result |
| 4365 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">[http://example.com/]</a> |
| 4366 | +</p> |
| 4367 | +!! end |
| 4368 | + |
| 4369 | + |
| 4370 | +### |
| 4371 | +### Safety |
| 4372 | +### |
| 4373 | + |
| 4374 | +!! article |
| 4375 | +Template:Dangerous attribute |
| 4376 | +!! text |
| 4377 | +" onmouseover="alert(document.cookie) |
| 4378 | +!! endarticle |
| 4379 | + |
| 4380 | +!! article |
| 4381 | +Template:Dangerous style attribute |
| 4382 | +!! text |
| 4383 | +border-size: expression(alert(document.cookie)) |
| 4384 | +!! endarticle |
| 4385 | + |
| 4386 | +!! article |
| 4387 | +Template:Div style |
| 4388 | +!! text |
| 4389 | +<div style="float: right; {{{1}}}">Magic div</div> |
| 4390 | +!! endarticle |
| 4391 | + |
| 4392 | +!! test |
| 4393 | +Bug 2304: HTML attribute safety (safe template; regression bug 2309) |
| 4394 | +!! input |
| 4395 | +<div title="{{test}}"></div> |
| 4396 | +!! result |
| 4397 | +<div title="This is a test template"></div> |
| 4398 | + |
| 4399 | +!! end |
| 4400 | + |
| 4401 | +!! test |
| 4402 | +Bug 2304: HTML attribute safety (dangerous template; 2309) |
| 4403 | +!! input |
| 4404 | +<div title="{{dangerous attribute}}"></div> |
| 4405 | +!! result |
| 4406 | +<div title=""></div> |
| 4407 | + |
| 4408 | +!! end |
| 4409 | + |
| 4410 | +!! test |
| 4411 | +Bug 2304: HTML attribute safety (dangerous style template; 2309) |
| 4412 | +!! input |
| 4413 | +<div style="{{dangerous style attribute}}"></div> |
| 4414 | +!! result |
| 4415 | +<div style="/* insecure input */"></div> |
| 4416 | + |
| 4417 | +!! end |
| 4418 | + |
| 4419 | +!! test |
| 4420 | +Bug 2304: HTML attribute safety (safe parameter; 2309) |
| 4421 | +!! input |
| 4422 | +{{div style|width: 200px}} |
| 4423 | +!! result |
| 4424 | +<div style="float: right; width: 200px">Magic div</div> |
| 4425 | + |
| 4426 | +!! end |
| 4427 | + |
| 4428 | +!! test |
| 4429 | +Bug 2304: HTML attribute safety (unsafe parameter; 2309) |
| 4430 | +!! input |
| 4431 | +{{div style|width: expression(alert(document.cookie))}} |
| 4432 | +!! result |
| 4433 | +<div style="/* insecure input */">Magic div</div> |
| 4434 | + |
| 4435 | +!! end |
| 4436 | + |
| 4437 | +!! test |
| 4438 | +Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309) |
| 4439 | +!! input |
| 4440 | +{{div style|"><script>alert(document.cookie)</script>}} |
| 4441 | +!! result |
| 4442 | +<div style="float: right;"><script>alert(document.cookie)</script>">Magic div</div> |
| 4443 | + |
| 4444 | +!! end |
| 4445 | + |
| 4446 | +!! test |
| 4447 | +Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309) |
| 4448 | +!! input |
| 4449 | +{{div style|" ><script>alert(document.cookie)</script>}} |
| 4450 | +!! result |
| 4451 | +<div style="float: right;"><script>alert(document.cookie)</script>">Magic div</div> |
| 4452 | + |
| 4453 | +!! end |
| 4454 | + |
| 4455 | +!! test |
| 4456 | +Bug 2304: HTML attribute safety (link) |
| 4457 | +!! input |
| 4458 | +<div title="[[Main Page]]"></div> |
| 4459 | +!! result |
| 4460 | +<div title="[[Main Page]]"></div> |
| 4461 | + |
| 4462 | +!! end |
| 4463 | + |
| 4464 | +!! test |
| 4465 | +Bug 2304: HTML attribute safety (italics) |
| 4466 | +!! input |
| 4467 | +<div title="''foobar''"></div> |
| 4468 | +!! result |
| 4469 | +<div title="''foobar''"></div> |
| 4470 | + |
| 4471 | +!! end |
| 4472 | + |
| 4473 | +!! test |
| 4474 | +Bug 2304: HTML attribute safety (bold) |
| 4475 | +!! input |
| 4476 | +<div title="'''foobar'''"></div> |
| 4477 | +!! result |
| 4478 | +<div title="'''foobar'''"></div> |
| 4479 | + |
| 4480 | +!! end |
| 4481 | + |
| 4482 | + |
| 4483 | +!! test |
| 4484 | +Bug 2304: HTML attribute safety (ISBN) |
| 4485 | +!! input |
| 4486 | +<div title="ISBN 1234567890"></div> |
| 4487 | +!! result |
| 4488 | +<div title="ISBN 1234567890"></div> |
| 4489 | + |
| 4490 | +!! end |
| 4491 | + |
| 4492 | +!! test |
| 4493 | +Bug 2304: HTML attribute safety (RFC) |
| 4494 | +!! input |
| 4495 | +<div title="RFC 1234"></div> |
| 4496 | +!! result |
| 4497 | +<div title="RFC 1234"></div> |
| 4498 | + |
| 4499 | +!! end |
| 4500 | + |
| 4501 | +!! test |
| 4502 | +Bug 2304: HTML attribute safety (PMID) |
| 4503 | +!! input |
| 4504 | +<div title="PMID 1234567890"></div> |
| 4505 | +!! result |
| 4506 | +<div title="PMID 1234567890"></div> |
| 4507 | + |
| 4508 | +!! end |
| 4509 | + |
| 4510 | +!! test |
| 4511 | +Bug 2304: HTML attribute safety (web link) |
| 4512 | +!! input |
| 4513 | +<div title="http://example.com/"></div> |
| 4514 | +!! result |
| 4515 | +<div title="http://example.com/"></div> |
| 4516 | + |
| 4517 | +!! end |
| 4518 | + |
| 4519 | +!! test |
| 4520 | +Bug 2304: HTML attribute safety (named web link) |
| 4521 | +!! input |
| 4522 | +<div title="[http://example.com/ link]"></div> |
| 4523 | +!! result |
| 4524 | +<div title="[http://example.com/ link]"></div> |
| 4525 | + |
| 4526 | +!! end |
| 4527 | + |
| 4528 | +!! test |
| 4529 | +Bug 3244: HTML attribute safety (extension; safe) |
| 4530 | +!! input |
| 4531 | +<div style="<nowiki>background:blue</nowiki>"></div> |
| 4532 | +!! result |
| 4533 | +<div style="background:blue"></div> |
| 4534 | + |
| 4535 | +!! end |
| 4536 | + |
| 4537 | +!! test |
| 4538 | +Bug 3244: HTML attribute safety (extension; unsafe) |
| 4539 | +!! input |
| 4540 | +<div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div> |
| 4541 | +!! result |
| 4542 | +<div style="/* insecure input */"></div> |
| 4543 | + |
| 4544 | +!! end |
| 4545 | + |
| 4546 | +!! test |
| 4547 | +Math section safety when disabled |
| 4548 | +!! input |
| 4549 | +<math><script>alert(document.cookies);</script></math> |
| 4550 | +!! result |
| 4551 | +<p><math><script>alert(document.cookies);</script></math> |
| 4552 | +</p> |
| 4553 | +!! end |
| 4554 | + |
| 4555 | +# More MSIE fun discovered by Tom Gilder |
| 4556 | + |
| 4557 | +!! test |
| 4558 | +MSIE CSS safety test: spurious slash |
| 4559 | +!! input |
| 4560 | +<div style="background-image:u\rl(javascript:alert('boo'))">evil</div> |
| 4561 | +!! result |
| 4562 | +<div style="/* insecure input */">evil</div> |
| 4563 | + |
| 4564 | +!! end |
| 4565 | + |
| 4566 | +!! test |
| 4567 | +MSIE CSS safety test: hex code |
| 4568 | +!! input |
| 4569 | +<div style="background-image:u\72l(javascript:alert('boo'))">evil</div> |
| 4570 | +!! result |
| 4571 | +<div style="/* insecure input */">evil</div> |
| 4572 | + |
| 4573 | +!! end |
| 4574 | + |
| 4575 | +!! test |
| 4576 | +MSIE CSS safety test: comment in url |
| 4577 | +!! input |
| 4578 | +<div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div> |
| 4579 | +!! result |
| 4580 | +<div style="background-image:u rl(javascript:alert('boo'))">evil</div> |
| 4581 | + |
| 4582 | +!! end |
| 4583 | + |
| 4584 | +!! test |
| 4585 | +MSIE CSS safety test: comment in expression |
| 4586 | +!! input |
| 4587 | +<div style="background-image:expres/**/sion(alert('boo4'))">evil4</div> |
| 4588 | +!! result |
| 4589 | +<div style="background-image:expres sion(alert('boo4'))">evil4</div> |
| 4590 | + |
| 4591 | +!! end |
| 4592 | + |
| 4593 | + |
| 4594 | +!! test |
| 4595 | +Table attribute legitimate extension |
| 4596 | +!! input |
| 4597 | +{| |
| 4598 | +!+ style="<nowiki>color:blue</nowiki>"| status |
| 4599 | +|} |
| 4600 | +!! result |
| 4601 | +<table> |
| 4602 | +<tr> |
| 4603 | +<th style="color:blue"> status |
| 4604 | +</th></tr></table> |
| 4605 | + |
| 4606 | +!!end |
| 4607 | + |
| 4608 | +!! test |
| 4609 | +Table attribute safety |
| 4610 | +!! input |
| 4611 | +{| |
| 4612 | +!+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status |
| 4613 | +|} |
| 4614 | +!! result |
| 4615 | +<table> |
| 4616 | +<tr> |
| 4617 | +<th style="/* insecure input */"> status |
| 4618 | +</th></tr></table> |
| 4619 | + |
| 4620 | +!! end |
| 4621 | + |
| 4622 | +!! test |
| 4623 | +CSS line continuation 1 |
| 4624 | +!! input |
| 4625 | +<div style="background-image: u\ rl(test.jpg);"></div> |
| 4626 | +!! result |
| 4627 | +<div style="/* insecure input */"></div> |
| 4628 | + |
| 4629 | +!! end |
| 4630 | + |
| 4631 | +!! test |
| 4632 | +CSS line continuation 2 |
| 4633 | +!! input |
| 4634 | +<div style="background-image: u\ rl(test.jpg); "></div> |
| 4635 | +!! result |
| 4636 | +<div style="/* insecure input */"></div> |
| 4637 | + |
| 4638 | +!! end |
| 4639 | + |
| 4640 | +!! article |
| 4641 | +Template:Identity |
| 4642 | +!! text |
| 4643 | +{{{1}}} |
| 4644 | +!! endarticle |
| 4645 | + |
| 4646 | +!! test |
| 4647 | +Expansion of multi-line templates in attribute values (bug 6255) |
| 4648 | +!! input |
| 4649 | +<div style="background: {{identity|#00FF00}}">-</div> |
| 4650 | +!! result |
| 4651 | +<div style="background: #00FF00">-</div> |
| 4652 | + |
| 4653 | +!! end |
| 4654 | + |
| 4655 | + |
| 4656 | +!! test |
| 4657 | +Expansion of multi-line templates in attribute values (bug 6255 sanity check) |
| 4658 | +!! input |
| 4659 | +<div style="background: |
| 4660 | +#00FF00">-</div> |
| 4661 | +!! result |
| 4662 | +<div style="background: #00FF00">-</div> |
| 4663 | + |
| 4664 | +!! end |
| 4665 | + |
| 4666 | +!! test |
| 4667 | +Expansion of multi-line templates in attribute values (bug 6255 sanity check 2) |
| 4668 | +!! input |
| 4669 | +<div style="background: #00FF00">-</div> |
| 4670 | +!! result |
| 4671 | +<div style="background: #00FF00">-</div> |
| 4672 | + |
| 4673 | +!! end |
| 4674 | + |
| 4675 | +### |
| 4676 | +### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension) |
| 4677 | +### |
| 4678 | +!! test |
| 4679 | +Parser hook: empty input |
| 4680 | +!! input |
| 4681 | +<tag></tag> |
| 4682 | +!! result |
| 4683 | +<pre> |
| 4684 | +string(0) "" |
| 4685 | +array(0) { |
| 4686 | +} |
| 4687 | +</pre> |
| 4688 | + |
| 4689 | +!! end |
| 4690 | + |
| 4691 | +!! test |
| 4692 | +Parser hook: empty input using terminated empty elements |
| 4693 | +!! input |
| 4694 | +<tag/> |
| 4695 | +!! result |
| 4696 | +<pre> |
| 4697 | +NULL |
| 4698 | +array(0) { |
| 4699 | +} |
| 4700 | +</pre> |
| 4701 | + |
| 4702 | +!! end |
| 4703 | + |
| 4704 | +!! test |
| 4705 | +Parser hook: empty input using terminated empty elements (space before) |
| 4706 | +!! input |
| 4707 | +<tag /> |
| 4708 | +!! result |
| 4709 | +<pre> |
| 4710 | +NULL |
| 4711 | +array(0) { |
| 4712 | +} |
| 4713 | +</pre> |
| 4714 | + |
| 4715 | +!! end |
| 4716 | + |
| 4717 | +!! test |
| 4718 | +Parser hook: basic input |
| 4719 | +!! input |
| 4720 | +<tag>input</tag> |
| 4721 | +!! result |
| 4722 | +<pre> |
| 4723 | +string(5) "input" |
| 4724 | +array(0) { |
| 4725 | +} |
| 4726 | +</pre> |
| 4727 | + |
| 4728 | +!! end |
| 4729 | + |
| 4730 | + |
| 4731 | +!! test |
| 4732 | +Parser hook: case insensitive |
| 4733 | +!! input |
| 4734 | +<TAG>input</TAG> |
| 4735 | +!! result |
| 4736 | +<pre> |
| 4737 | +string(5) "input" |
| 4738 | +array(0) { |
| 4739 | +} |
| 4740 | +</pre> |
| 4741 | + |
| 4742 | +!! end |
| 4743 | + |
| 4744 | + |
| 4745 | +!! test |
| 4746 | +Parser hook: case insensitive, redux |
| 4747 | +!! input |
| 4748 | +<TaG>input</TAg> |
| 4749 | +!! result |
| 4750 | +<pre> |
| 4751 | +string(5) "input" |
| 4752 | +array(0) { |
| 4753 | +} |
| 4754 | +</pre> |
| 4755 | + |
| 4756 | +!! end |
| 4757 | + |
| 4758 | +!! test |
| 4759 | +Parser hook: nested tags |
| 4760 | +!! options |
| 4761 | +noxml |
| 4762 | +!! input |
| 4763 | +<tag><tag></tag></tag> |
| 4764 | +!! result |
| 4765 | +<pre> |
| 4766 | +string(5) "<tag>" |
| 4767 | +array(0) { |
| 4768 | +} |
| 4769 | +</pre></tag> |
| 4770 | + |
| 4771 | +!! end |
| 4772 | + |
| 4773 | +!! test |
| 4774 | +Parser hook: basic arguments |
| 4775 | +!! input |
| 4776 | +<tag width=200 height = "100" depth = '50' square></tag> |
| 4777 | +!! result |
| 4778 | +<pre> |
| 4779 | +string(0) "" |
| 4780 | +array(4) { |
| 4781 | + ["width"]=> |
| 4782 | + string(3) "200" |
| 4783 | + ["height"]=> |
| 4784 | + string(3) "100" |
| 4785 | + ["depth"]=> |
| 4786 | + string(2) "50" |
| 4787 | + ["square"]=> |
| 4788 | + string(6) "square" |
| 4789 | +} |
| 4790 | +</pre> |
| 4791 | + |
| 4792 | +!! end |
| 4793 | + |
| 4794 | +!! test |
| 4795 | +Parser hook: argument containing a forward slash (bug 5344) |
| 4796 | +!! input |
| 4797 | +<tag filename='/tmp/bla'></tag> |
| 4798 | +!! result |
| 4799 | +<pre> |
| 4800 | +string(0) "" |
| 4801 | +array(1) { |
| 4802 | + ["filename"]=> |
| 4803 | + string(8) "/tmp/bla" |
| 4804 | +} |
| 4805 | +</pre> |
| 4806 | + |
| 4807 | +!! end |
| 4808 | + |
| 4809 | +!! test |
| 4810 | +Parser hook: empty input using terminated empty elements (bug 2374) |
| 4811 | +!! input |
| 4812 | +<tag foo=bar/>text |
| 4813 | +!! result |
| 4814 | +<pre> |
| 4815 | +NULL |
| 4816 | +array(1) { |
| 4817 | + ["foo"]=> |
| 4818 | + string(3) "bar" |
| 4819 | +} |
| 4820 | +</pre>text |
| 4821 | + |
| 4822 | +!! end |
| 4823 | + |
| 4824 | +# </tag> should be output literally since there is no matching tag that begins it |
| 4825 | +!! test |
| 4826 | +Parser hook: basic arguments using terminated empty elements (bug 2374) |
| 4827 | +!! input |
| 4828 | +<tag width=200 height = "100" depth = '50' square/> |
| 4829 | +other stuff |
| 4830 | +</tag> |
| 4831 | +!! result |
| 4832 | +<pre> |
| 4833 | +NULL |
| 4834 | +array(4) { |
| 4835 | + ["width"]=> |
| 4836 | + string(3) "200" |
| 4837 | + ["height"]=> |
| 4838 | + string(3) "100" |
| 4839 | + ["depth"]=> |
| 4840 | + string(2) "50" |
| 4841 | + ["square"]=> |
| 4842 | + string(6) "square" |
| 4843 | +} |
| 4844 | +</pre> |
| 4845 | +<p>other stuff |
| 4846 | +</tag> |
| 4847 | +</p> |
| 4848 | +!! end |
| 4849 | + |
| 4850 | +### |
| 4851 | +### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension) |
| 4852 | +### |
| 4853 | + |
| 4854 | +!! test |
| 4855 | +Parser hook: static parser hook not inside a comment |
| 4856 | +!! input |
| 4857 | +<statictag>hello, world</statictag> |
| 4858 | +<statictag action=flush/> |
| 4859 | +!! result |
| 4860 | +<p>hello, world |
| 4861 | +</p> |
| 4862 | +!! end |
| 4863 | + |
| 4864 | + |
| 4865 | +!! test |
| 4866 | +Parser hook: static parser hook inside a comment |
| 4867 | +!! input |
| 4868 | +<!-- <statictag>hello, world</statictag> --> |
| 4869 | +<statictag action=flush/> |
| 4870 | +!! result |
| 4871 | +<p><br /> |
| 4872 | +</p> |
| 4873 | +!! end |
| 4874 | + |
| 4875 | +# Nested template calls; this case was broken by Parser.php rev 1.506, |
| 4876 | +# since reverted. |
| 4877 | + |
| 4878 | +!! article |
| 4879 | +Template:One-parameter |
| 4880 | +!! text |
| 4881 | +(My parameter is: {{{1}}}) |
| 4882 | +!! endarticle |
| 4883 | + |
| 4884 | +!! article |
| 4885 | +Template:Map-one-parameter |
| 4886 | +!! text |
| 4887 | +{{{{{1}}}|{{{2}}}}} |
| 4888 | +!! endarticle |
| 4889 | + |
| 4890 | +!! test |
| 4891 | +Nested template calls |
| 4892 | +!! input |
| 4893 | +{{Map-one-parameter|One-parameter|param}} |
| 4894 | +!! result |
| 4895 | +<p>(My parameter is: param) |
| 4896 | +</p> |
| 4897 | +!! end |
| 4898 | + |
| 4899 | + |
| 4900 | +### |
| 4901 | +### Sanitizer |
| 4902 | +### |
| 4903 | +!! test |
| 4904 | +Sanitizer: Closing of open tags |
| 4905 | +!! input |
| 4906 | +<s></s><table></table> |
| 4907 | +!! result |
| 4908 | +<s></s><table></table> |
| 4909 | + |
| 4910 | +!! end |
| 4911 | + |
| 4912 | +!! test |
| 4913 | +Sanitizer: Closing of open but not closed tags |
| 4914 | +!! input |
| 4915 | +<s>foo |
| 4916 | +!! result |
| 4917 | +<p><s>foo</s> |
| 4918 | +</p> |
| 4919 | +!! end |
| 4920 | + |
| 4921 | +!! test |
| 4922 | +Sanitizer: Closing of closed but not open tags |
| 4923 | +!! input |
| 4924 | +</s> |
| 4925 | +!! result |
| 4926 | +<p></s> |
| 4927 | +</p> |
| 4928 | +!! end |
| 4929 | + |
| 4930 | +!! test |
| 4931 | +Sanitizer: Closing of closed but not open table tags |
| 4932 | +!! input |
| 4933 | +Table not started</td></tr></table> |
| 4934 | +!! result |
| 4935 | +<p>Table not started</td></tr></table> |
| 4936 | +</p> |
| 4937 | +!! end |
| 4938 | + |
| 4939 | +!! test |
| 4940 | +Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" |
| 4941 | +!! input |
| 4942 | +<span id="æ: v">byte</span>[[#æ: v|backlink]] |
| 4943 | +!! result |
| 4944 | +<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a> |
| 4945 | +</p> |
| 4946 | +!! end |
| 4947 | + |
| 4948 | +!! test |
| 4949 | +Sanitizer: Validating the contents of the id attribute (bug 4515) |
| 4950 | +!! options |
| 4951 | +disabled |
| 4952 | +!! input |
| 4953 | +<br id=9 /> |
| 4954 | +!! result |
| 4955 | +Something, but definitely not <br id="9" />... |
| 4956 | +!! end |
| 4957 | + |
| 4958 | +!! test |
| 4959 | +Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301) |
| 4960 | +!! options |
| 4961 | +disabled |
| 4962 | +!! input |
| 4963 | +<br id="foo" /><br id="foo" /> |
| 4964 | +!! result |
| 4965 | +Something need to be done. foo-2 ? |
| 4966 | +!! end |
| 4967 | + |
| 4968 | +!! test |
| 4969 | +Language converter: output gets cut off unexpectedly (bug 5757) |
| 4970 | +!! options |
| 4971 | +language=zh |
| 4972 | +!! input |
| 4973 | +this bit is safe: }- |
| 4974 | + |
| 4975 | +but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}- |
| 4976 | + |
| 4977 | +then we get cut off here: }- |
| 4978 | + |
| 4979 | +all additional text is vanished |
| 4980 | +!! result |
| 4981 | +<p>this bit is safe: }- |
| 4982 | +</p><p>but if we add a conversion instance: xxx |
| 4983 | +</p><p>then we get cut off here: }- |
| 4984 | +</p><p>all additional text is vanished |
| 4985 | +</p> |
| 4986 | +!! end |
| 4987 | + |
| 4988 | +!! test |
| 4989 | +Self closed html pairs (bug 5487) |
| 4990 | +!! options |
| 4991 | +!! input |
| 4992 | +<center><font id="bug" />Centered text</center> |
| 4993 | +<div><font id="bug2" />In div text</div> |
| 4994 | +!! result |
| 4995 | +<center><font id="bug" />Centered text</center> |
| 4996 | +<div><font id="bug2" />In div text</div> |
| 4997 | + |
| 4998 | +!! end |
| 4999 | + |
| 5000 | +# |
| 5001 | +# |
| 5002 | +# |
| 5003 | + |
| 5004 | +!! test |
| 5005 | +Punctuation: nbsp before exclamation |
| 5006 | +!! input |
| 5007 | +C'est grave ! |
| 5008 | +!! result |
| 5009 | +<p>C'est grave ! |
| 5010 | +</p> |
| 5011 | +!! end |
| 5012 | + |
| 5013 | +!! test |
| 5014 | +Punctuation: CSS !important (bug 11874) |
| 5015 | +!! input |
| 5016 | +<div style="width:50% !important">important</div> |
| 5017 | +!! result |
| 5018 | +<div style="width:50% !important">important</div> |
| 5019 | + |
| 5020 | +!!end |
| 5021 | + |
| 5022 | +!! test |
| 5023 | +Punctuation: CSS ! important (bug 11874; with space after) |
| 5024 | +!! input |
| 5025 | +<div style="width:50% ! important">important</div> |
| 5026 | +!! result |
| 5027 | +<div style="width:50% ! important">important</div> |
| 5028 | + |
| 5029 | +!!end |
| 5030 | + |
| 5031 | + |
| 5032 | +!! test |
| 5033 | +HTML bullet list, closed tags (bug 5497) |
| 5034 | +!! input |
| 5035 | +<ul> |
| 5036 | +<li>One</li> |
| 5037 | +<li>Two</li> |
| 5038 | +</ul> |
| 5039 | +!! result |
| 5040 | +<ul> |
| 5041 | +<li>One</li> |
| 5042 | +<li>Two</li> |
| 5043 | +</ul> |
| 5044 | + |
| 5045 | +!! end |
| 5046 | + |
| 5047 | +!! test |
| 5048 | +HTML bullet list, unclosed tags (bug 5497) |
| 5049 | +!! options |
| 5050 | +disabled |
| 5051 | +!! input |
| 5052 | +<ul> |
| 5053 | +<li>One |
| 5054 | +<li>Two |
| 5055 | +</ul> |
| 5056 | +!! result |
| 5057 | +<ul> |
| 5058 | +<li>One |
| 5059 | +</li><li>Two |
| 5060 | +</li></ul> |
| 5061 | + |
| 5062 | +!! end |
| 5063 | + |
| 5064 | +!! test |
| 5065 | +HTML ordered list, closed tags (bug 5497) |
| 5066 | +!! input |
| 5067 | +<ol> |
| 5068 | +<li>One</li> |
| 5069 | +<li>Two</li> |
| 5070 | +</ol> |
| 5071 | +!! result |
| 5072 | +<ol> |
| 5073 | +<li>One</li> |
| 5074 | +<li>Two</li> |
| 5075 | +</ol> |
| 5076 | + |
| 5077 | +!! end |
| 5078 | + |
| 5079 | +!! test |
| 5080 | +HTML ordered list, unclosed tags (bug 5497) |
| 5081 | +!! options |
| 5082 | +disabled |
| 5083 | +!! input |
| 5084 | +<ol> |
| 5085 | +<li>One |
| 5086 | +<li>Two |
| 5087 | +</ol> |
| 5088 | +!! result |
| 5089 | +<ol> |
| 5090 | +<li>One |
| 5091 | +</li><li>Two |
| 5092 | +</li></ol> |
| 5093 | + |
| 5094 | +!! end |
| 5095 | + |
| 5096 | +!! test |
| 5097 | +HTML nested bullet list, closed tags (bug 5497) |
| 5098 | +!! input |
| 5099 | +<ul> |
| 5100 | +<li>One</li> |
| 5101 | +<li>Two: |
| 5102 | +<ul> |
| 5103 | +<li>Sub-one</li> |
| 5104 | +<li>Sub-two</li> |
| 5105 | +</ul> |
| 5106 | +</li> |
| 5107 | +</ul> |
| 5108 | +!! result |
| 5109 | +<ul> |
| 5110 | +<li>One</li> |
| 5111 | +<li>Two: |
| 5112 | +<ul> |
| 5113 | +<li>Sub-one</li> |
| 5114 | +<li>Sub-two</li> |
| 5115 | +</ul> |
| 5116 | +</li> |
| 5117 | +</ul> |
| 5118 | + |
| 5119 | +!! end |
| 5120 | + |
| 5121 | +!! test |
| 5122 | +HTML nested bullet list, open tags (bug 5497) |
| 5123 | +!! options |
| 5124 | +disabled |
| 5125 | +!! input |
| 5126 | +<ul> |
| 5127 | +<li>One |
| 5128 | +<li>Two: |
| 5129 | +<ul> |
| 5130 | +<li>Sub-one |
| 5131 | +<li>Sub-two |
| 5132 | +</ul> |
| 5133 | +</ul> |
| 5134 | +!! result |
| 5135 | +<ul> |
| 5136 | +<li>One |
| 5137 | +</li><li>Two: |
| 5138 | +<ul> |
| 5139 | +<li>Sub-one |
| 5140 | +</li><li>Sub-two |
| 5141 | +</li></ul> |
| 5142 | +</li></ul> |
| 5143 | + |
| 5144 | +!! end |
| 5145 | + |
| 5146 | +!! test |
| 5147 | +HTML nested ordered list, closed tags (bug 5497) |
| 5148 | +!! input |
| 5149 | +<ol> |
| 5150 | +<li>One</li> |
| 5151 | +<li>Two: |
| 5152 | +<ol> |
| 5153 | +<li>Sub-one</li> |
| 5154 | +<li>Sub-two</li> |
| 5155 | +</ol> |
| 5156 | +</li> |
| 5157 | +</ol> |
| 5158 | +!! result |
| 5159 | +<ol> |
| 5160 | +<li>One</li> |
| 5161 | +<li>Two: |
| 5162 | +<ol> |
| 5163 | +<li>Sub-one</li> |
| 5164 | +<li>Sub-two</li> |
| 5165 | +</ol> |
| 5166 | +</li> |
| 5167 | +</ol> |
| 5168 | + |
| 5169 | +!! end |
| 5170 | + |
| 5171 | +!! test |
| 5172 | +HTML nested ordered list, open tags (bug 5497) |
| 5173 | +!! options |
| 5174 | +disabled |
| 5175 | +!! input |
| 5176 | +<ol> |
| 5177 | +<li>One |
| 5178 | +<li>Two: |
| 5179 | +<ol> |
| 5180 | +<li>Sub-one |
| 5181 | +<li>Sub-two |
| 5182 | +</ol> |
| 5183 | +</ol> |
| 5184 | +!! result |
| 5185 | +<ol> |
| 5186 | +<li>One |
| 5187 | +</li><li>Two: |
| 5188 | +<ol> |
| 5189 | +<li>Sub-one |
| 5190 | +</li><li>Sub-two |
| 5191 | +</li></ol> |
| 5192 | +</li></ol> |
| 5193 | + |
| 5194 | +!! end |
| 5195 | + |
| 5196 | +!! test |
| 5197 | +HTML ordered list item with parameters oddity |
| 5198 | +!! input |
| 5199 | +<ol><li id="fragment">One</li></ol> |
| 5200 | +!! result |
| 5201 | +<ol><li id="fragment">One</li></ol> |
| 5202 | + |
| 5203 | +!! end |
| 5204 | + |
| 5205 | +!!test |
| 5206 | +bug 5918: autonumbering |
| 5207 | +!! input |
| 5208 | +[http://first/] [http://second] [ftp://ftp] |
| 5209 | + |
| 5210 | +ftp://inlineftp |
| 5211 | + |
| 5212 | +[mailto:enclosed@mail.tld With target] |
| 5213 | + |
| 5214 | +[mailto:enclosed@mail.tld] |
| 5215 | + |
| 5216 | +mailto:inline@mail.tld |
| 5217 | +!! result |
| 5218 | +<p><a href="http://first/" class="external autonumber" rel="nofollow">[1]</a> <a href="http://second" class="external autonumber" rel="nofollow">[2]</a> <a href="ftp://ftp" class="external autonumber" rel="nofollow">[3]</a> |
| 5219 | +</p><p><a href="ftp://inlineftp" class="external free" rel="nofollow">ftp://inlineftp</a> |
| 5220 | +</p><p><a href="mailto:enclosed@mail.tld" class="external text" rel="nofollow">With target</a> |
| 5221 | +</p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" rel="nofollow">[4]</a> |
| 5222 | +</p><p><a href="mailto:inline@mail.tld" class="external free" rel="nofollow">mailto:inline@mail.tld</a> |
| 5223 | +</p> |
| 5224 | +!! end |
| 5225 | + |
| 5226 | + |
| 5227 | +# |
| 5228 | +# Security and HTML correctness |
| 5229 | +# From Nick Jenkins' fuzz testing |
| 5230 | +# |
| 5231 | + |
| 5232 | +!! test |
| 5233 | +Fuzz testing: Parser13 |
| 5234 | +!! input |
| 5235 | +{| |
| 5236 | +| http://a| |
| 5237 | +!! result |
| 5238 | +<table> |
| 5239 | +<tr> |
| 5240 | +<td> |
| 5241 | +</td> |
| 5242 | +</tr> |
| 5243 | +</table> |
| 5244 | + |
| 5245 | +!! end |
| 5246 | + |
| 5247 | +!! test |
| 5248 | +Fuzz testing: Parser14 |
| 5249 | +!! input |
| 5250 | +== onmouseover= == |
| 5251 | +http://__TOC__ |
| 5252 | +!! result |
| 5253 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline" id="onmouseover.3D"> onmouseover= </span></h2> |
| 5254 | +http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 5255 | +<ul> |
| 5256 | +<li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li> |
| 5257 | +</ul> |
| 5258 | +</td></tr></table> |
| 5259 | + |
| 5260 | +!! end |
| 5261 | + |
| 5262 | +!! test |
| 5263 | +Fuzz testing: Parser14-table |
| 5264 | +!! input |
| 5265 | +==a== |
| 5266 | +{| STYLE=__TOC__ |
| 5267 | +!! result |
| 5268 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline" id="a">a</span></h2> |
| 5269 | +<table style="__TOC__"> |
| 5270 | +<tr><td></td></tr> |
| 5271 | +</table> |
| 5272 | + |
| 5273 | +!! end |
| 5274 | + |
| 5275 | +# Known to produce bogus xml (extra </td>) |
| 5276 | +!! test |
| 5277 | +Fuzz testing: Parser16 |
| 5278 | +!! options |
| 5279 | +noxml |
| 5280 | +!! input |
| 5281 | +{| |
| 5282 | +!https://|||||| |
| 5283 | +!! result |
| 5284 | +<table> |
| 5285 | +<tr> |
| 5286 | +<th>https://</th> |
| 5287 | +<th></th> |
| 5288 | +<th></th> |
| 5289 | +<th> |
| 5290 | +</td> |
| 5291 | +</tr> |
| 5292 | +</table> |
| 5293 | + |
| 5294 | +!! end |
| 5295 | + |
| 5296 | +!! test |
| 5297 | +Fuzz testing: Parser21 |
| 5298 | +!! input |
| 5299 | +{| |
| 5300 | +! irc://{{ftp://a" onmouseover="alert('hello world');" |
| 5301 | +| |
| 5302 | +!! result |
| 5303 | +<table> |
| 5304 | +<tr> |
| 5305 | +<th> <a href="irc://{{ftp://a" class="external free" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');" |
| 5306 | +</th> |
| 5307 | +<td> |
| 5308 | +</td> |
| 5309 | +</tr> |
| 5310 | +</table> |
| 5311 | + |
| 5312 | +!! end |
| 5313 | + |
| 5314 | +!! test |
| 5315 | +Fuzz testing: Parser22 |
| 5316 | +!! input |
| 5317 | +http://===r:::https://b |
| 5318 | + |
| 5319 | +{| |
| 5320 | +!!result |
| 5321 | +<p><a href="http://===r:::https://b" class="external free" rel="nofollow">http://===r:::https://b</a> |
| 5322 | +</p> |
| 5323 | +<table> |
| 5324 | +<tr><td></td></tr> |
| 5325 | +</table> |
| 5326 | + |
| 5327 | +!! end |
| 5328 | + |
| 5329 | +# Known to produce bad XML for now |
| 5330 | +!! test |
| 5331 | +Fuzz testing: Parser24 |
| 5332 | +!! options |
| 5333 | +noxml |
| 5334 | +!! input |
| 5335 | +{| |
| 5336 | +{{{| |
| 5337 | +<u CLASS= |
| 5338 | +| {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} > |
| 5339 | +<br style="onmouseover='alert(document.cookie);' " /> |
| 5340 | + |
| 5341 | +MOVE YOUR MOUSE CURSOR OVER THIS TEXT |
| 5342 | +| |
| 5343 | +!! result |
| 5344 | +<table> |
| 5345 | +{{{| |
| 5346 | +<u class="|">}}}} > |
| 5347 | +<br style="onmouseover='alert(document.cookie);'" /> |
| 5348 | + |
| 5349 | +MOVE YOUR MOUSE CURSOR OVER THIS TEXT |
| 5350 | +<tr> |
| 5351 | +<td></u> |
| 5352 | +</td> |
| 5353 | +</tr> |
| 5354 | +</table> |
| 5355 | + |
| 5356 | +!! end |
| 5357 | + |
| 5358 | +# Note: the current result listed for this is not what the original one was, |
| 5359 | +# but the original bug was JavaScript injection, which is fixed in any case. |
| 5360 | +# It's not clear that the original result listed was any more correct than the |
| 5361 | +# current one. Original result: |
| 5362 | +# <p>{{{| |
| 5363 | +# </p> |
| 5364 | +# <li class="||"> |
| 5365 | +# }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b> |
| 5366 | +!!test |
| 5367 | +Fuzz testing: Parser25 (bug 6055) |
| 5368 | +!! input |
| 5369 | +{{{ |
| 5370 | +| |
| 5371 | +<LI CLASS=|| |
| 5372 | + > |
| 5373 | +}}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE |
| 5374 | +!! result |
| 5375 | +<p><LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b> |
| 5376 | +</p> |
| 5377 | +!! end |
| 5378 | + |
| 5379 | +!!test |
| 5380 | +Fuzz testing: URL adjacent extension (with space, clean) |
| 5381 | +!! options |
| 5382 | +!! input |
| 5383 | +http://example.com <nowiki>junk</nowiki> |
| 5384 | +!! result |
| 5385 | +<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a> junk |
| 5386 | +</p> |
| 5387 | +!!end |
| 5388 | + |
| 5389 | +!!test |
| 5390 | +Fuzz testing: URL adjacent extension (no space, dirty; nowiki) |
| 5391 | +!! options |
| 5392 | +!! input |
| 5393 | +http://example.com<nowiki>junk</nowiki> |
| 5394 | +!! result |
| 5395 | +<p><a href="http://example.com" class="external free" rel="nofollow">http://example.com</a>junk |
| 5396 | +</p> |
| 5397 | +!!end |
| 5398 | + |
| 5399 | +!!test |
| 5400 | +Fuzz testing: URL adjacent extension (no space, dirty; pre) |
| 5401 | +!! options |
| 5402 | +!! input |
| 5403 | +http://example.com<pre>junk</pre> |
| 5404 | +!! result |
| 5405 | +<a href="http://example.com" class="external free" rel="nofollow">http://example.com</a><pre>junk</pre> |
| 5406 | + |
| 5407 | +!!end |
| 5408 | + |
| 5409 | +!!test |
| 5410 | +Fuzz testing: image with bogus manual thumbnail |
| 5411 | +!!input |
| 5412 | +[[Image:foobar.jpg|thumbnail= ]] |
| 5413 | +!!result |
| 5414 | +<div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div> |
| 5415 | + |
| 5416 | +!!end |
| 5417 | + |
| 5418 | +!! test |
| 5419 | +Fuzz testing: encoded newline in generated HTML replacements (bug 6577) |
| 5420 | +!! input |
| 5421 | +<pre dir=" "></pre> |
| 5422 | +!! result |
| 5423 | +<pre dir=" "></pre> |
| 5424 | + |
| 5425 | +!! end |
| 5426 | + |
| 5427 | +!! test |
| 5428 | +Parsing optional HTML elements (Bug 6171) |
| 5429 | +!! options |
| 5430 | +!! input |
| 5431 | +<table> |
| 5432 | + <tr> |
| 5433 | + <td> Some tabular data</td> |
| 5434 | + <td> More tabular data ... |
| 5435 | + <td> And yet som tabular data</td> |
| 5436 | + </tr> |
| 5437 | +</table> |
| 5438 | +!! result |
| 5439 | +<table> |
| 5440 | + <tr> |
| 5441 | + <td> Some tabular data</td> |
| 5442 | + <td> More tabular data ... |
| 5443 | + </td><td> And yet som tabular data</td> |
| 5444 | + </tr> |
| 5445 | +</table> |
| 5446 | + |
| 5447 | +!! end |
| 5448 | + |
| 5449 | +!! test |
| 5450 | +Correct handling of <td>, <tr> (Bug 6171) |
| 5451 | +!! options |
| 5452 | +!! input |
| 5453 | +<table> |
| 5454 | + <tr> |
| 5455 | + <td> Some tabular data</td> |
| 5456 | + <td> More tabular data ...</td> |
| 5457 | + <td> And yet som tabular data</td> |
| 5458 | + </tr> |
| 5459 | +</table> |
| 5460 | +!! result |
| 5461 | +<table> |
| 5462 | + <tr> |
| 5463 | + <td> Some tabular data</td> |
| 5464 | + <td> More tabular data ...</td> |
| 5465 | + <td> And yet som tabular data</td> |
| 5466 | + </tr> |
| 5467 | +</table> |
| 5468 | + |
| 5469 | +!! end |
| 5470 | + |
| 5471 | + |
| 5472 | +!! test |
| 5473 | +Parsing crashing regression (fr:JavaScript) |
| 5474 | +!! input |
| 5475 | +</body></x> |
| 5476 | +!! result |
| 5477 | +<p></body></x> |
| 5478 | +</p> |
| 5479 | +!! end |
| 5480 | + |
| 5481 | +!! test |
| 5482 | +Inline wiki vs wiki block nesting |
| 5483 | +!! input |
| 5484 | +'''Bold paragraph |
| 5485 | + |
| 5486 | +New wiki paragraph |
| 5487 | +!! result |
| 5488 | +<p><b>Bold paragraph</b> |
| 5489 | +</p><p>New wiki paragraph |
| 5490 | +</p> |
| 5491 | +!! end |
| 5492 | + |
| 5493 | +!! test |
| 5494 | +Inline HTML vs wiki block nesting |
| 5495 | +!! options |
| 5496 | +disabled |
| 5497 | +!! input |
| 5498 | +<b>Bold paragraph |
| 5499 | + |
| 5500 | +New wiki paragraph |
| 5501 | +!! result |
| 5502 | +<p><b>Bold paragraph</b> |
| 5503 | +</p><p>New wiki paragraph |
| 5504 | +</p> |
| 5505 | +!! end |
| 5506 | + |
| 5507 | +# Original result was this: |
| 5508 | +# <p><b>bold</b><b>bold<i>bolditalics</i></b> |
| 5509 | +# </p> |
| 5510 | +# While that might be marginally more intuitive, maybe, the six-apostrophe |
| 5511 | +# construct is clearly pathological and the result stated here (which is what |
| 5512 | +# the parser actually does) is about as reasonable as anything. |
| 5513 | +!!test |
| 5514 | +Mixing markup for italics and bold |
| 5515 | +!! options |
| 5516 | +!! input |
| 5517 | +'''bold''''''bold''bolditalics''''' |
| 5518 | +!! result |
| 5519 | +<p>'<i>bold'</i><b>bold<i>bolditalics</i></b> |
| 5520 | +</p> |
| 5521 | +!! end |
| 5522 | + |
| 5523 | + |
| 5524 | +!! article |
| 5525 | +Xyzzyx |
| 5526 | +!! text |
| 5527 | +Article for special page transclusion test |
| 5528 | +!! endarticle |
| 5529 | + |
| 5530 | +!! test |
| 5531 | +Special page transclusion |
| 5532 | +!! options |
| 5533 | +!! input |
| 5534 | +{{Special:Prefixindex/Xyzzyx}} |
| 5535 | +!! result |
| 5536 | +<p><br /> |
| 5537 | +</p> |
| 5538 | +<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> |
| 5539 | + |
| 5540 | +!! end |
| 5541 | + |
| 5542 | +!! test |
| 5543 | +Special page transclusion twice (bug 5021) |
| 5544 | +!! options |
| 5545 | +!! input |
| 5546 | +{{Special:Prefixindex/Xyzzyx}} |
| 5547 | +{{Special:Prefixindex/Xyzzyx}} |
| 5548 | +!! result |
| 5549 | +<p><br /> |
| 5550 | +</p> |
| 5551 | +<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> |
| 5552 | +<p><br /> |
| 5553 | +</p> |
| 5554 | +<table border="0" id="mw-prefixindex-list-table"><tr><td><a href="https://www.mediawiki.org/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table> |
| 5555 | + |
| 5556 | +!! end |
| 5557 | + |
| 5558 | +!! test |
| 5559 | +Transclusion of default MediaWiki message |
| 5560 | +!! input |
| 5561 | +{{MediaWiki:Mainpage}} |
| 5562 | +!!result |
| 5563 | +<p>Main Page |
| 5564 | +</p> |
| 5565 | +!! end |
| 5566 | + |
| 5567 | +!! test |
| 5568 | +Transclusion of nonexistent MediaWiki message |
| 5569 | +!! input |
| 5570 | +{{MediaWiki:Mainpagexxx}} |
| 5571 | +!!result |
| 5572 | +<p><a href="https://www.mediawiki.org/index.php?title=MediaWiki:Mainpagexxx&action=edit&redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a> |
| 5573 | +</p> |
| 5574 | +!! end |
| 5575 | + |
| 5576 | +!! test |
| 5577 | +Transclusion of MediaWiki message with underscore |
| 5578 | +!! input |
| 5579 | +{{MediaWiki:history_short}} |
| 5580 | +!! result |
| 5581 | +<p>History |
| 5582 | +</p> |
| 5583 | +!! end |
| 5584 | + |
| 5585 | +!! test |
| 5586 | +Transclusion of MediaWiki message with space |
| 5587 | +!! input |
| 5588 | +{{MediaWiki:history short}} |
| 5589 | +!! result |
| 5590 | +<p>History |
| 5591 | +</p> |
| 5592 | +!! end |
| 5593 | + |
| 5594 | +!! test |
| 5595 | +Invalid header with following text |
| 5596 | +!! input |
| 5597 | += x = y |
| 5598 | +!! result |
| 5599 | +<p>= x = y |
| 5600 | +</p> |
| 5601 | +!! end |
| 5602 | + |
| 5603 | + |
| 5604 | +!! test |
| 5605 | +Section extraction test (section 0) |
| 5606 | +!! options |
| 5607 | +section=0 |
| 5608 | +!! input |
| 5609 | +start |
| 5610 | +==a== |
| 5611 | +===aa=== |
| 5612 | +====aaa==== |
| 5613 | +==b== |
| 5614 | +===ba=== |
| 5615 | +===bb=== |
| 5616 | +====bba==== |
| 5617 | +===bc=== |
| 5618 | +==c== |
| 5619 | +===ca=== |
| 5620 | +!! result |
| 5621 | +start |
| 5622 | +!! end |
| 5623 | + |
| 5624 | +!! test |
| 5625 | +Section extraction test (section 1) |
| 5626 | +!! options |
| 5627 | +section=1 |
| 5628 | +!! input |
| 5629 | +start |
| 5630 | +==a== |
| 5631 | +===aa=== |
| 5632 | +====aaa==== |
| 5633 | +==b== |
| 5634 | +===ba=== |
| 5635 | +===bb=== |
| 5636 | +====bba==== |
| 5637 | +===bc=== |
| 5638 | +==c== |
| 5639 | +===ca=== |
| 5640 | +!! result |
| 5641 | +==a== |
| 5642 | +===aa=== |
| 5643 | +====aaa==== |
| 5644 | +!! end |
| 5645 | + |
| 5646 | +!! test |
| 5647 | +Section extraction test (section 2) |
| 5648 | +!! options |
| 5649 | +section=2 |
| 5650 | +!! input |
| 5651 | +start |
| 5652 | +==a== |
| 5653 | +===aa=== |
| 5654 | +====aaa==== |
| 5655 | +==b== |
| 5656 | +===ba=== |
| 5657 | +===bb=== |
| 5658 | +====bba==== |
| 5659 | +===bc=== |
| 5660 | +==c== |
| 5661 | +===ca=== |
| 5662 | +!! result |
| 5663 | +===aa=== |
| 5664 | +====aaa==== |
| 5665 | +!! end |
| 5666 | + |
| 5667 | +!! test |
| 5668 | +Section extraction test (section 3) |
| 5669 | +!! options |
| 5670 | +section=3 |
| 5671 | +!! input |
| 5672 | +start |
| 5673 | +==a== |
| 5674 | +===aa=== |
| 5675 | +====aaa==== |
| 5676 | +==b== |
| 5677 | +===ba=== |
| 5678 | +===bb=== |
| 5679 | +====bba==== |
| 5680 | +===bc=== |
| 5681 | +==c== |
| 5682 | +===ca=== |
| 5683 | +!! result |
| 5684 | +====aaa==== |
| 5685 | +!! end |
| 5686 | + |
| 5687 | +!! test |
| 5688 | +Section extraction test (section 4) |
| 5689 | +!! options |
| 5690 | +section=4 |
| 5691 | +!! input |
| 5692 | +start |
| 5693 | +==a== |
| 5694 | +===aa=== |
| 5695 | +====aaa==== |
| 5696 | +==b== |
| 5697 | +===ba=== |
| 5698 | +===bb=== |
| 5699 | +====bba==== |
| 5700 | +===bc=== |
| 5701 | +==c== |
| 5702 | +===ca=== |
| 5703 | +!! result |
| 5704 | +==b== |
| 5705 | +===ba=== |
| 5706 | +===bb=== |
| 5707 | +====bba==== |
| 5708 | +===bc=== |
| 5709 | +!! end |
| 5710 | + |
| 5711 | +!! test |
| 5712 | +Section extraction test (section 5) |
| 5713 | +!! options |
| 5714 | +section=5 |
| 5715 | +!! input |
| 5716 | +start |
| 5717 | +==a== |
| 5718 | +===aa=== |
| 5719 | +====aaa==== |
| 5720 | +==b== |
| 5721 | +===ba=== |
| 5722 | +===bb=== |
| 5723 | +====bba==== |
| 5724 | +===bc=== |
| 5725 | +==c== |
| 5726 | +===ca=== |
| 5727 | +!! result |
| 5728 | +===ba=== |
| 5729 | +!! end |
| 5730 | + |
| 5731 | +!! test |
| 5732 | +Section extraction test (section 6) |
| 5733 | +!! options |
| 5734 | +section=6 |
| 5735 | +!! input |
| 5736 | +start |
| 5737 | +==a== |
| 5738 | +===aa=== |
| 5739 | +====aaa==== |
| 5740 | +==b== |
| 5741 | +===ba=== |
| 5742 | +===bb=== |
| 5743 | +====bba==== |
| 5744 | +===bc=== |
| 5745 | +==c== |
| 5746 | +===ca=== |
| 5747 | +!! result |
| 5748 | +===bb=== |
| 5749 | +====bba==== |
| 5750 | +!! end |
| 5751 | + |
| 5752 | +!! test |
| 5753 | +Section extraction test (section 7) |
| 5754 | +!! options |
| 5755 | +section=7 |
| 5756 | +!! input |
| 5757 | +start |
| 5758 | +==a== |
| 5759 | +===aa=== |
| 5760 | +====aaa==== |
| 5761 | +==b== |
| 5762 | +===ba=== |
| 5763 | +===bb=== |
| 5764 | +====bba==== |
| 5765 | +===bc=== |
| 5766 | +==c== |
| 5767 | +===ca=== |
| 5768 | +!! result |
| 5769 | +====bba==== |
| 5770 | +!! end |
| 5771 | + |
| 5772 | +!! test |
| 5773 | +Section extraction test (section 8) |
| 5774 | +!! options |
| 5775 | +section=8 |
| 5776 | +!! input |
| 5777 | +start |
| 5778 | +==a== |
| 5779 | +===aa=== |
| 5780 | +====aaa==== |
| 5781 | +==b== |
| 5782 | +===ba=== |
| 5783 | +===bb=== |
| 5784 | +====bba==== |
| 5785 | +===bc=== |
| 5786 | +==c== |
| 5787 | +===ca=== |
| 5788 | +!! result |
| 5789 | +===bc=== |
| 5790 | +!! end |
| 5791 | + |
| 5792 | +!! test |
| 5793 | +Section extraction test (section 9) |
| 5794 | +!! options |
| 5795 | +section=9 |
| 5796 | +!! input |
| 5797 | +start |
| 5798 | +==a== |
| 5799 | +===aa=== |
| 5800 | +====aaa==== |
| 5801 | +==b== |
| 5802 | +===ba=== |
| 5803 | +===bb=== |
| 5804 | +====bba==== |
| 5805 | +===bc=== |
| 5806 | +==c== |
| 5807 | +===ca=== |
| 5808 | +!! result |
| 5809 | +==c== |
| 5810 | +===ca=== |
| 5811 | +!! end |
| 5812 | + |
| 5813 | +!! test |
| 5814 | +Section extraction test (section 10) |
| 5815 | +!! options |
| 5816 | +section=10 |
| 5817 | +!! input |
| 5818 | +start |
| 5819 | +==a== |
| 5820 | +===aa=== |
| 5821 | +====aaa==== |
| 5822 | +==b== |
| 5823 | +===ba=== |
| 5824 | +===bb=== |
| 5825 | +====bba==== |
| 5826 | +===bc=== |
| 5827 | +==c== |
| 5828 | +===ca=== |
| 5829 | +!! result |
| 5830 | +===ca=== |
| 5831 | +!! end |
| 5832 | + |
| 5833 | +!! test |
| 5834 | +Section extraction test (nonexistent section 11) |
| 5835 | +!! options |
| 5836 | +section=11 |
| 5837 | +!! input |
| 5838 | +start |
| 5839 | +==a== |
| 5840 | +===aa=== |
| 5841 | +====aaa==== |
| 5842 | +==b== |
| 5843 | +===ba=== |
| 5844 | +===bb=== |
| 5845 | +====bba==== |
| 5846 | +===bc=== |
| 5847 | +==c== |
| 5848 | +===ca=== |
| 5849 | +!! result |
| 5850 | +!! end |
| 5851 | + |
| 5852 | +!! test |
| 5853 | +Section extraction test with bogus heading (section 1) |
| 5854 | +!! options |
| 5855 | +section=1 |
| 5856 | +!! input |
| 5857 | +==a== |
| 5858 | +==bogus== not a legal section |
| 5859 | +==b== |
| 5860 | +!! result |
| 5861 | +==a== |
| 5862 | +==bogus== not a legal section |
| 5863 | +!! end |
| 5864 | + |
| 5865 | +!! test |
| 5866 | +Section extraction test with bogus heading (section 2) |
| 5867 | +!! options |
| 5868 | +section=2 |
| 5869 | +!! input |
| 5870 | +==a== |
| 5871 | +==bogus== not a legal section |
| 5872 | +==b== |
| 5873 | +!! result |
| 5874 | +==b== |
| 5875 | +!! end |
| 5876 | + |
| 5877 | +!! test |
| 5878 | +Section extraction test with comment after heading (section 1) |
| 5879 | +!! options |
| 5880 | +section=1 |
| 5881 | +!! input |
| 5882 | +==a== |
| 5883 | +==b== <!-- --> |
| 5884 | +==c== |
| 5885 | +!! result |
| 5886 | +==a== |
| 5887 | +!! end |
| 5888 | + |
| 5889 | +!! test |
| 5890 | +Section extraction test with comment after heading (section 2) |
| 5891 | +!! options |
| 5892 | +section=2 |
| 5893 | +!! input |
| 5894 | +==a== |
| 5895 | +==b== <!-- --> |
| 5896 | +==c== |
| 5897 | +!! result |
| 5898 | +==b== <!-- --> |
| 5899 | +!! end |
| 5900 | + |
| 5901 | +!! test |
| 5902 | +Section extraction test with bogus <nowiki> heading (section 1) |
| 5903 | +!! options |
| 5904 | +section=1 |
| 5905 | +!! input |
| 5906 | +==a== |
| 5907 | +==bogus== <nowiki>not a legal section</nowiki> |
| 5908 | +==b== |
| 5909 | +!! result |
| 5910 | +==a== |
| 5911 | +==bogus== <nowiki>not a legal section</nowiki> |
| 5912 | +!! end |
| 5913 | + |
| 5914 | +!! test |
| 5915 | +Section extraction test with bogus <nowiki> heading (section 2) |
| 5916 | +!! options |
| 5917 | +section=2 |
| 5918 | +!! input |
| 5919 | +==a== |
| 5920 | +==bogus== <nowiki>not a legal section</nowiki> |
| 5921 | +==b== |
| 5922 | +!! result |
| 5923 | +==b== |
| 5924 | +!! end |
| 5925 | + |
| 5926 | + |
| 5927 | +# Formerly testing for bug 2587, now resolved by the use of unmarked sections |
| 5928 | +# instead of respecting commented sections |
| 5929 | +!! test |
| 5930 | +Section extraction prefixed by comment (section 1) |
| 5931 | +!! options |
| 5932 | +section=1 |
| 5933 | +!! input |
| 5934 | +<!-- -->==sec1== |
| 5935 | +==sec2== |
| 5936 | +!!result |
| 5937 | +==sec2== |
| 5938 | +!!end |
| 5939 | + |
| 5940 | +!! test |
| 5941 | +Section extraction prefixed by comment (section 2) |
| 5942 | +!! options |
| 5943 | +section=2 |
| 5944 | +!! input |
| 5945 | +<!-- -->==sec1== |
| 5946 | +==sec2== |
| 5947 | +!!result |
| 5948 | + |
| 5949 | +!!end |
| 5950 | + |
| 5951 | + |
| 5952 | +# Formerly testing for bug 2607, now resolved by the use of unmarked sections |
| 5953 | +# instead of respecting HTML-style headings |
| 5954 | +!! test |
| 5955 | +Section extraction, mixed wiki and html (section 1) |
| 5956 | +!! options |
| 5957 | +section=1 |
| 5958 | +!! input |
| 5959 | +<h2>unmarked</h2> |
| 5960 | +unmarked |
| 5961 | +==1== |
| 5962 | +one |
| 5963 | +==2== |
| 5964 | +two |
| 5965 | +!! result |
| 5966 | +==1== |
| 5967 | +one |
| 5968 | +!! end |
| 5969 | + |
| 5970 | +!! test |
| 5971 | +Section extraction, mixed wiki and html (section 2) |
| 5972 | +!! options |
| 5973 | +section=2 |
| 5974 | +!! input |
| 5975 | +<h2>unmarked</h2> |
| 5976 | +unmarked |
| 5977 | +==1== |
| 5978 | +one |
| 5979 | +==2== |
| 5980 | +two |
| 5981 | +!! result |
| 5982 | +==2== |
| 5983 | +two |
| 5984 | +!! end |
| 5985 | + |
| 5986 | + |
| 5987 | +# Formerly testing for bug 3342 |
| 5988 | +!! test |
| 5989 | +Section extraction, heading surrounded by <noinclude> |
| 5990 | +!! options |
| 5991 | +section=1 |
| 5992 | +!! input |
| 5993 | +<noinclude>==unmarked==</noinclude> |
| 5994 | +==marked== |
| 5995 | +!! result |
| 5996 | +==marked== |
| 5997 | +!!end |
| 5998 | + |
| 5999 | +# Test behaviour of bug 19910 |
| 6000 | +!! test |
| 6001 | +Sectiion with all-equals |
| 6002 | +!! options |
| 6003 | +section=2 |
| 6004 | +!! input |
| 6005 | +=== |
| 6006 | +The line above must have a trailing space |
| 6007 | +=== <!-- |
| 6008 | +--> <!-- --> |
| 6009 | +But just in case it doesn't... |
| 6010 | +!! result |
| 6011 | +=== <!-- |
| 6012 | +--> <!-- --> |
| 6013 | +But just in case it doesn't... |
| 6014 | +!! end |
| 6015 | + |
| 6016 | +!! test |
| 6017 | +Section replacement test (section 0) |
| 6018 | +!! options |
| 6019 | +replace=0,"xxx" |
| 6020 | +!! input |
| 6021 | +start |
| 6022 | +==a== |
| 6023 | +===aa=== |
| 6024 | +====aaa==== |
| 6025 | +==b== |
| 6026 | +===ba=== |
| 6027 | +===bb=== |
| 6028 | +====bba==== |
| 6029 | +===bc=== |
| 6030 | +==c== |
| 6031 | +===ca=== |
| 6032 | +!! result |
| 6033 | +xxx |
| 6034 | + |
| 6035 | +==a== |
| 6036 | +===aa=== |
| 6037 | +====aaa==== |
| 6038 | +==b== |
| 6039 | +===ba=== |
| 6040 | +===bb=== |
| 6041 | +====bba==== |
| 6042 | +===bc=== |
| 6043 | +==c== |
| 6044 | +===ca=== |
| 6045 | +!! end |
| 6046 | + |
| 6047 | +!! test |
| 6048 | +Section replacement test (section 1) |
| 6049 | +!! options |
| 6050 | +replace=1,"xxx" |
| 6051 | +!! input |
| 6052 | +start |
| 6053 | +==a== |
| 6054 | +===aa=== |
| 6055 | +====aaa==== |
| 6056 | +==b== |
| 6057 | +===ba=== |
| 6058 | +===bb=== |
| 6059 | +====bba==== |
| 6060 | +===bc=== |
| 6061 | +==c== |
| 6062 | +===ca=== |
| 6063 | +!! result |
| 6064 | +start |
| 6065 | +xxx |
| 6066 | + |
| 6067 | +==b== |
| 6068 | +===ba=== |
| 6069 | +===bb=== |
| 6070 | +====bba==== |
| 6071 | +===bc=== |
| 6072 | +==c== |
| 6073 | +===ca=== |
| 6074 | +!! end |
| 6075 | + |
| 6076 | +!! test |
| 6077 | +Section replacement test (section 2) |
| 6078 | +!! options |
| 6079 | +replace=2,"xxx" |
| 6080 | +!! input |
| 6081 | +start |
| 6082 | +==a== |
| 6083 | +===aa=== |
| 6084 | +====aaa==== |
| 6085 | +==b== |
| 6086 | +===ba=== |
| 6087 | +===bb=== |
| 6088 | +====bba==== |
| 6089 | +===bc=== |
| 6090 | +==c== |
| 6091 | +===ca=== |
| 6092 | +!! result |
| 6093 | +start |
| 6094 | +==a== |
| 6095 | +xxx |
| 6096 | + |
| 6097 | +==b== |
| 6098 | +===ba=== |
| 6099 | +===bb=== |
| 6100 | +====bba==== |
| 6101 | +===bc=== |
| 6102 | +==c== |
| 6103 | +===ca=== |
| 6104 | +!! end |
| 6105 | + |
| 6106 | +!! test |
| 6107 | +Section replacement test (section 3) |
| 6108 | +!! options |
| 6109 | +replace=3,"xxx" |
| 6110 | +!! input |
| 6111 | +start |
| 6112 | +==a== |
| 6113 | +===aa=== |
| 6114 | +====aaa==== |
| 6115 | +==b== |
| 6116 | +===ba=== |
| 6117 | +===bb=== |
| 6118 | +====bba==== |
| 6119 | +===bc=== |
| 6120 | +==c== |
| 6121 | +===ca=== |
| 6122 | +!! result |
| 6123 | +start |
| 6124 | +==a== |
| 6125 | +===aa=== |
| 6126 | +xxx |
| 6127 | + |
| 6128 | +==b== |
| 6129 | +===ba=== |
| 6130 | +===bb=== |
| 6131 | +====bba==== |
| 6132 | +===bc=== |
| 6133 | +==c== |
| 6134 | +===ca=== |
| 6135 | +!! end |
| 6136 | + |
| 6137 | +!! test |
| 6138 | +Section replacement test (section 4) |
| 6139 | +!! options |
| 6140 | +replace=4,"xxx" |
| 6141 | +!! input |
| 6142 | +start |
| 6143 | +==a== |
| 6144 | +===aa=== |
| 6145 | +====aaa==== |
| 6146 | +==b== |
| 6147 | +===ba=== |
| 6148 | +===bb=== |
| 6149 | +====bba==== |
| 6150 | +===bc=== |
| 6151 | +==c== |
| 6152 | +===ca=== |
| 6153 | +!! result |
| 6154 | +start |
| 6155 | +==a== |
| 6156 | +===aa=== |
| 6157 | +====aaa==== |
| 6158 | +xxx |
| 6159 | + |
| 6160 | +==c== |
| 6161 | +===ca=== |
| 6162 | +!! end |
| 6163 | + |
| 6164 | +!! test |
| 6165 | +Section replacement test (section 5) |
| 6166 | +!! options |
| 6167 | +replace=5,"xxx" |
| 6168 | +!! input |
| 6169 | +start |
| 6170 | +==a== |
| 6171 | +===aa=== |
| 6172 | +====aaa==== |
| 6173 | +==b== |
| 6174 | +===ba=== |
| 6175 | +===bb=== |
| 6176 | +====bba==== |
| 6177 | +===bc=== |
| 6178 | +==c== |
| 6179 | +===ca=== |
| 6180 | +!! result |
| 6181 | +start |
| 6182 | +==a== |
| 6183 | +===aa=== |
| 6184 | +====aaa==== |
| 6185 | +==b== |
| 6186 | +xxx |
| 6187 | + |
| 6188 | +===bb=== |
| 6189 | +====bba==== |
| 6190 | +===bc=== |
| 6191 | +==c== |
| 6192 | +===ca=== |
| 6193 | +!! end |
| 6194 | + |
| 6195 | +!! test |
| 6196 | +Section replacement test (section 6) |
| 6197 | +!! options |
| 6198 | +replace=6,"xxx" |
| 6199 | +!! input |
| 6200 | +start |
| 6201 | +==a== |
| 6202 | +===aa=== |
| 6203 | +====aaa==== |
| 6204 | +==b== |
| 6205 | +===ba=== |
| 6206 | +===bb=== |
| 6207 | +====bba==== |
| 6208 | +===bc=== |
| 6209 | +==c== |
| 6210 | +===ca=== |
| 6211 | +!! result |
| 6212 | +start |
| 6213 | +==a== |
| 6214 | +===aa=== |
| 6215 | +====aaa==== |
| 6216 | +==b== |
| 6217 | +===ba=== |
| 6218 | +xxx |
| 6219 | + |
| 6220 | +===bc=== |
| 6221 | +==c== |
| 6222 | +===ca=== |
| 6223 | +!! end |
| 6224 | + |
| 6225 | +!! test |
| 6226 | +Section replacement test (section 7) |
| 6227 | +!! options |
| 6228 | +replace=7,"xxx" |
| 6229 | +!! input |
| 6230 | +start |
| 6231 | +==a== |
| 6232 | +===aa=== |
| 6233 | +====aaa==== |
| 6234 | +==b== |
| 6235 | +===ba=== |
| 6236 | +===bb=== |
| 6237 | +====bba==== |
| 6238 | +===bc=== |
| 6239 | +==c== |
| 6240 | +===ca=== |
| 6241 | +!! result |
| 6242 | +start |
| 6243 | +==a== |
| 6244 | +===aa=== |
| 6245 | +====aaa==== |
| 6246 | +==b== |
| 6247 | +===ba=== |
| 6248 | +===bb=== |
| 6249 | +xxx |
| 6250 | + |
| 6251 | +===bc=== |
| 6252 | +==c== |
| 6253 | +===ca=== |
| 6254 | +!! end |
| 6255 | + |
| 6256 | +!! test |
| 6257 | +Section replacement test (section 8) |
| 6258 | +!! options |
| 6259 | +replace=8,"xxx" |
| 6260 | +!! input |
| 6261 | +start |
| 6262 | +==a== |
| 6263 | +===aa=== |
| 6264 | +====aaa==== |
| 6265 | +==b== |
| 6266 | +===ba=== |
| 6267 | +===bb=== |
| 6268 | +====bba==== |
| 6269 | +===bc=== |
| 6270 | +==c== |
| 6271 | +===ca=== |
| 6272 | +!! result |
| 6273 | +start |
| 6274 | +==a== |
| 6275 | +===aa=== |
| 6276 | +====aaa==== |
| 6277 | +==b== |
| 6278 | +===ba=== |
| 6279 | +===bb=== |
| 6280 | +====bba==== |
| 6281 | +xxx |
| 6282 | + |
| 6283 | +==c== |
| 6284 | +===ca=== |
| 6285 | +!!end |
| 6286 | + |
| 6287 | +!! test |
| 6288 | +Section replacement test (section 9) |
| 6289 | +!! options |
| 6290 | +replace=9,"xxx" |
| 6291 | +!! input |
| 6292 | +start |
| 6293 | +==a== |
| 6294 | +===aa=== |
| 6295 | +====aaa==== |
| 6296 | +==b== |
| 6297 | +===ba=== |
| 6298 | +===bb=== |
| 6299 | +====bba==== |
| 6300 | +===bc=== |
| 6301 | +==c== |
| 6302 | +===ca=== |
| 6303 | +!! result |
| 6304 | +start |
| 6305 | +==a== |
| 6306 | +===aa=== |
| 6307 | +====aaa==== |
| 6308 | +==b== |
| 6309 | +===ba=== |
| 6310 | +===bb=== |
| 6311 | +====bba==== |
| 6312 | +===bc=== |
| 6313 | +xxx |
| 6314 | +!! end |
| 6315 | + |
| 6316 | +!! test |
| 6317 | +Section replacement test (section 10) |
| 6318 | +!! options |
| 6319 | +replace=10,"xxx" |
| 6320 | +!! input |
| 6321 | +start |
| 6322 | +==a== |
| 6323 | +===aa=== |
| 6324 | +====aaa==== |
| 6325 | +==b== |
| 6326 | +===ba=== |
| 6327 | +===bb=== |
| 6328 | +====bba==== |
| 6329 | +===bc=== |
| 6330 | +==c== |
| 6331 | +===ca=== |
| 6332 | +!! result |
| 6333 | +start |
| 6334 | +==a== |
| 6335 | +===aa=== |
| 6336 | +====aaa==== |
| 6337 | +==b== |
| 6338 | +===ba=== |
| 6339 | +===bb=== |
| 6340 | +====bba==== |
| 6341 | +===bc=== |
| 6342 | +==c== |
| 6343 | +xxx |
| 6344 | +!! end |
| 6345 | + |
| 6346 | +!! test |
| 6347 | +Section replacement test with initial whitespace (bug 13728) |
| 6348 | +!! options |
| 6349 | +replace=2,"xxx" |
| 6350 | +!! input |
| 6351 | + Preformatted initial line |
| 6352 | +==a== |
| 6353 | +===a=== |
| 6354 | +!! result |
| 6355 | + Preformatted initial line |
| 6356 | +==a== |
| 6357 | +xxx |
| 6358 | +!! end |
| 6359 | + |
| 6360 | + |
| 6361 | +!! test |
| 6362 | +Section extraction, heading followed by pre with 20 spaces (bug 6398) |
| 6363 | +!! options |
| 6364 | +section=1 |
| 6365 | +!! input |
| 6366 | +==a== |
| 6367 | + a |
| 6368 | +!! result |
| 6369 | +==a== |
| 6370 | + a |
| 6371 | +!! end |
| 6372 | + |
| 6373 | +!! test |
| 6374 | +Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check) |
| 6375 | +!! options |
| 6376 | +section=1 |
| 6377 | +!! input |
| 6378 | +==a== |
| 6379 | + a |
| 6380 | +!! result |
| 6381 | +==a== |
| 6382 | + a |
| 6383 | +!! end |
| 6384 | + |
| 6385 | + |
| 6386 | +!! test |
| 6387 | +Section extraction, <pre> around bogus header (bug 10309) |
| 6388 | +!! options |
| 6389 | +noxml section=2 |
| 6390 | +!! input |
| 6391 | +== Section One == |
| 6392 | +<pre> |
| 6393 | +======= |
| 6394 | +</pre> |
| 6395 | + |
| 6396 | +== Section Two == |
| 6397 | +stuff |
| 6398 | +!! result |
| 6399 | +== Section Two == |
| 6400 | +stuff |
| 6401 | +!! end |
| 6402 | + |
| 6403 | +!! test |
| 6404 | +Section replacement, <pre> around bogus header (bug 10309) |
| 6405 | +!! options |
| 6406 | +noxml replace=2,"xxx" |
| 6407 | +!! input |
| 6408 | +== Section One == |
| 6409 | +<pre> |
| 6410 | +======= |
| 6411 | +</pre> |
| 6412 | + |
| 6413 | +== Section Two == |
| 6414 | +stuff |
| 6415 | +!! result |
| 6416 | +== Section One == |
| 6417 | +<pre> |
| 6418 | +======= |
| 6419 | +</pre> |
| 6420 | + |
| 6421 | +xxx |
| 6422 | +!! end |
| 6423 | + |
| 6424 | + |
| 6425 | + |
| 6426 | +!! test |
| 6427 | +Handling of 
 in URLs |
| 6428 | +!! input |
| 6429 | +**irc://
a |
| 6430 | +!! result |
| 6431 | +<ul><li><ul><li><a href="irc://%0Aa" class="external free" rel="nofollow">irc://%0Aa</a> |
| 6432 | +</li></ul> |
| 6433 | +</li></ul> |
| 6434 | + |
| 6435 | +!!end |
| 6436 | + |
| 6437 | +!! test |
| 6438 | +5 quotes, code coverage +1 line |
| 6439 | +!! input |
| 6440 | +''''' |
| 6441 | +!! result |
| 6442 | +!! end |
| 6443 | + |
| 6444 | +!! test |
| 6445 | +Special:Search page linking. |
| 6446 | +!! input |
| 6447 | +{{Special:search}} |
| 6448 | +!! result |
| 6449 | +<p><a href="https://www.mediawiki.org/wiki/Special:Search" title="Special:Search">Special:Search</a> |
| 6450 | +</p> |
| 6451 | +!! end |
| 6452 | + |
| 6453 | +!! test |
| 6454 | +Say the magic word |
| 6455 | +!! input |
| 6456 | +* {{PAGENAME}} |
| 6457 | +* {{BASEPAGENAME}} |
| 6458 | +* {{SUBPAGENAME}} |
| 6459 | +* {{SUBPAGENAMEE}} |
| 6460 | +* {{BASEPAGENAME}} |
| 6461 | +* {{BASEPAGENAMEE}} |
| 6462 | +* {{TALKPAGENAME}} |
| 6463 | +* {{TALKPAGENAMEE}} |
| 6464 | +* {{SUBJECTPAGENAME}} |
| 6465 | +* {{SUBJECTPAGENAMEE}} |
| 6466 | +* {{NAMESPACEE}} |
| 6467 | +* {{NAMESPACE}} |
| 6468 | +* {{TALKSPACE}} |
| 6469 | +* {{TALKSPACEE}} |
| 6470 | +* {{SUBJECTSPACE}} |
| 6471 | +* {{SUBJECTSPACEE}} |
| 6472 | +* {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}} |
| 6473 | +!! result |
| 6474 | +<ul><li> Parser test |
| 6475 | +</li><li> Parser test |
| 6476 | +</li><li> Parser test |
| 6477 | +</li><li> Parser_test |
| 6478 | +</li><li> Parser test |
| 6479 | +</li><li> Parser_test |
| 6480 | +</li><li> Talk:Parser test |
| 6481 | +</li><li> Talk:Parser_test |
| 6482 | +</li><li> Parser test |
| 6483 | +</li><li> Parser_test |
| 6484 | +</li><li> |
| 6485 | +</li><li> |
| 6486 | +</li><li> Talk |
| 6487 | +</li><li> Talk |
| 6488 | +</li><li> |
| 6489 | +</li><li> |
| 6490 | +</li><li> <a href="https://www.mediawiki.org/index.php?title=Template:Dynamic&action=edit&redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a> |
| 6491 | +</li></ul> |
| 6492 | + |
| 6493 | +!! end |
| 6494 | +### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included. |
| 6495 | + |
| 6496 | +!! test |
| 6497 | +Gallery |
| 6498 | +!! input |
| 6499 | +<gallery> |
| 6500 | +image1.png | |
| 6501 | +image2.gif||||| |
| 6502 | + |
| 6503 | +image3| |
| 6504 | +image4 |300px| centre |
| 6505 | + image5.svg| http:///////// |
| 6506 | +[[x|xx]]]] |
| 6507 | +* image6 |
| 6508 | +</gallery> |
| 6509 | +!! result |
| 6510 | +<table class="gallery" cellspacing="0" cellpadding="0"> |
| 6511 | + <tr> |
| 6512 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6513 | + <div style="height: 152px;">Image1.png</div> |
| 6514 | + <div class="gallerytext"> |
| 6515 | + </div> |
| 6516 | + </div></td> |
| 6517 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6518 | + <div style="height: 152px;">Image2.gif</div> |
| 6519 | + <div class="gallerytext"> |
| 6520 | +<p>|||| |
| 6521 | +</p> |
| 6522 | + </div> |
| 6523 | + </div></td> |
| 6524 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6525 | + <div style="height: 152px;">Image3</div> |
| 6526 | + <div class="gallerytext"> |
| 6527 | + </div> |
| 6528 | + </div></td> |
| 6529 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6530 | + <div style="height: 152px;">Image4</div> |
| 6531 | + <div class="gallerytext"> |
| 6532 | +<p>300px| centre |
| 6533 | +</p> |
| 6534 | + </div> |
| 6535 | + </div></td> |
| 6536 | + </tr> |
| 6537 | + <tr> |
| 6538 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6539 | + <div style="height: 152px;">Image5.svg</div> |
| 6540 | + <div class="gallerytext"> |
| 6541 | +<p><a href="http://///////" class="external free" rel="nofollow">http://///////</a> |
| 6542 | +</p> |
| 6543 | + </div> |
| 6544 | + </div></td> |
| 6545 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6546 | + <div style="height: 152px;">* image6</div> |
| 6547 | + <div class="gallerytext"> |
| 6548 | + </div> |
| 6549 | + </div></td> |
| 6550 | + </tr> |
| 6551 | +</table> |
| 6552 | + |
| 6553 | +!! end |
| 6554 | + |
| 6555 | +!! test |
| 6556 | +Gallery (with options) |
| 6557 | +!! input |
| 6558 | +<gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' > |
| 6559 | +File:Nonexistant.jpg|caption |
| 6560 | +File:Nonexistant.jpg |
| 6561 | +image:foobar.jpg|some '''caption''' [[Main Page]] |
| 6562 | +image:foobar.jpg |
| 6563 | +</gallery> |
| 6564 | +!! result |
| 6565 | +<table class="gallery" cellspacing="0" cellpadding="0"> |
| 6566 | + <caption>Foo <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a></caption> |
| 6567 | + <tr> |
| 6568 | + <td><div class="gallerybox" style="width: 95px;"> |
| 6569 | + <div style="height: 52px;">Nonexistant.jpg</div> |
| 6570 | + <div class="gallerytext"> |
| 6571 | +<p>caption |
| 6572 | +</p> |
| 6573 | + </div> |
| 6574 | + </div></td> |
| 6575 | + <td><div class="gallerybox" style="width: 95px;"> |
| 6576 | + <div style="height: 52px;">Nonexistant.jpg</div> |
| 6577 | + <div class="gallerytext"> |
| 6578 | + </div> |
| 6579 | + </div></td> |
| 6580 | + </tr> |
| 6581 | + <tr> |
| 6582 | + <td><div class="gallerybox" style="width: 95px;"> |
| 6583 | + <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div> |
| 6584 | + <div class="gallerytext"> |
| 6585 | +<p>some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
| 6586 | +</p> |
| 6587 | + </div> |
| 6588 | + </div></td> |
| 6589 | + <td><div class="gallerybox" style="width: 95px;"> |
| 6590 | + <div class="thumb" style="padding: 19px 0; width: 90px;"><div style="margin-left: auto; margin-right: auto; width: 60px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="60" height="7" /></a></div></div> |
| 6591 | + <div class="gallerytext"> |
| 6592 | + </div> |
| 6593 | + </div></td> |
| 6594 | + </tr> |
| 6595 | +</table> |
| 6596 | + |
| 6597 | +!! end |
| 6598 | + |
| 6599 | +!! test |
| 6600 | +gallery (with showfilename option) |
| 6601 | +!! input |
| 6602 | +<gallery showfilename> |
| 6603 | +File:Nonexistant.jpg|caption |
| 6604 | +File:Nonexistant.jpg |
| 6605 | +image:foobar.jpg|some '''caption''' [[Main Page]] |
| 6606 | +File:Foobar.jpg |
| 6607 | +</gallery> |
| 6608 | +!! result |
| 6609 | +<table class="gallery" cellspacing="0" cellpadding="0"> |
| 6610 | + <tr> |
| 6611 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6612 | + <div style="height: 152px;">Nonexistant.jpg</div> |
| 6613 | + <div class="gallerytext"> |
| 6614 | +<p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> |
| 6615 | +caption |
| 6616 | +</p> |
| 6617 | + </div> |
| 6618 | + </div></td> |
| 6619 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6620 | + <div style="height: 152px;">Nonexistant.jpg</div> |
| 6621 | + <div class="gallerytext"> |
| 6622 | +<p><a href="https://www.mediawiki.org/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br /> |
| 6623 | +</p> |
| 6624 | + </div> |
| 6625 | + </div></td> |
| 6626 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6627 | + <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 6628 | + <div class="gallerytext"> |
| 6629 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
| 6630 | +some <b>caption</b> <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> |
| 6631 | +</p> |
| 6632 | + </div> |
| 6633 | + </div></td> |
| 6634 | + <td><div class="gallerybox" style="width: 155px;"> |
| 6635 | + <div class="thumb" style="padding: 66px 0; width: 150px;"><div style="margin-left: auto; margin-right: auto; width: 120px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="120" height="14" /></a></div></div> |
| 6636 | + <div class="gallerytext"> |
| 6637 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br /> |
| 6638 | +</p> |
| 6639 | + </div> |
| 6640 | + </div></td> |
| 6641 | + </tr> |
| 6642 | +</table> |
| 6643 | + |
| 6644 | +!! end |
| 6645 | + |
| 6646 | +!! test |
| 6647 | +HTML Hex character encoding (spells the word "JavaScript") |
| 6648 | +!! input |
| 6649 | +JavaScript |
| 6650 | +!! result |
| 6651 | +<p>JavaScript |
| 6652 | +</p> |
| 6653 | +!! end |
| 6654 | + |
| 6655 | +!! test |
| 6656 | +__FORCETOC__ override |
| 6657 | +!! input |
| 6658 | +__NEWSECTIONLINK__ |
| 6659 | +__FORCETOC__ |
| 6660 | +!! result |
| 6661 | +<p><br /> |
| 6662 | +</p> |
| 6663 | +!! end |
| 6664 | + |
| 6665 | +!! test |
| 6666 | +ISBN code coverage |
| 6667 | +!! input |
| 6668 | +ISBN 978-0-1234-56 789 |
| 6669 | +!! result |
| 6670 | +<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789 |
| 6671 | +</p> |
| 6672 | +!! end |
| 6673 | + |
| 6674 | +!! test |
| 6675 | +ISBN followed by 5 spaces |
| 6676 | +!! input |
| 6677 | +ISBN |
| 6678 | +!! result |
| 6679 | +<p>ISBN |
| 6680 | +</p> |
| 6681 | +!! end |
| 6682 | + |
| 6683 | +!! test |
| 6684 | +Double ISBN |
| 6685 | +!! input |
| 6686 | +ISBN ISBN 1234567890 |
| 6687 | +!! result |
| 6688 | +<p>ISBN <a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a> |
| 6689 | +</p> |
| 6690 | +!! end |
| 6691 | + |
| 6692 | +!! test |
| 6693 | +Bug 22905: <abbr> followed by ISBN followed by </a> |
| 6694 | +!! input |
| 6695 | +<abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com] |
| 6696 | +!! result |
| 6697 | +<p><abbr>(fr)</abbr> <a href="https://www.mediawiki.org/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a href="http://www.example.com" class="external text" rel="nofollow">example.com</a> |
| 6698 | +</p> |
| 6699 | +!! end |
| 6700 | + |
| 6701 | +!! test |
| 6702 | +Double RFC |
| 6703 | +!! input |
| 6704 | +RFC RFC 1234 |
| 6705 | +!! result |
| 6706 | +<p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external mw-magiclink-rfc">RFC 1234</a> |
| 6707 | +</p> |
| 6708 | +!! end |
| 6709 | + |
| 6710 | +!! test |
| 6711 | +Double RFC with a wiki link |
| 6712 | +!! input |
| 6713 | +RFC [[RFC 1234]] |
| 6714 | +!! result |
| 6715 | +<p>RFC <a href="https://www.mediawiki.org/index.php?title=RFC_1234&action=edit&redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a> |
| 6716 | +</p> |
| 6717 | +!! end |
| 6718 | + |
| 6719 | +!! test |
| 6720 | +RFC code coverage |
| 6721 | +!! input |
| 6722 | +RFC 983 987 |
| 6723 | +!! result |
| 6724 | +<p><a href="http://tools.ietf.org/html/rfc983" class="external mw-magiclink-rfc">RFC 983</a> 987 |
| 6725 | +</p> |
| 6726 | +!! end |
| 6727 | + |
| 6728 | +!! test |
| 6729 | +Centre-aligned image |
| 6730 | +!! input |
| 6731 | +[[Image:foobar.jpg|centre]] |
| 6732 | +!! result |
| 6733 | +<div class="center"><div class="floatnone"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div> |
| 6734 | + |
| 6735 | +!!end |
| 6736 | + |
| 6737 | +!! test |
| 6738 | +None-aligned image |
| 6739 | +!! input |
| 6740 | +[[Image:foobar.jpg|none]] |
| 6741 | +!! result |
| 6742 | +<div class="floatnone"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div> |
| 6743 | + |
| 6744 | +!!end |
| 6745 | + |
| 6746 | +!! test |
| 6747 | +Width + Height sized image (using px) (height is ignored) |
| 6748 | +!! input |
| 6749 | +[[Image:foobar.jpg|640x480px]] |
| 6750 | +!! result |
| 6751 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
| 6752 | +</p> |
| 6753 | +!!end |
| 6754 | + |
| 6755 | +!! test |
| 6756 | +Width-sized image (using px, no following whitespace) |
| 6757 | +!! input |
| 6758 | +[[Image:foobar.jpg|640px]] |
| 6759 | +!! result |
| 6760 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
| 6761 | +</p> |
| 6762 | +!!end |
| 6763 | + |
| 6764 | +!! test |
| 6765 | +Width-sized image (using px, with following whitespace - test regression from r39467) |
| 6766 | +!! input |
| 6767 | +[[Image:foobar.jpg|640px ]] |
| 6768 | +!! result |
| 6769 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
| 6770 | +</p> |
| 6771 | +!!end |
| 6772 | + |
| 6773 | +!! test |
| 6774 | +Width-sized image (using px, with preceding whitespace - test regression from r39467) |
| 6775 | +!! input |
| 6776 | +[[Image:foobar.jpg| 640px]] |
| 6777 | +!! result |
| 6778 | +<p><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="640" height="73" /></a> |
| 6779 | +</p> |
| 6780 | +!!end |
| 6781 | + |
| 6782 | +!! test |
| 6783 | +Another italics / bold test |
| 6784 | +!! input |
| 6785 | + ''' ''x' |
| 6786 | +!! result |
| 6787 | +<pre>'<i> </i>x' |
| 6788 | +</pre> |
| 6789 | +!!end |
| 6790 | + |
| 6791 | +# Note the results may be incorrect, as parserTest output included this: |
| 6792 | +# XML error: Mismatched tag at byte 6120: |
| 6793 | +# ...<dd> </dt></dl> </dd... |
| 6794 | +!! test |
| 6795 | +dt/dd/dl test |
| 6796 | +!! options |
| 6797 | +disabled |
| 6798 | +!! input |
| 6799 | +:;;;:: |
| 6800 | +!! result |
| 6801 | +<dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd> |
| 6802 | +</dd></dl> |
| 6803 | +</dd></dl> |
| 6804 | +</dt></dl> |
| 6805 | +</dt></dl> |
| 6806 | +</dt></dl> |
| 6807 | +</dd></dl> |
| 6808 | + |
| 6809 | +!!end |
| 6810 | + |
| 6811 | + |
| 6812 | +# Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag. |
| 6813 | +!! test |
| 6814 | +Images with the "|" character in the comment |
| 6815 | +!! input |
| 6816 | +[[image:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]] |
| 6817 | +!! result |
| 6818 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a href="http://test/?param1=%7Cleft%7C&param2=%7Cx" class="external text" rel="nofollow">external</a> URL</div></div></div> |
| 6819 | + |
| 6820 | +!!end |
| 6821 | + |
| 6822 | +!! test |
| 6823 | +[Before] HTML without raw HTML enabled ($wgRawHtml==false) |
| 6824 | +!! input |
| 6825 | +<html><script>alert(1);</script></html> |
| 6826 | +!! result |
| 6827 | +<p><html><script>alert(1);</script></html> |
| 6828 | +</p> |
| 6829 | +!! end |
| 6830 | + |
| 6831 | +!! test |
| 6832 | +HTML with raw HTML ($wgRawHtml==true) |
| 6833 | +!! options |
| 6834 | +rawhtml |
| 6835 | +!! input |
| 6836 | +<html><script>alert(1);</script></html> |
| 6837 | +!! result |
| 6838 | +<p><script>alert(1);</script> |
| 6839 | +</p> |
| 6840 | +!! end |
| 6841 | + |
| 6842 | +!! test |
| 6843 | +Parents of subpages, one level up |
| 6844 | +!! options |
| 6845 | +subpage title=[[Subpage test/L1/L2/L3]] |
| 6846 | +!! input |
| 6847 | +[[../|L2]] |
| 6848 | +!! result |
| 6849 | +<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a> |
| 6850 | +</p> |
| 6851 | +!! end |
| 6852 | + |
| 6853 | + |
| 6854 | +!! test |
| 6855 | +Parents of subpages, one level up, not named |
| 6856 | +!! options |
| 6857 | +subpage title=[[Subpage test/L1/L2/L3]] |
| 6858 | +!! input |
| 6859 | +[[../]] |
| 6860 | +!! result |
| 6861 | +<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a> |
| 6862 | +</p> |
| 6863 | +!! end |
| 6864 | + |
| 6865 | + |
| 6866 | + |
| 6867 | +!! test |
| 6868 | +Parents of subpages, two levels up |
| 6869 | +!! options |
| 6870 | +subpage title=[[Subpage test/L1/L2/L3]] |
| 6871 | +!! input |
| 6872 | +[[../../|L1]]2 |
| 6873 | + |
| 6874 | +[[../../|L1]]l |
| 6875 | +!! result |
| 6876 | +<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2 |
| 6877 | +</p><p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a> |
| 6878 | +</p> |
| 6879 | +!! end |
| 6880 | + |
| 6881 | +!! test |
| 6882 | +Parents of subpages, two levels up, without trailing slash or name. |
| 6883 | +!! options |
| 6884 | +subpage title=[[Subpage test/L1/L2/L3]] |
| 6885 | +!! input |
| 6886 | +[[../..]] |
| 6887 | +!! result |
| 6888 | +<p>[[../..]] |
| 6889 | +</p> |
| 6890 | +!! end |
| 6891 | + |
| 6892 | +!! test |
| 6893 | +Parents of subpages, two levels up, with lots of extra trailing slashes. |
| 6894 | +!! options |
| 6895 | +subpage title=[[Subpage test/L1/L2/L3]] |
| 6896 | +!! input |
| 6897 | +[[../../////]] |
| 6898 | +!! result |
| 6899 | +<p><a href="https://www.mediawiki.org/index.php?title=Subpage_test/L1////&action=edit&redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a> |
| 6900 | +</p> |
| 6901 | +!! end |
| 6902 | + |
| 6903 | +!! test |
| 6904 | +Definition list code coverage |
| 6905 | +!! input |
| 6906 | +; title : def |
| 6907 | +; title : def |
| 6908 | +;title: def |
| 6909 | +!! result |
| 6910 | +<dl><dt> title  </dt><dd> def |
| 6911 | +</dd><dt> title </dt><dd> def |
| 6912 | +</dd><dt>title</dt><dd> def |
| 6913 | +</dd></dl> |
| 6914 | + |
| 6915 | +!! end |
| 6916 | + |
| 6917 | +!! test |
| 6918 | +Don't fall for the self-closing div |
| 6919 | +!! input |
| 6920 | +<div>hello world</div/> |
| 6921 | +!! result |
| 6922 | +<div>hello world</div> |
| 6923 | + |
| 6924 | +!! end |
| 6925 | + |
| 6926 | +!! test |
| 6927 | +MSGNW magic word |
| 6928 | +!! input |
| 6929 | +{{MSGNW:msg}} |
| 6930 | +!! result |
| 6931 | +<p>[[:Template:Msg]] |
| 6932 | +</p> |
| 6933 | +!! end |
| 6934 | + |
| 6935 | +!! test |
| 6936 | +RAW magic word |
| 6937 | +!! input |
| 6938 | +{{RAW:QUERTY}} |
| 6939 | +!! result |
| 6940 | +<p><a href="https://www.mediawiki.org/index.php?title=Template:QUERTY&action=edit&redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a> |
| 6941 | +</p> |
| 6942 | +!! end |
| 6943 | + |
| 6944 | +# This isn't needed for XHTML conformance, but would be handy as a fallback security measure |
| 6945 | +!! test |
| 6946 | +Always escape literal '>' in output, not just after '<' |
| 6947 | +!! input |
| 6948 | +><> |
| 6949 | +!! result |
| 6950 | +<p>><> |
| 6951 | +</p> |
| 6952 | +!! end |
| 6953 | + |
| 6954 | +!! test |
| 6955 | +Template caching |
| 6956 | +!! input |
| 6957 | +{{Test}} |
| 6958 | +{{Test}} |
| 6959 | +!! result |
| 6960 | +<p>This is a test template |
| 6961 | +This is a test template |
| 6962 | +</p> |
| 6963 | +!! end |
| 6964 | + |
| 6965 | + |
| 6966 | +!! article |
| 6967 | +MediaWiki:Fake |
| 6968 | +!! text |
| 6969 | +==header== |
| 6970 | +!! endarticle |
| 6971 | + |
| 6972 | +!! test |
| 6973 | +Inclusion of !userCanEdit() content |
| 6974 | +!! input |
| 6975 | +{{MediaWiki:Fake}} |
| 6976 | +!! result |
| 6977 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=MediaWiki:Fake&action=edit&section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2> |
| 6978 | + |
| 6979 | +!! end |
| 6980 | + |
| 6981 | + |
| 6982 | +!! test |
| 6983 | +Out-of-order TOC heading levels |
| 6984 | +!! input |
| 6985 | +==2== |
| 6986 | +======6====== |
| 6987 | +===3=== |
| 6988 | +=1= |
| 6989 | +=====5===== |
| 6990 | +==2== |
| 6991 | +!! result |
| 6992 | +<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div> |
| 6993 | +<ul> |
| 6994 | +<li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a> |
| 6995 | +<ul> |
| 6996 | +<li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li> |
| 6997 | +<li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li> |
| 6998 | +</ul> |
| 6999 | +</li> |
| 7000 | +<li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a> |
| 7001 | +<ul> |
| 7002 | +<li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li> |
| 7003 | +<li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li> |
| 7004 | +</ul> |
| 7005 | +</li> |
| 7006 | +</ul> |
| 7007 | +</td></tr></table> |
| 7008 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2> |
| 7009 | +<h6><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6> |
| 7010 | +<h3><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3> |
| 7011 | +<h1><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1> |
| 7012 | +<h5><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5> |
| 7013 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2> |
| 7014 | + |
| 7015 | +!! end |
| 7016 | + |
| 7017 | + |
| 7018 | +!! test |
| 7019 | +ISBN with a dummy number |
| 7020 | +!! input |
| 7021 | +ISBN --- |
| 7022 | +!! result |
| 7023 | +<p>ISBN --- |
| 7024 | +</p> |
| 7025 | +!! end |
| 7026 | + |
| 7027 | + |
| 7028 | +!! test |
| 7029 | +ISBN with space-delimited number |
| 7030 | +!! input |
| 7031 | +ISBN 92 9017 032 8 |
| 7032 | +!! result |
| 7033 | +<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a> |
| 7034 | +</p> |
| 7035 | +!! end |
| 7036 | + |
| 7037 | + |
| 7038 | +!! test |
| 7039 | +ISBN with multiple spaces, no number |
| 7040 | +!! input |
| 7041 | +ISBN foo |
| 7042 | +!! result |
| 7043 | +<p>ISBN foo |
| 7044 | +</p> |
| 7045 | +!! end |
| 7046 | + |
| 7047 | + |
| 7048 | +!! test |
| 7049 | +ISBN length |
| 7050 | +!! input |
| 7051 | +ISBN 123456789 |
| 7052 | + |
| 7053 | +ISBN 1234567890 |
| 7054 | + |
| 7055 | +ISBN 12345678901 |
| 7056 | +!! result |
| 7057 | +<p>ISBN 123456789 |
| 7058 | +</p><p><a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a> |
| 7059 | +</p><p>ISBN 12345678901 |
| 7060 | +</p> |
| 7061 | +!! end |
| 7062 | + |
| 7063 | + |
| 7064 | +!! test |
| 7065 | +ISBN with trailing year (bug 8110) |
| 7066 | +!! input |
| 7067 | +ISBN 1-234-56789-0 - 2006 |
| 7068 | + |
| 7069 | +ISBN 1 234 56789 0 - 2006 |
| 7070 | +!! result |
| 7071 | +<p><a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006 |
| 7072 | +</p><p><a href="https://www.mediawiki.org/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006 |
| 7073 | +</p> |
| 7074 | +!! end |
| 7075 | + |
| 7076 | + |
| 7077 | +!! test |
| 7078 | +anchorencode |
| 7079 | +!! input |
| 7080 | +{{anchorencode:foo bar©#%n}} |
| 7081 | +!! result |
| 7082 | +<p>foo_bar.C2.A9.23.25n |
| 7083 | +</p> |
| 7084 | +!! end |
| 7085 | + |
| 7086 | +!! test |
| 7087 | +anchorencode trims spaces |
| 7088 | +!! input |
| 7089 | +{{anchorencode: __pretty__please__}} |
| 7090 | +!! result |
| 7091 | +<p>pretty_please |
| 7092 | +</p> |
| 7093 | +!! end |
| 7094 | + |
| 7095 | +!! test |
| 7096 | +anchorencode deals with links |
| 7097 | +!! input |
| 7098 | +{{anchorencode: [[hello|world]] [[hi]]}} |
| 7099 | +!! result |
| 7100 | +<p>world_hi |
| 7101 | +</p> |
| 7102 | +!! end |
| 7103 | + |
| 7104 | +!! test |
| 7105 | +anchorencode deals with templates |
| 7106 | +!! input |
| 7107 | +{{anchorencode: {{Foo}} }} |
| 7108 | +!! result |
| 7109 | +<p>FOO |
| 7110 | +</p> |
| 7111 | +!! end |
| 7112 | + |
| 7113 | +!! test |
| 7114 | +anchorencode encodes like the TOC generator: (bug 18431) |
| 7115 | +!! input |
| 7116 | +=== _ +:.3A%3A&&]] === |
| 7117 | +{{anchorencode: _ +:.3A%3A&&]] }} |
| 7118 | +__NOEDITSECTION__ |
| 7119 | +!! result |
| 7120 | +<h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&&]] </span></h3> |
| 7121 | +<p>.2B:.3A.253A.26.26.5D.5D |
| 7122 | +</p> |
| 7123 | +!! end |
| 7124 | + |
| 7125 | +# Expected output in the following test is not necessarily expected (there |
| 7126 | +# should probably be <p> tags inside the <blockquote> in the output) -- it's |
| 7127 | +# only testing for well-formedness. |
| 7128 | +!! test |
| 7129 | +Bug 6200: blockquotes and paragraph formatting |
| 7130 | +!! input |
| 7131 | +<blockquote> |
| 7132 | +foo |
| 7133 | +</blockquote> |
| 7134 | + |
| 7135 | +bar |
| 7136 | + |
| 7137 | + baz |
| 7138 | +!! result |
| 7139 | +<blockquote> |
| 7140 | +foo |
| 7141 | +</blockquote> |
| 7142 | +<p>bar |
| 7143 | +</p> |
| 7144 | +<pre>baz |
| 7145 | +</pre> |
| 7146 | +!! end |
| 7147 | + |
| 7148 | +!! test |
| 7149 | +Bug 8293: Use of center tag ruins paragraph formatting |
| 7150 | +!! input |
| 7151 | +<center> |
| 7152 | +foo |
| 7153 | +</center> |
| 7154 | + |
| 7155 | +bar |
| 7156 | + |
| 7157 | + baz |
| 7158 | +!! result |
| 7159 | +<center> |
| 7160 | +<p>foo |
| 7161 | +</p> |
| 7162 | +</center> |
| 7163 | +<p>bar |
| 7164 | +</p> |
| 7165 | +<pre>baz |
| 7166 | +</pre> |
| 7167 | +!! end |
| 7168 | + |
| 7169 | + |
| 7170 | +### |
| 7171 | +### Language variants related tests |
| 7172 | +### |
| 7173 | +!! test |
| 7174 | +Self-link in language variants |
| 7175 | +!! options |
| 7176 | +title=[[Dunav]] language=sr |
| 7177 | +!! input |
| 7178 | +Both [[Dunav]] and [[Дунав]] are names for this river. |
| 7179 | +!! result |
| 7180 | +<p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river. |
| 7181 | +</p> |
| 7182 | +!!end |
| 7183 | + |
| 7184 | + |
| 7185 | +!! test |
| 7186 | +Link to pages in language variants |
| 7187 | +!! options |
| 7188 | +language=sr |
| 7189 | +!! input |
| 7190 | +Main Page can be written as [[Маин Паге]] |
| 7191 | +!! result |
| 7192 | +<p>Main Page can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> |
| 7193 | +</p> |
| 7194 | +!!end |
| 7195 | + |
| 7196 | + |
| 7197 | +!! test |
| 7198 | +Multiple links to pages in language variants |
| 7199 | +!! options |
| 7200 | +language=sr |
| 7201 | +!! input |
| 7202 | +[[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]]. |
| 7203 | +!! result |
| 7204 | +<p><a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Маин Паге</a>. |
| 7205 | +</p> |
| 7206 | +!!end |
| 7207 | + |
| 7208 | + |
| 7209 | +!! test |
| 7210 | +Simple template in language variants |
| 7211 | +!! options |
| 7212 | +language=sr |
| 7213 | +!! input |
| 7214 | +{{тест}} |
| 7215 | +!! result |
| 7216 | +<p>This is a test template |
| 7217 | +</p> |
| 7218 | +!! end |
| 7219 | + |
| 7220 | + |
| 7221 | +!! test |
| 7222 | +Template with explicit namespace in language variants |
| 7223 | +!! options |
| 7224 | +language=sr |
| 7225 | +!! input |
| 7226 | +{{Template:тест}} |
| 7227 | +!! result |
| 7228 | +<p>This is a test template |
| 7229 | +</p> |
| 7230 | +!! end |
| 7231 | + |
| 7232 | + |
| 7233 | +!! test |
| 7234 | +Basic test for template parameter in language variants |
| 7235 | +!! options |
| 7236 | +language=sr |
| 7237 | +!! input |
| 7238 | +{{парамтест|param=foo}} |
| 7239 | +!! result |
| 7240 | +<p>This is a test template with parameter foo |
| 7241 | +</p> |
| 7242 | +!! end |
| 7243 | + |
| 7244 | + |
| 7245 | +!! test |
| 7246 | +Simple category in language variants |
| 7247 | +!! options |
| 7248 | +language=sr cat |
| 7249 | +!! input |
| 7250 | +[[Category:МедиаWики Усер'с Гуиде]] |
| 7251 | +!! result |
| 7252 | +<a href="https://www.mediawiki.org/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a> |
| 7253 | +!! end |
| 7254 | + |
| 7255 | + |
| 7256 | +!! test |
| 7257 | +Stripping -{}- tags (language variants) |
| 7258 | +!! options |
| 7259 | +language=sr |
| 7260 | +!! input |
| 7261 | +Latin proverb: -{Ne nuntium necare}- |
| 7262 | +!! result |
| 7263 | +<p>Latin proverb: Ne nuntium necare |
| 7264 | +</p> |
| 7265 | +!! end |
| 7266 | + |
| 7267 | + |
| 7268 | +!! test |
| 7269 | +Prevent conversion with -{}- tags (language variants) |
| 7270 | +!! options |
| 7271 | +language=sr variant=sr-ec |
| 7272 | +!! input |
| 7273 | +Latinski: -{Ne nuntium necare}- |
| 7274 | +!! result |
| 7275 | +<p>Латински: Ne nuntium necare |
| 7276 | +</p> |
| 7277 | +!! end |
| 7278 | + |
| 7279 | + |
| 7280 | +!! test |
| 7281 | +Prevent conversion of text with -{}- tags (language variants) |
| 7282 | +!! options |
| 7283 | +language=sr variant=sr-ec |
| 7284 | +!! input |
| 7285 | +Latinski: -{Ne nuntium necare}- |
| 7286 | +!! result |
| 7287 | +<p>Латински: Ne nuntium necare |
| 7288 | +</p> |
| 7289 | +!! end |
| 7290 | + |
| 7291 | + |
| 7292 | +!! test |
| 7293 | +Prevent conversion of links with -{}- tags (language variants) |
| 7294 | +!! options |
| 7295 | +language=sr variant=sr-ec |
| 7296 | +!! input |
| 7297 | +-{[[Main Page]]}- |
| 7298 | +!! result |
| 7299 | +<p><a href="https://www.mediawiki.org/index.php?title=Main_Page&variant=sr-ec" title="Main Page">Main Page</a> |
| 7300 | +</p> |
| 7301 | +!! end |
| 7302 | + |
| 7303 | + |
| 7304 | +!! test |
| 7305 | +-{}- tags within headlines (within html for parserConvert()) |
| 7306 | +!! options |
| 7307 | +language=sr variant=sr-ec |
| 7308 | +!! input |
| 7309 | +== -{Naslov}- == |
| 7310 | +!! result |
| 7311 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2> |
| 7312 | + |
| 7313 | +!! end |
| 7314 | + |
| 7315 | + |
| 7316 | +!! test |
| 7317 | +Explicit definition of language variant alternatives |
| 7318 | +!! options |
| 7319 | +language=zh variant=zh-tw |
| 7320 | +!! input |
| 7321 | +-{zh:China;zh-tw:Taiwan}-, not China |
| 7322 | +!! result |
| 7323 | +<p>Taiwan, not China |
| 7324 | +</p> |
| 7325 | +!! end |
| 7326 | + |
| 7327 | + |
| 7328 | +!! test |
| 7329 | +Explicit session-wise language variant mapping (A flag and - flag) |
| 7330 | +!! options |
| 7331 | +language=zh variant=zh-tw |
| 7332 | +!! input |
| 7333 | +Taiwan is not China. |
| 7334 | +But -{A|zh:China;zh-tw:Taiwan}- is China, |
| 7335 | +(This-{-|zh:China;zh-tw:Taiwan}- should be stripped!) |
| 7336 | +and -{China}- is China. |
| 7337 | +!! result |
| 7338 | +<p>Taiwan is not China. |
| 7339 | +But Taiwan is Taiwan, |
| 7340 | +(This should be stripped!) |
| 7341 | +and China is China. |
| 7342 | +</p> |
| 7343 | +!! end |
| 7344 | + |
| 7345 | +!! test |
| 7346 | +Explicit session-wise language variant mapping (H flag for hide) |
| 7347 | +!! options |
| 7348 | +language=zh variant=zh-tw |
| 7349 | +!! input |
| 7350 | +(This-{H|zh:China;zh-tw:Taiwan}- should be stripped!) |
| 7351 | +Taiwan is China. |
| 7352 | +!! result |
| 7353 | +<p>(This should be stripped!) |
| 7354 | +Taiwan is Taiwan. |
| 7355 | +</p> |
| 7356 | +!! end |
| 7357 | + |
| 7358 | +!! test |
| 7359 | +Adding explicit conversion rule for title (T flag) |
| 7360 | +!! options |
| 7361 | +language=zh variant=zh-tw showtitle |
| 7362 | +!! input |
| 7363 | +Should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
| 7364 | +!! result |
| 7365 | +Taiwan |
| 7366 | +<p>Should be stripped! |
| 7367 | +</p> |
| 7368 | +!! end |
| 7369 | + |
| 7370 | +!! test |
| 7371 | +Testing that changing the language variant here in the tests actually works |
| 7372 | +!! options |
| 7373 | +language=zh variant=zh showtitle |
| 7374 | +!! input |
| 7375 | +Should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
| 7376 | +!! result |
| 7377 | +China |
| 7378 | +<p>Should be stripped! |
| 7379 | +</p> |
| 7380 | +!! end |
| 7381 | + |
| 7382 | +!! test |
| 7383 | +Bug 24072: more test on conversion rule for title |
| 7384 | +!! options |
| 7385 | +language=zh variant=zh-tw showtitle |
| 7386 | +!! input |
| 7387 | +This should be stripped-{T|zh:China;zh-tw:Taiwan}-! |
| 7388 | +This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-. |
| 7389 | +!! result |
| 7390 | +Taiwan |
| 7391 | +<p>This should be stripped! |
| 7392 | +This won't take interferes with the title rule. |
| 7393 | +</p> |
| 7394 | +!! end |
| 7395 | + |
| 7396 | +!! test |
| 7397 | +Raw output of variant escape tags (R flag) |
| 7398 | +!! options |
| 7399 | +language=zh variant=zh-tw |
| 7400 | +!! input |
| 7401 | +Raw: -{R|zh:China;zh-tw:Taiwan}- |
| 7402 | +!! result |
| 7403 | +<p>Raw: zh:China;zh-tw:Taiwan |
| 7404 | +</p> |
| 7405 | +!! end |
| 7406 | + |
| 7407 | +!! test |
| 7408 | +Nested using of manual convert syntax |
| 7409 | +!! options |
| 7410 | +language=zh variant=zh-hk |
| 7411 | +!! input |
| 7412 | +Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-! |
| 7413 | +!! result |
| 7414 | +<p>Nested: Hello Hong Kong! |
| 7415 | +</p> |
| 7416 | +!! end |
| 7417 | + |
| 7418 | +!! test |
| 7419 | +Do not convert roman numbers to language variants |
| 7420 | +!! options |
| 7421 | +language=sr variant=sr-ec |
| 7422 | +!! input |
| 7423 | +Fridrih IV je car. |
| 7424 | +!! result |
| 7425 | +<p>Фридрих IV је цар. |
| 7426 | +</p> |
| 7427 | +!! end |
| 7428 | + |
| 7429 | +!! test |
| 7430 | +Unclosed language converter markup "-{" |
| 7431 | +!! options |
| 7432 | +language=sr |
| 7433 | +!! input |
| 7434 | +-{T|hello |
| 7435 | +!! result |
| 7436 | +<p>-{T|hello |
| 7437 | +</p> |
| 7438 | +!! end |
| 7439 | + |
| 7440 | +!! test |
| 7441 | +Don't convert raw rule "-{R|=>}-" to "=>" |
| 7442 | +!! options |
| 7443 | +language=sr |
| 7444 | +!! input |
| 7445 | +-{R|=>}- |
| 7446 | +!! result |
| 7447 | +<p>=> |
| 7448 | +</p> |
| 7449 | +!!end |
| 7450 | + |
| 7451 | +!!article |
| 7452 | +Template:Bullet |
| 7453 | +!!text |
| 7454 | +* Bar |
| 7455 | +!!endarticle |
| 7456 | + |
| 7457 | +!! test |
| 7458 | +Bug 529: Uncovered bullet |
| 7459 | +!! input |
| 7460 | +* Foo {{bullet}} |
| 7461 | +!! result |
| 7462 | +<ul><li> Foo |
| 7463 | +</li><li> Bar |
| 7464 | +</li></ul> |
| 7465 | + |
| 7466 | +!! end |
| 7467 | + |
| 7468 | +!! test |
| 7469 | +Bug 529: Uncovered table already at line-start |
| 7470 | +!! input |
| 7471 | +x |
| 7472 | + |
| 7473 | +{{table}} |
| 7474 | +y |
| 7475 | +!! result |
| 7476 | +<p>x |
| 7477 | +</p> |
| 7478 | +<table> |
| 7479 | +<tr> |
| 7480 | +<td> 1 </td> |
| 7481 | +<td> 2 |
| 7482 | +</td></tr> |
| 7483 | +<tr> |
| 7484 | +<td> 3 </td> |
| 7485 | +<td> 4 |
| 7486 | +</td></tr></table> |
| 7487 | +<p>y |
| 7488 | +</p> |
| 7489 | +!! end |
| 7490 | + |
| 7491 | +!! test |
| 7492 | +Bug 529: Uncovered bullet in parser function result |
| 7493 | +!! input |
| 7494 | +* Foo {{lc:{{bullet}} }} |
| 7495 | +!! result |
| 7496 | +<ul><li> Foo |
| 7497 | +</li><li> bar |
| 7498 | +</li></ul> |
| 7499 | + |
| 7500 | +!! end |
| 7501 | + |
| 7502 | +!! test |
| 7503 | +Bug 5678: Double-parsed template argument |
| 7504 | +!! input |
| 7505 | +{{lc:{{{1}}}|hello}} |
| 7506 | +!! result |
| 7507 | +<p>{{{1}}} |
| 7508 | +</p> |
| 7509 | +!! end |
| 7510 | + |
| 7511 | +!! test |
| 7512 | +Bug 5678: Double-parsed template invocation |
| 7513 | +!! input |
| 7514 | +{{lc:{{paramtest {{!}} param = hello }} }} |
| 7515 | +!! result |
| 7516 | +<p>{{paramtest | param = hello }} |
| 7517 | +</p> |
| 7518 | +!! end |
| 7519 | + |
| 7520 | +!! test |
| 7521 | +Case insensitivity of parser functions for non-ASCII characters (bug 8143) |
| 7522 | +!! options |
| 7523 | +language=cs |
| 7524 | +title=[[Main Page]] |
| 7525 | +!! input |
| 7526 | +{{PRVNÍVELKÉ:ěščř}} |
| 7527 | +{{prvnívelké:ěščř}} |
| 7528 | +{{PRVNÍMALÉ:ěščř}} |
| 7529 | +{{prvnímalé:ěščř}} |
| 7530 | +{{MALÁ:ěščř}} |
| 7531 | +{{malá:ěščř}} |
| 7532 | +{{VELKÁ:ěščř}} |
| 7533 | +{{velká:ěščř}} |
| 7534 | +!! result |
| 7535 | +<p>Ěščř |
| 7536 | +Ěščř |
| 7537 | +ěščř |
| 7538 | +ěščř |
| 7539 | +ěščř |
| 7540 | +ěščř |
| 7541 | +ĚŠČŘ |
| 7542 | +ĚŠČŘ |
| 7543 | +</p> |
| 7544 | +!! end |
| 7545 | + |
| 7546 | +!! test |
| 7547 | +Morwen/13: Unclosed link followed by heading |
| 7548 | +!! input |
| 7549 | +[[link |
| 7550 | +==heading== |
| 7551 | +!! result |
| 7552 | +<p>[[link |
| 7553 | +</p> |
| 7554 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2> |
| 7555 | + |
| 7556 | +!! end |
| 7557 | + |
| 7558 | +!! test |
| 7559 | +HHP2.1: Heuristics for headings in preprocessor parenthetical structures |
| 7560 | +!! input |
| 7561 | +{{foo| |
| 7562 | +=heading= |
| 7563 | +!! result |
| 7564 | +<p>{{foo| |
| 7565 | +</p> |
| 7566 | +<h1> <span class="mw-headline" id="heading">heading</span></h1> |
| 7567 | + |
| 7568 | +!! end |
| 7569 | + |
| 7570 | +!! test |
| 7571 | +HHP2.2: Heuristics for headings in preprocessor parenthetical structures |
| 7572 | +!! input |
| 7573 | +{{foo| |
| 7574 | +==heading== |
| 7575 | +!! result |
| 7576 | +<p>{{foo| |
| 7577 | +</p> |
| 7578 | +<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Parser_test&action=edit&section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2> |
| 7579 | + |
| 7580 | +!! end |
| 7581 | + |
| 7582 | +!! test |
| 7583 | +Tildes in comments |
| 7584 | +!! options |
| 7585 | +pst |
| 7586 | +!! input |
| 7587 | +<!-- ~~~~ --> |
| 7588 | +!! result |
| 7589 | +<!-- ~~~~ --> |
| 7590 | +!! end |
| 7591 | + |
| 7592 | +!! test |
| 7593 | +Paragraphs inside divs (no extra line breaks) |
| 7594 | +!! input |
| 7595 | +<div>Line one |
| 7596 | + |
| 7597 | +Line two</div> |
| 7598 | +!! result |
| 7599 | +<div>Line one |
| 7600 | +Line two</div> |
| 7601 | + |
| 7602 | +!! end |
| 7603 | + |
| 7604 | +!! test |
| 7605 | +Paragraphs inside divs (extra line break on open) |
| 7606 | +!! input |
| 7607 | +<div> |
| 7608 | +Line one |
| 7609 | + |
| 7610 | +Line two</div> |
| 7611 | +!! result |
| 7612 | +<div> |
| 7613 | +<p>Line one |
| 7614 | +</p> |
| 7615 | +Line two</div> |
| 7616 | + |
| 7617 | +!! end |
| 7618 | + |
| 7619 | +!! test |
| 7620 | +Paragraphs inside divs (extra line break on close) |
| 7621 | +!! input |
| 7622 | +<div>Line one |
| 7623 | + |
| 7624 | +Line two |
| 7625 | +</div> |
| 7626 | +!! result |
| 7627 | +<div>Line one |
| 7628 | +<p>Line two |
| 7629 | +</p> |
| 7630 | +</div> |
| 7631 | + |
| 7632 | +!! end |
| 7633 | + |
| 7634 | +!! test |
| 7635 | +Paragraphs inside divs (extra line break on open and close) |
| 7636 | +!! input |
| 7637 | +<div> |
| 7638 | +Line one |
| 7639 | + |
| 7640 | +Line two |
| 7641 | +</div> |
| 7642 | +!! result |
| 7643 | +<div> |
| 7644 | +<p>Line one |
| 7645 | +</p><p>Line two |
| 7646 | +</p> |
| 7647 | +</div> |
| 7648 | + |
| 7649 | +!! end |
| 7650 | + |
| 7651 | +!! test |
| 7652 | +Nesting tags, paragraphs on lines which begin with <div> |
| 7653 | +!! options |
| 7654 | +disabled |
| 7655 | +!! input |
| 7656 | +<div></div><strong>A |
| 7657 | +B</strong> |
| 7658 | +!! result |
| 7659 | +<div></div> |
| 7660 | +<p><strong>A |
| 7661 | +B</strong> |
| 7662 | +</p> |
| 7663 | +!! end |
| 7664 | + |
| 7665 | +# Bug 6200: <blockquote> should behave like <div> with respect to line breaks |
| 7666 | +!! test |
| 7667 | +Bug 6200: paragraphs inside blockquotes (no extra line breaks) |
| 7668 | +!! options |
| 7669 | +disabled |
| 7670 | +!! input |
| 7671 | +<blockquote>Line one |
| 7672 | + |
| 7673 | +Line two</blockquote> |
| 7674 | +!! result |
| 7675 | +<blockquote>Line one |
| 7676 | +Line two</blockquote> |
| 7677 | + |
| 7678 | +!! end |
| 7679 | + |
| 7680 | +!! test |
| 7681 | +Bug 6200: paragraphs inside blockquotes (extra line break on open) |
| 7682 | +!! options |
| 7683 | +disabled |
| 7684 | +!! input |
| 7685 | +<blockquote> |
| 7686 | +Line one |
| 7687 | + |
| 7688 | +Line two</blockquote> |
| 7689 | +!! result |
| 7690 | +<blockquote> |
| 7691 | +<p>Line one |
| 7692 | +</p> |
| 7693 | +Line two</blockquote> |
| 7694 | + |
| 7695 | +!! end |
| 7696 | + |
| 7697 | +!! test |
| 7698 | +Bug 6200: paragraphs inside blockquotes (extra line break on close) |
| 7699 | +!! options |
| 7700 | +disabled |
| 7701 | +!! input |
| 7702 | +<blockquote>Line one |
| 7703 | + |
| 7704 | +Line two |
| 7705 | +</blockquote> |
| 7706 | +!! result |
| 7707 | +<blockquote>Line one |
| 7708 | +<p>Line two |
| 7709 | +</p> |
| 7710 | +</blockquote> |
| 7711 | + |
| 7712 | +!! end |
| 7713 | + |
| 7714 | +!! test |
| 7715 | +Bug 6200: paragraphs inside blockquotes (extra line break on open and close) |
| 7716 | +!! options |
| 7717 | +disabled |
| 7718 | +!! input |
| 7719 | +<blockquote> |
| 7720 | +Line one |
| 7721 | + |
| 7722 | +Line two |
| 7723 | +</blockquote> |
| 7724 | +!! result |
| 7725 | +<blockquote> |
| 7726 | +<p>Line one |
| 7727 | +</p><p>Line two |
| 7728 | +</p> |
| 7729 | +</blockquote> |
| 7730 | + |
| 7731 | +!! end |
| 7732 | + |
| 7733 | +!! test |
| 7734 | +Paragraphs inside blockquotes/divs (no extra line breaks) |
| 7735 | +!! input |
| 7736 | +<blockquote><div>Line one |
| 7737 | + |
| 7738 | +Line two</div></blockquote> |
| 7739 | +!! result |
| 7740 | +<blockquote><div>Line one |
| 7741 | +Line two</div></blockquote> |
| 7742 | + |
| 7743 | +!! end |
| 7744 | + |
| 7745 | +!! test |
| 7746 | +Paragraphs inside blockquotes/divs (extra line break on open) |
| 7747 | +!! input |
| 7748 | +<blockquote><div> |
| 7749 | +Line one |
| 7750 | + |
| 7751 | +Line two</div></blockquote> |
| 7752 | +!! result |
| 7753 | +<blockquote><div> |
| 7754 | +<p>Line one |
| 7755 | +</p> |
| 7756 | +Line two</div></blockquote> |
| 7757 | + |
| 7758 | +!! end |
| 7759 | + |
| 7760 | +!! test |
| 7761 | +Paragraphs inside blockquotes/divs (extra line break on close) |
| 7762 | +!! input |
| 7763 | +<blockquote><div>Line one |
| 7764 | + |
| 7765 | +Line two |
| 7766 | +</div></blockquote> |
| 7767 | +!! result |
| 7768 | +<blockquote><div>Line one |
| 7769 | +<p>Line two |
| 7770 | +</p> |
| 7771 | +</div></blockquote> |
| 7772 | + |
| 7773 | +!! end |
| 7774 | + |
| 7775 | +!! test |
| 7776 | +Paragraphs inside blockquotes/divs (extra line break on open and close) |
| 7777 | +!! input |
| 7778 | +<blockquote><div> |
| 7779 | +Line one |
| 7780 | + |
| 7781 | +Line two |
| 7782 | +</div></blockquote> |
| 7783 | +!! result |
| 7784 | +<blockquote><div> |
| 7785 | +<p>Line one |
| 7786 | +</p><p>Line two |
| 7787 | +</p> |
| 7788 | +</div></blockquote> |
| 7789 | + |
| 7790 | +!! end |
| 7791 | + |
| 7792 | +!! test |
| 7793 | +Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion |
| 7794 | +!! options |
| 7795 | +wgLinkHolderBatchSize=0 |
| 7796 | +!! input |
| 7797 | +[[meatball:1]] |
| 7798 | +[[meatball:2]] |
| 7799 | +[[meatball:3]] |
| 7800 | +!! result |
| 7801 | +<p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a> |
| 7802 | +<a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a> |
| 7803 | +<a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a> |
| 7804 | +</p> |
| 7805 | +!! end |
| 7806 | + |
| 7807 | +!! test |
| 7808 | +Free external link invading image caption |
| 7809 | +!! input |
| 7810 | +[[Image:Foobar.jpg|thumb|http://x|hello]] |
| 7811 | +!! result |
| 7812 | +<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="180" height="20" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="https://www.mediawiki.org/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div> |
| 7813 | + |
| 7814 | +!! end |
| 7815 | + |
| 7816 | +!! test |
| 7817 | +Bug 15196: localised external link numbers |
| 7818 | +!! options |
| 7819 | +language=fa |
| 7820 | +!! input |
| 7821 | +[http://en.wikipedia.org/] |
| 7822 | +!! result |
| 7823 | +<p><a href="http://en.wikipedia.org/" class="external autonumber" rel="nofollow">[۱]</a> |
| 7824 | +</p> |
| 7825 | +!! end |
| 7826 | + |
| 7827 | +!! test |
| 7828 | +Multibyte character in padleft |
| 7829 | +!! input |
| 7830 | +{{padleft:-Hello|7|Æ}} |
| 7831 | +!! result |
| 7832 | +<p>Æ-Hello |
| 7833 | +</p> |
| 7834 | +!! end |
| 7835 | + |
| 7836 | +!! test |
| 7837 | +Multibyte character in padright |
| 7838 | +!! input |
| 7839 | +{{padright:Hello-|7|Æ}} |
| 7840 | +!! result |
| 7841 | +<p>Hello-Æ |
| 7842 | +</p> |
| 7843 | +!! end |
| 7844 | + |
| 7845 | +!! test |
| 7846 | +Formatted date |
| 7847 | +!! config |
| 7848 | +wgUseDynamicDates=1 |
| 7849 | +!! input |
| 7850 | +[[2009-03-24]] |
| 7851 | +!! result |
| 7852 | +<p><span class="mw-formatted-date" title="2009-03-24"><a href="https://www.mediawiki.org/index.php?title=2009&action=edit&redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="https://www.mediawiki.org/index.php?title=March_24&action=edit&redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span> |
| 7853 | +</p> |
| 7854 | +!!end |
| 7855 | + |
| 7856 | +!!test |
| 7857 | +formatdate parser function |
| 7858 | +!!input |
| 7859 | +{{#formatdate:2009-03-24}} |
| 7860 | +!! result |
| 7861 | +<p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span> |
| 7862 | +</p> |
| 7863 | +!! end |
| 7864 | + |
| 7865 | +!!test |
| 7866 | +formatdate parser function, with default format |
| 7867 | +!!input |
| 7868 | +{{#formatdate:2009-03-24|mdy}} |
| 7869 | +!! result |
| 7870 | +<p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span> |
| 7871 | +</p> |
| 7872 | +!! end |
| 7873 | + |
| 7874 | +!! test |
| 7875 | +Linked date with autoformatting disabled |
| 7876 | +!! config |
| 7877 | +wgUseDynamicDates=false |
| 7878 | +!! input |
| 7879 | +[[2009-03-24]] |
| 7880 | +!! result |
| 7881 | +<p><a href="https://www.mediawiki.org/index.php?title=2009-03-24&action=edit&redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a> |
| 7882 | +</p> |
| 7883 | +!! end |
| 7884 | + |
| 7885 | +!! test |
| 7886 | +Spacing of numbers in formatted dates |
| 7887 | +!! input |
| 7888 | +{{#formatdate:January 15}} |
| 7889 | +!! result |
| 7890 | +<p><span class="mw-formatted-date" title="01-15">January 15</span> |
| 7891 | +</p> |
| 7892 | +!! end |
| 7893 | + |
| 7894 | +!! test |
| 7895 | +Spacing of numbers in formatted dates (linked) |
| 7896 | +!! config |
| 7897 | +wgUseDynamicDates=true |
| 7898 | +!! input |
| 7899 | +[[January 15]] |
| 7900 | +!! result |
| 7901 | +<p><span class="mw-formatted-date" title="01-15"><a href="https://www.mediawiki.org/index.php?title=January_15&action=edit&redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span> |
| 7902 | +</p> |
| 7903 | +!! end |
| 7904 | + |
| 7905 | +# |
| 7906 | +# |
| 7907 | +# |
| 7908 | + |
| 7909 | +# |
| 7910 | +# Edit comments |
| 7911 | +# |
| 7912 | + |
| 7913 | +!! test |
| 7914 | +Edit comment with link |
| 7915 | +!! options |
| 7916 | +comment |
| 7917 | +!! input |
| 7918 | +I like the [[Main Page]] a lot |
| 7919 | +!! result |
| 7920 | +I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">Main Page</a> a lot |
| 7921 | +!!end |
| 7922 | + |
| 7923 | +!! test |
| 7924 | +Edit comment with link and link text |
| 7925 | +!! options |
| 7926 | +comment |
| 7927 | +!! input |
| 7928 | +I like the [[Main Page|best pages]] a lot |
| 7929 | +!! result |
| 7930 | +I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">best pages</a> a lot |
| 7931 | +!!end |
| 7932 | + |
| 7933 | +!! test |
| 7934 | +Edit comment with link and link text with suffix |
| 7935 | +!! options |
| 7936 | +comment |
| 7937 | +!! input |
| 7938 | +I like the [[Main Page|best page]]s a lot |
| 7939 | +!! result |
| 7940 | +I like the <a href="https://www.mediawiki.org/wiki/Main_Page" title="Main Page">best pages</a> a lot |
| 7941 | +!!end |
| 7942 | + |
| 7943 | +!! test |
| 7944 | +Edit comment with section link (non-local, eg in history list) |
| 7945 | +!! options |
| 7946 | +comment title=[[Main Page]] |
| 7947 | +!! input |
| 7948 | +/* External links */ removed bogus entries |
| 7949 | +!! result |
| 7950 | +<span class="autocomment"><a href="https://www.mediawiki.org/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries |
| 7951 | +!!end |
| 7952 | + |
| 7953 | +!! test |
| 7954 | +Edit comment with section link (local, eg in diff view) |
| 7955 | +!! options |
| 7956 | +comment local title=[[Main Page]] |
| 7957 | +!! input |
| 7958 | +/* External links */ removed bogus entries |
| 7959 | +!! result |
| 7960 | +<span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries |
| 7961 | +!!end |
| 7962 | + |
| 7963 | +!! test |
| 7964 | +Edit comment with subpage link (bug 14080) |
| 7965 | +!! options |
| 7966 | +comment |
| 7967 | +subpage |
| 7968 | +title=[[Subpage test]] |
| 7969 | +!! input |
| 7970 | +Poked at a [[/subpage]] here... |
| 7971 | +!! result |
| 7972 | +Poked at a <a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here... |
| 7973 | +!!end |
| 7974 | + |
| 7975 | +!! test |
| 7976 | +Edit comment with subpage link and link text (bug 14080) |
| 7977 | +!! options |
| 7978 | +comment |
| 7979 | +subpage |
| 7980 | +title=[[Subpage test]] |
| 7981 | +!! input |
| 7982 | +Poked at a [[/subpage|neat little page]] here... |
| 7983 | +!! result |
| 7984 | +Poked at a <a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here... |
| 7985 | +!!end |
| 7986 | + |
| 7987 | +!! test |
| 7988 | +Edit comment with bogus subpage link in non-subpage NS (bug 14080) |
| 7989 | +!! options |
| 7990 | +comment |
| 7991 | +title=[[Subpage test]] |
| 7992 | +!! input |
| 7993 | +Poked at a [[/subpage]] here... |
| 7994 | +!! result |
| 7995 | +Poked at a <a href="https://www.mediawiki.org/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here... |
| 7996 | +!!end |
| 7997 | + |
| 7998 | +!! test |
| 7999 | +Edit comment with bare anchor link (local, as on diff) |
| 8000 | +!! options |
| 8001 | +comment |
| 8002 | +local |
| 8003 | +title=[[Main Page]] |
| 8004 | +!!input |
| 8005 | +[[#section]] |
| 8006 | +!! result |
| 8007 | +<a href="#section">#section</a> |
| 8008 | +!! end |
| 8009 | + |
| 8010 | +!! test |
| 8011 | +Edit comment with bare anchor link (non-local, as on history) |
| 8012 | +!! options |
| 8013 | +comment |
| 8014 | +title=[[Main Page]] |
| 8015 | +!!input |
| 8016 | +[[#section]] |
| 8017 | +!! result |
| 8018 | +<a href="https://www.mediawiki.org/wiki/Main_Page#section" title="Main Page">#section</a> |
| 8019 | +!! end |
| 8020 | + |
| 8021 | +!! test |
| 8022 | +Space normalisation on autocomment (bug 22784) |
| 8023 | +!! options |
| 8024 | +comment |
| 8025 | +title=[[Main Page]] |
| 8026 | +!!input |
| 8027 | +/* __hello__world__ */ |
| 8028 | +!! result |
| 8029 | +<span class="autocomment"><a href="https://www.mediawiki.org/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span> |
| 8030 | +!! end |
| 8031 | + |
| 8032 | +!! test |
| 8033 | +Bad images - basic functionality |
| 8034 | +!! input |
| 8035 | +[[File:Bad.jpg]] |
| 8036 | +!! result |
| 8037 | +!! end |
| 8038 | + |
| 8039 | +!! test |
| 8040 | +Bad images - bug 16039: text after bad image disappears |
| 8041 | +!! input |
| 8042 | +Foo bar |
| 8043 | +[[File:Bad.jpg]] |
| 8044 | +Bar foo |
| 8045 | +!! result |
| 8046 | +<p>Foo bar |
| 8047 | +</p><p>Bar foo |
| 8048 | +</p> |
| 8049 | +!! end |
| 8050 | + |
| 8051 | +!! test |
| 8052 | +Verify that displaytitle works (bug #22501) no displaytitle |
| 8053 | +!! options |
| 8054 | +showtitle |
| 8055 | +!! config |
| 8056 | +wgAllowDisplayTitle=true |
| 8057 | +wgRestrictDisplayTitle=false |
| 8058 | +!! input |
| 8059 | +this is not the the title |
| 8060 | +!! result |
| 8061 | +Parser test |
| 8062 | +<p>this is not the the title |
| 8063 | +</p> |
| 8064 | +!! end |
| 8065 | + |
| 8066 | +!! test |
| 8067 | +Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false |
| 8068 | +!! options |
| 8069 | +showtitle |
| 8070 | +title=[[Screen]] |
| 8071 | +!! config |
| 8072 | +wgAllowDisplayTitle=true |
| 8073 | +wgRestrictDisplayTitle=false |
| 8074 | +!! input |
| 8075 | +this is not the the title |
| 8076 | +{{DISPLAYTITLE:whatever}} |
| 8077 | +!! result |
| 8078 | +whatever |
| 8079 | +<p>this is not the the title |
| 8080 | +</p> |
| 8081 | +!! end |
| 8082 | + |
| 8083 | +!! test |
| 8084 | +Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch |
| 8085 | +!! options |
| 8086 | +showtitle |
| 8087 | +title=[[Screen]] |
| 8088 | +!! config |
| 8089 | +wgAllowDisplayTitle=true |
| 8090 | +wgRestrictDisplayTitle=true |
| 8091 | +!! input |
| 8092 | +this is not the the title |
| 8093 | +{{DISPLAYTITLE:whatever}} |
| 8094 | +!! result |
| 8095 | +Screen |
| 8096 | +<p>this is not the the title |
| 8097 | +</p> |
| 8098 | +!! end |
| 8099 | + |
| 8100 | +!! test |
| 8101 | +Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching |
| 8102 | +!! options |
| 8103 | +showtitle |
| 8104 | +title=[[Screen]] |
| 8105 | +!! config |
| 8106 | +wgAllowDisplayTitle=true |
| 8107 | +wgRestrictDisplayTitle=true |
| 8108 | +!! input |
| 8109 | +this is not the the title |
| 8110 | +{{DISPLAYTITLE:screen}} |
| 8111 | +!! result |
| 8112 | +screen |
| 8113 | +<p>this is not the the title |
| 8114 | +</p> |
| 8115 | +!! end |
| 8116 | + |
| 8117 | +!! test |
| 8118 | +Verify that displaytitle works (bug #22501) AllowDisplayTitle=false |
| 8119 | +!! options |
| 8120 | +showtitle |
| 8121 | +title=[[Screen]] |
| 8122 | +!! config |
| 8123 | +wgAllowDisplayTitle=false |
| 8124 | +!! input |
| 8125 | +this is not the the title |
| 8126 | +{{DISPLAYTITLE:screen}} |
| 8127 | +!! result |
| 8128 | +Screen |
| 8129 | +<p>this is not the the title |
| 8130 | +<a href="https://www.mediawiki.org/index.php?title=Template:DISPLAYTITLE:screen&action=edit&redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a> |
| 8131 | +</p> |
| 8132 | +!! end |
| 8133 | + |
| 8134 | +!! test |
| 8135 | +Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE |
| 8136 | +!! options |
| 8137 | +showtitle |
| 8138 | +title=[[Screen]] |
| 8139 | +!! config |
| 8140 | +wgAllowDisplayTitle=false |
| 8141 | +!! input |
| 8142 | +this is not the the title |
| 8143 | +!! result |
| 8144 | +Screen |
| 8145 | +<p>this is not the the title |
| 8146 | +</p> |
| 8147 | +!! end |
| 8148 | + |
| 8149 | +!! test |
| 8150 | +preload: check <noinclude> and <includeonly> |
| 8151 | +!! options |
| 8152 | +preload |
| 8153 | +!! input |
| 8154 | +Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world. |
| 8155 | +!! result |
| 8156 | +Hello kind world. |
| 8157 | +!! end |
| 8158 | + |
| 8159 | +!! test |
| 8160 | +preload: check <onlyinclude> |
| 8161 | +!! options |
| 8162 | +preload |
| 8163 | +!! input |
| 8164 | +Goodbye <onlyinclude>Hello world</onlyinclude> |
| 8165 | +!! result |
| 8166 | +Hello world |
| 8167 | +!! end |
| 8168 | + |
| 8169 | +!! test |
| 8170 | +preload: can pass tags through if we want to |
| 8171 | +!! options |
| 8172 | +preload |
| 8173 | +!! input |
| 8174 | +<includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly> |
| 8175 | +!! result |
| 8176 | +<includeonly>Hello world</includeonly> |
| 8177 | +!! end |
| 8178 | + |
| 8179 | +!! test |
| 8180 | +preload: check that it doesn't try to do tricks |
| 8181 | +!! options |
| 8182 | +preload |
| 8183 | +!! input |
| 8184 | +* <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}} |
| 8185 | +!! result |
| 8186 | +* <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}} |
| 8187 | +!! end |
| 8188 | + |
| 8189 | +!! test |
| 8190 | +Play a bit with r67090 and bug 3158 |
| 8191 | +!! options |
| 8192 | +disabled |
| 8193 | +!! input |
| 8194 | +<div style="width:50% !important"> </div> |
| 8195 | +<div style="width:50% !important"> </div> |
| 8196 | +<div style="width:50% !important"> </div> |
| 8197 | +<div style="border : solid;"> </div> |
| 8198 | +!! result |
| 8199 | +<div style="width:50% !important"> </div> |
| 8200 | +<div style="width:50% !important"> </div> |
| 8201 | +<div style="width:50% !important"> </div> |
| 8202 | +<div style="border : solid;"> </div> |
| 8203 | + |
| 8204 | +!! end |
| 8205 | + |
| 8206 | +!! test |
| 8207 | +HTML5 data attributes |
| 8208 | +!! input |
| 8209 | +<span data-foo="bar">Baz</span> |
| 8210 | +<p data-abc-def_hij="">Quuz</p> |
| 8211 | +!! result |
| 8212 | +<p><span data-foo="bar">Baz</span> |
| 8213 | +</p> |
| 8214 | +<p data-abc-def_hij="">Quuz</p> |
| 8215 | + |
| 8216 | +!! end |
| 8217 | + |
| 8218 | + |
| 8219 | +TODO: |
| 8220 | +more images |
| 8221 | +more tables |
| 8222 | +math |
| 8223 | +character entities |
| 8224 | +and much more |
| 8225 | +Try for 100% code coverage |
Property changes on: trunk/phase3/maintenance/tests/parser/parserTests.txt |
___________________________________________________________________ |
Added: svn:keywords |
1 | 8226 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 8227 | + native |
Index: trunk/phase3/maintenance/Makefile |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | @echo "Run 'make doc' to run the doxygen generation." |
5 | 5 | |
6 | 6 | test: |
7 | | - php parserTests.php --quiet |
| 7 | + php tests/parserTests.php --quiet |
8 | 8 | |
9 | 9 | doc: |
10 | 10 | php mwdocgen.php --all |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -678,26 +678,26 @@ |
679 | 679 | 'LanguageConverter' => 'languages/LanguageConverter.php', |
680 | 680 | |
681 | 681 | # maintenance |
682 | | - 'AnsiTermColorer' => 'maintenance/parserTests.inc', |
| 682 | + 'AnsiTermColorer' => 'maintenance/tests/testHelpers.inc', |
683 | 683 | 'ConvertLinks' => 'maintenance/convertLinks.php', |
684 | | - 'DbTestPreviewer' => 'maintenance/parserTests.inc', |
685 | | - 'DbTestRecorder' => 'maintenance/parserTests.inc', |
| 684 | + 'DbTestPreviewer' => 'maintenance/tests/testHelpers.inc', |
| 685 | + 'DbTestRecorder' => 'maintenance/tests/testHelpers.inc', |
686 | 686 | 'DeleteArchivedFilesImplementation' => 'maintenance/deleteArchivedFiles.inc', |
687 | 687 | 'DeleteArchivedRevisionsImplementation' => 'maintenance/deleteArchivedRevisions.inc', |
688 | 688 | 'DeleteDefaultMessages' => 'maintenance/deleteDefaultMessages.php', |
689 | | - 'DummyTermColorer' => 'maintenance/parserTests.inc', |
690 | | - 'ParserTest' => 'maintenance/parserTests.inc', |
691 | | - 'ParserTestParserHook' => 'maintenance/parserTestsParserHook.php', |
692 | | - 'ParserTestStaticParserHook' => 'maintenance/parserTestsStaticParserHook.php', |
| 689 | + 'DummyTermColorer' => 'maintenance/tests/testHelpers.inc', |
| 690 | + 'ParserTest' => 'maintenance/tests/parser/parserTest.inc', |
| 691 | + 'ParserTestParserHook' => 'maintenance/tests/parser/parserTestsParserHook.php', |
| 692 | + 'ParserTestStaticParserHook' => 'maintenance/tests/parser/parserTestsStaticParserHook.php', |
693 | 693 | 'PopulateCategory' => 'maintenance/populateCategory.php', |
694 | 694 | 'PopulateLogSearch' => 'maintenance/populateLogSearch.php', |
695 | 695 | 'PopulateParentId' => 'maintenance/populateParentId.php', |
696 | 696 | 'PopulateRevisionLength' => 'maintenance/populateRevisionLength.php', |
697 | | - 'RemoteTestRecorder' => 'maintenance/parserTests.inc', |
| 697 | + 'RemoteTestRecorder' => 'maintenance/tests/testHelpers.inc', |
698 | 698 | 'SevenZipStream' => 'maintenance/7zip.inc', |
699 | 699 | 'Sqlite' => 'maintenance/sqlite.inc', |
700 | | - 'TestFileIterator' => 'maintenance/parserTests.inc', |
701 | | - 'TestRecorder' => 'maintenance/parserTests.inc', |
| 700 | + 'TestFileIterator' => 'maintenance/tests/testHelpers.inc', |
| 701 | + 'TestRecorder' => 'maintenance/tests/testHelpers.inc', |
702 | 702 | 'UpdateCollation' => 'maintenance/updateCollation.php', |
703 | 703 | 'UpdateRestrictions' => 'maintenance/updateRestrictions.php', |
704 | 704 | 'UserDupes' => 'maintenance/userDupes.inc', |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -3736,8 +3736,8 @@ |
3737 | 3737 | * Use full paths. |
3738 | 3738 | */ |
3739 | 3739 | $wgParserTestFiles = array( |
3740 | | - "$IP/maintenance/parserTests.txt", |
3741 | | - "$IP/maintenance/ExtraParserTests.txt" |
| 3740 | + "$IP/maintenance/tests/parser/parserTests.txt", |
| 3741 | + "$IP/maintenance/tests/parser/ExtraParserTests.txt" |
3742 | 3742 | ); |
3743 | 3743 | |
3744 | 3744 | /** |