fix merge of Iec98e472
[lhc/web/wiklou.git] / includes / api / ApiParse.php
1 <?php
2 /**
3 * Created on Dec 01, 2007
4 *
5 * Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
21 *
22 * @file
23 */
24
25 /**
26 * @ingroup API
27 */
28 class ApiParse extends ApiBase {
29
30 /** @var String $section */
31 private $section = null;
32
33 /** @var Content $content */
34 private $content = null;
35
36 /** @var Content $pstContent */
37 private $pstContent = null;
38
39 public function __construct( $main, $action ) {
40 parent::__construct( $main, $action );
41 }
42
43 public function execute() {
44 // The data is hot but user-dependent, like page views, so we set vary cookies
45 $this->getMain()->setCacheMode( 'anon-public-user-private' );
46
47 // Get parameters
48 $params = $this->extractRequestParams();
49 $text = $params['text'];
50 $title = $params['title'];
51 $page = $params['page'];
52 $pageid = $params['pageid'];
53 $oldid = $params['oldid'];
54
55 $model = $params['contentmodel'];
56 $format = $params['contentformat'];
57
58 if ( !is_null( $page ) && ( !is_null( $text ) || $title != 'API' ) ) {
59 $this->dieUsage( 'The page parameter cannot be used together with the text and title parameters', 'params' );
60 }
61
62 $prop = array_flip( $params['prop'] );
63
64 if ( isset( $params['section'] ) ) {
65 $this->section = $params['section'];
66 } else {
67 $this->section = false;
68 }
69
70 // The parser needs $wgTitle to be set, apparently the
71 // $title parameter in Parser::parse isn't enough *sigh*
72 // TODO: Does this still need $wgTitle?
73 global $wgParser, $wgTitle;
74
75 // Currently unnecessary, code to act as a safeguard against any change in current behaviour of uselang breaks
76 $oldLang = null;
77 if ( isset( $params['uselang'] ) && $params['uselang'] != $this->getContext()->getLanguage()->getCode() ) {
78 $oldLang = $this->getContext()->getLanguage(); // Backup language
79 $this->getContext()->setLanguage( Language::factory( $params['uselang'] ) );
80 }
81
82 $redirValues = null;
83
84 // Return result
85 $result = $this->getResult();
86
87 if ( !is_null( $oldid ) || !is_null( $pageid ) || !is_null( $page ) ) {
88 if ( !is_null( $oldid ) ) {
89 // Don't use the parser cache
90 $rev = Revision::newFromID( $oldid );
91 if ( !$rev ) {
92 $this->dieUsage( "There is no revision ID $oldid", 'missingrev' );
93 }
94 if ( !$rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) {
95 $this->dieUsage( "You don't have permission to view deleted revisions", 'permissiondenied' );
96 }
97
98 $titleObj = $rev->getTitle();
99 $wgTitle = $titleObj;
100 $pageObj = WikiPage::factory( $titleObj );
101 $popts = $pageObj->makeParserOptions( $this->getContext() );
102 $popts->enableLimitReport( !$params['disablepp'] );
103
104 // If for some reason the "oldid" is actually the current revision, it may be cached
105 if ( $rev->isCurrent() ) {
106 // May get from/save to parser cache
107 $p_result = $this->getParsedContent( $pageObj, $popts,
108 $pageid, isset( $prop['wikitext'] ) ) ;
109 } else { // This is an old revision, so get the text differently
110 $this->content = $rev->getContent( Revision::FOR_THIS_USER, $this->getUser() );
111
112 if ( $this->section !== false ) {
113 $this->content = $this->getSectionContent( $this->content, 'r' . $rev->getId() );
114 }
115
116 // Should we save old revision parses to the parser cache?
117 $p_result = $this->content->getParserOutput( $titleObj, $popts );
118 }
119 } else { // Not $oldid, but $pageid or $page
120 if ( $params['redirects'] ) {
121 $reqParams = array(
122 'action' => 'query',
123 'redirects' => '',
124 );
125 if ( !is_null ( $pageid ) ) {
126 $reqParams['pageids'] = $pageid;
127 } else { // $page
128 $reqParams['titles'] = $page;
129 }
130 $req = new FauxRequest( $reqParams );
131 $main = new ApiMain( $req );
132 $main->execute();
133 $data = $main->getResultData();
134 $redirValues = isset( $data['query']['redirects'] )
135 ? $data['query']['redirects']
136 : array();
137 $to = $page;
138 foreach ( (array)$redirValues as $r ) {
139 $to = $r['to'];
140 }
141 $pageParams = array( 'title' => $to );
142 } elseif ( !is_null( $pageid ) ) {
143 $pageParams = array( 'pageid' => $pageid );
144 } else { // $page
145 $pageParams = array( 'title' => $page );
146 }
147
148 $pageObj = $this->getTitleOrPageId( $pageParams, 'fromdb' );
149 $titleObj = $pageObj->getTitle();
150 $wgTitle = $titleObj;
151
152 if ( isset( $prop['revid'] ) ) {
153 $oldid = $pageObj->getLatest();
154 }
155
156
157 $popts = $pageObj->makeParserOptions( $this->getContext() );
158 $popts->enableLimitReport( !$params['disablepp'] );
159
160 // Potentially cached
161 $p_result = $this->getParsedContent( $pageObj, $popts, $pageid,
162 isset( $prop['wikitext'] ) ) ;
163 }
164 } else { // Not $oldid, $pageid, $page. Hence based on $text
165 $titleObj = Title::newFromText( $title );
166 if ( !$titleObj ) {
167 $this->dieUsageMsg( array( 'invalidtitle', $title ) );
168 }
169 $wgTitle = $titleObj;
170 $pageObj = WikiPage::factory( $titleObj );
171
172 $popts = $pageObj->makeParserOptions( $this->getContext() );
173 $popts->enableLimitReport( !$params['disablepp'] );
174
175 if ( is_null( $text ) ) {
176 $this->dieUsage( 'The text parameter should be passed with the title parameter. Should you be using the "page" parameter instead?', 'params' );
177 }
178
179 try {
180 $this->content = ContentHandler::makeContent( $text, $titleObj, $model, $format );
181 } catch ( MWContentSerializationException $ex ) {
182 $this->dieUsage( $ex->getMessage(), 'parseerror' );
183 }
184
185 if ( $this->section !== false ) {
186 $this->content = $this->getSectionContent( $this->content, $titleObj->getText() );
187 }
188
189 if ( $params['pst'] || $params['onlypst'] ) {
190 $this->pstContent = $this->content->preSaveTransform( $titleObj, $this->getUser(), $popts );
191 }
192 if ( $params['onlypst'] ) {
193 // Build a result and bail out
194 $result_array = array();
195 $result_array['text'] = array();
196 $result->setContent( $result_array['text'], $this->pstContent->serialize( $format ) );
197 if ( isset( $prop['wikitext'] ) ) {
198 $result_array['wikitext'] = array();
199 $result->setContent( $result_array['wikitext'], $this->content->serialize( $format ) );
200 }
201 $result->addValue( null, $this->getModuleName(), $result_array );
202 return;
203 }
204
205 // Not cached (save or load)
206 if ( $params['pst'] ) {
207 $p_result = $this->pstContent->getParserOutput( $titleObj, $popts );
208 } else {
209 $p_result = $this->content->getParserOutput( $titleObj, $popts );
210 }
211 }
212
213 $result_array = array();
214
215 $result_array['title'] = $titleObj->getPrefixedText();
216
217 if ( !is_null( $oldid ) ) {
218 $result_array['revid'] = intval( $oldid );
219 }
220
221 if ( $params['redirects'] && !is_null( $redirValues ) ) {
222 $result_array['redirects'] = $redirValues;
223 }
224
225 if ( isset( $prop['text'] ) ) {
226 $result_array['text'] = array();
227 $result->setContent( $result_array['text'], $p_result->getText() );
228 }
229
230 if ( !is_null( $params['summary'] ) ) {
231 $result_array['parsedsummary'] = array();
232 $result->setContent( $result_array['parsedsummary'], Linker::formatComment( $params['summary'], $titleObj ) );
233 }
234
235 if ( isset( $prop['langlinks'] ) ) {
236 $result_array['langlinks'] = $this->formatLangLinks( $p_result->getLanguageLinks() );
237 }
238 if ( isset( $prop['languageshtml'] ) ) {
239 $languagesHtml = $this->languagesHtml( $p_result->getLanguageLinks() );
240 $result_array['languageshtml'] = array();
241 $result->setContent( $result_array['languageshtml'], $languagesHtml );
242 }
243 if ( isset( $prop['categories'] ) ) {
244 $result_array['categories'] = $this->formatCategoryLinks( $p_result->getCategories() );
245 }
246 if ( isset( $prop['categorieshtml'] ) ) {
247 $categoriesHtml = $this->categoriesHtml( $p_result->getCategories() );
248 $result_array['categorieshtml'] = array();
249 $result->setContent( $result_array['categorieshtml'], $categoriesHtml );
250 }
251 if ( isset( $prop['links'] ) ) {
252 $result_array['links'] = $this->formatLinks( $p_result->getLinks() );
253 }
254 if ( isset( $prop['templates'] ) ) {
255 $result_array['templates'] = $this->formatLinks( $p_result->getTemplates() );
256 }
257 if ( isset( $prop['images'] ) ) {
258 $result_array['images'] = array_keys( $p_result->getImages() );
259 }
260 if ( isset( $prop['externallinks'] ) ) {
261 $result_array['externallinks'] = array_keys( $p_result->getExternalLinks() );
262 }
263 if ( isset( $prop['sections'] ) ) {
264 $result_array['sections'] = $p_result->getSections();
265 }
266
267 if ( isset( $prop['displaytitle'] ) ) {
268 $result_array['displaytitle'] = $p_result->getDisplayTitle() ?
269 $p_result->getDisplayTitle() :
270 $titleObj->getPrefixedText();
271 }
272
273 if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
274 $context = $this->getContext();
275 $context->setTitle( $titleObj );
276 $context->getOutput()->addParserOutputNoText( $p_result );
277
278 if ( isset( $prop['headitems'] ) ) {
279 $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
280
281 $css = $this->formatCss( $context->getOutput()->buildCssLinksArray() );
282
283 $scripts = array( $context->getOutput()->getHeadScripts() );
284
285 $result_array['headitems'] = array_merge( $headItems, $css, $scripts );
286 }
287
288 if ( isset( $prop['headhtml'] ) ) {
289 $result_array['headhtml'] = array();
290 $result->setContent( $result_array['headhtml'], $context->getOutput()->headElement( $context->getSkin() ) );
291 }
292 }
293
294 if ( isset( $prop['iwlinks'] ) ) {
295 $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() );
296 }
297
298 if ( isset( $prop['wikitext'] ) ) {
299 $result_array['wikitext'] = array();
300 $result->setContent( $result_array['wikitext'], $this->content->serialize( $format ) );
301 if ( !is_null( $this->pstContent ) ) {
302 $result_array['psttext'] = array();
303 $result->setContent( $result_array['psttext'], $this->pstContent->serialize( $format ) );
304 }
305 }
306 if ( isset( $prop['properties'] ) ) {
307 $result_array['properties'] = $this->formatProperties( $p_result->getProperties() );
308 }
309
310 if ( $params['generatexml'] ) {
311 if ( $this->content->getModel() != CONTENT_MODEL_WIKITEXT ) {
312 $this->dieUsage( "generatexml is only supported for wikitext content", "notwikitext" );
313 }
314
315 $wgParser->startExternalParse( $titleObj, $popts, OT_PREPROCESS );
316 $dom = $wgParser->preprocessToDom( $this->content->getNativeData() );
317 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
318 $xml = $dom->saveXML();
319 } else {
320 $xml = $dom->__toString();
321 }
322 $result_array['parsetree'] = array();
323 $result->setContent( $result_array['parsetree'], $xml );
324 }
325
326 $result_mapping = array(
327 'redirects' => 'r',
328 'langlinks' => 'll',
329 'categories' => 'cl',
330 'links' => 'pl',
331 'templates' => 'tl',
332 'images' => 'img',
333 'externallinks' => 'el',
334 'iwlinks' => 'iw',
335 'sections' => 's',
336 'headitems' => 'hi',
337 'properties' => 'pp',
338 );
339 $this->setIndexedTagNames( $result_array, $result_mapping );
340 $result->addValue( null, $this->getModuleName(), $result_array );
341
342 if ( !is_null( $oldLang ) ) {
343 $this->getContext()->setLanguage( $oldLang ); // Reset language to $oldLang
344 }
345 }
346
347 /**
348 * @param $page WikiPage
349 * @param $popts ParserOptions
350 * @param $pageId Int
351 * @param $getWikitext Bool
352 * @return ParserOutput
353 */
354 private function getParsedContent( WikiPage $page, $popts, $pageId = null, $getWikitext = false ) {
355 $this->content = $page->getContent( Revision::RAW ); //XXX: really raw?
356
357 if ( $this->section !== false ) {
358 $this->content = $this->getSectionContent( $this->content, !is_null( $pageId )
359 ? 'page id ' . $pageId : $page->getTitle()->getText() );
360
361 // Not cached (save or load)
362 return $this->content->getParserOutput( $page->getTitle(), $popts );
363 } else {
364 // Try the parser cache first
365 // getParserOutput will save to Parser cache if able
366 $pout = $page->getParserOutput( $popts );
367 if ( !$pout ) {
368 $this->dieUsage( "There is no revision ID {$page->getLatest()}", 'missingrev' );
369 }
370 if ( $getWikitext ) {
371 $this->content = $page->getContent( Revision::RAW );
372 }
373 return $pout;
374 }
375 }
376
377 private function getSectionContent( Content $content, $what ) {
378 // Not cached (save or load)
379 $section = $content->getSection( $this->section );
380 if ( $section === false ) {
381 $this->dieUsage( "There is no section {$this->section} in " . $what, 'nosuchsection' );
382 }
383 if ( $section === null ) {
384 $this->dieUsage( "Sections are not supported by " . $what, 'nosuchsection' );
385 $section = false;
386 }
387 return $section;
388 }
389
390 private function formatLangLinks( $links ) {
391 $result = array();
392 foreach ( $links as $link ) {
393 $entry = array();
394 $bits = explode( ':', $link, 2 );
395 $title = Title::newFromText( $link );
396
397 $entry['lang'] = $bits[0];
398 if ( $title ) {
399 $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
400 }
401 $this->getResult()->setContent( $entry, $bits[1] );
402 $result[] = $entry;
403 }
404 return $result;
405 }
406
407 private function formatCategoryLinks( $links ) {
408 $result = array();
409 foreach ( $links as $link => $sortkey ) {
410 $entry = array();
411 $entry['sortkey'] = $sortkey;
412 $this->getResult()->setContent( $entry, $link );
413 $result[] = $entry;
414 }
415 return $result;
416 }
417
418 private function categoriesHtml( $categories ) {
419 $context = $this->getContext();
420 $context->getOutput()->addCategoryLinks( $categories );
421 return $context->getSkin()->getCategories();
422 }
423
424 /**
425 * @deprecated since 1.18 No modern skin generates language links this way, please use language links
426 * data to generate your own HTML.
427 * @param $languages array
428 * @return string
429 */
430 private function languagesHtml( $languages ) {
431 wfDeprecated( __METHOD__, '1.18' );
432
433 global $wgContLang, $wgHideInterlanguageLinks;
434
435 if ( $wgHideInterlanguageLinks || count( $languages ) == 0 ) {
436 return '';
437 }
438
439 $s = htmlspecialchars( wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text() );
440
441 $langs = array();
442 foreach ( $languages as $l ) {
443 $nt = Title::newFromText( $l );
444 $text = Language::fetchLanguageName( $nt->getInterwiki() );
445
446 $langs[] = Html::element( 'a',
447 array( 'href' => $nt->getFullURL(), 'title' => $nt->getText(), 'class' => "external" ),
448 $text == '' ? $l : $text );
449 }
450
451 $s .= implode( wfMessage( 'pipe-separator' )->escaped(), $langs );
452
453 if ( $wgContLang->isRTL() ) {
454 $s = Html::rawElement( 'span', array( 'dir' => "LTR" ), $s );
455 }
456
457 return $s;
458 }
459
460 private function formatLinks( $links ) {
461 $result = array();
462 foreach ( $links as $ns => $nslinks ) {
463 foreach ( $nslinks as $title => $id ) {
464 $entry = array();
465 $entry['ns'] = $ns;
466 $this->getResult()->setContent( $entry, Title::makeTitle( $ns, $title )->getFullText() );
467 if ( $id != 0 ) {
468 $entry['exists'] = '';
469 }
470 $result[] = $entry;
471 }
472 }
473 return $result;
474 }
475
476 private function formatIWLinks( $iw ) {
477 $result = array();
478 foreach ( $iw as $prefix => $titles ) {
479 foreach ( array_keys( $titles ) as $title ) {
480 $entry = array();
481 $entry['prefix'] = $prefix;
482
483 $title = Title::newFromText( "{$prefix}:{$title}" );
484 if ( $title ) {
485 $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
486 }
487
488 $this->getResult()->setContent( $entry, $title->getFullText() );
489 $result[] = $entry;
490 }
491 }
492 return $result;
493 }
494
495 private function formatHeadItems( $headItems ) {
496 $result = array();
497 foreach ( $headItems as $tag => $content ) {
498 $entry = array();
499 $entry['tag'] = $tag;
500 $this->getResult()->setContent( $entry, $content );
501 $result[] = $entry;
502 }
503 return $result;
504 }
505
506 private function formatProperties( $properties ) {
507 $result = array();
508 foreach ( $properties as $name => $value ) {
509 $entry = array();
510 $entry['name'] = $name;
511 $this->getResult()->setContent( $entry, $value );
512 $result[] = $entry;
513 }
514 return $result;
515 }
516
517 private function formatCss( $css ) {
518 $result = array();
519 foreach ( $css as $file => $link ) {
520 $entry = array();
521 $entry['file'] = $file;
522 $this->getResult()->setContent( $entry, $link );
523 $result[] = $entry;
524 }
525 return $result;
526 }
527
528 private function setIndexedTagNames( &$array, $mapping ) {
529 foreach ( $mapping as $key => $name ) {
530 if ( isset( $array[$key] ) ) {
531 $this->getResult()->setIndexedTagName( $array[$key], $name );
532 }
533 }
534 }
535
536 public function getAllowedParams() {
537 return array(
538 'title' => array(
539 ApiBase::PARAM_DFLT => 'API',
540 ),
541 'text' => null,
542 'summary' => null,
543 'page' => null,
544 'pageid' => array(
545 ApiBase::PARAM_TYPE => 'integer',
546 ),
547 'redirects' => false,
548 'oldid' => array(
549 ApiBase::PARAM_TYPE => 'integer',
550 ),
551 'prop' => array(
552 ApiBase::PARAM_DFLT => 'text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties',
553 ApiBase::PARAM_ISMULTI => true,
554 ApiBase::PARAM_TYPE => array(
555 'text',
556 'langlinks',
557 'languageshtml',
558 'categories',
559 'categorieshtml',
560 'links',
561 'templates',
562 'images',
563 'externallinks',
564 'sections',
565 'revid',
566 'displaytitle',
567 'headitems',
568 'headhtml',
569 'iwlinks',
570 'wikitext',
571 'properties',
572 )
573 ),
574 'pst' => false,
575 'onlypst' => false,
576 'uselang' => null,
577 'section' => null,
578 'disablepp' => false,
579 'generatexml' => false,
580 'contentformat' => array(
581 ApiBase::PARAM_TYPE => ContentHandler::getAllContentFormats(),
582 ),
583 'contentmodel' => array(
584 ApiBase::PARAM_TYPE => ContentHandler::getContentModels(),
585 )
586 );
587 }
588
589 public function getParamDescription() {
590 $p = $this->getModulePrefix();
591 return array(
592 'text' => 'Wikitext to parse',
593 'summary' => 'Summary to parse',
594 'redirects' => "If the {$p}page or the {$p}pageid parameter is set to a redirect, resolve it",
595 'title' => 'Title of page the text belongs to',
596 'page' => "Parse the content of this page. Cannot be used together with {$p}text and {$p}title",
597 'pageid' => "Parse the content of this page. Overrides {$p}page",
598 'oldid' => "Parse the content of this revision. Overrides {$p}page and {$p}pageid",
599 'prop' => array(
600 'Which pieces of information to get',
601 ' text - Gives the parsed text of the wikitext',
602 ' langlinks - Gives the language links in the parsed wikitext',
603 ' categories - Gives the categories in the parsed wikitext',
604 ' categorieshtml - Gives the HTML version of the categories',
605 ' languageshtml - Gives the HTML version of the language links',
606 ' links - Gives the internal links in the parsed wikitext',
607 ' templates - Gives the templates in the parsed wikitext',
608 ' images - Gives the images in the parsed wikitext',
609 ' externallinks - Gives the external links in the parsed wikitext',
610 ' sections - Gives the sections in the parsed wikitext',
611 ' revid - Adds the revision ID of the parsed page',
612 ' displaytitle - Adds the title of the parsed wikitext',
613 ' headitems - Gives items to put in the <head> of the page',
614 ' headhtml - Gives parsed <head> of the page',
615 ' iwlinks - Gives interwiki links in the parsed wikitext',
616 ' wikitext - Gives the original wikitext that was parsed',
617 ' properties - Gives various properties defined in the parsed wikitext',
618 ),
619 'pst' => array(
620 'Do a pre-save transform on the input before parsing it',
621 'Ignored if page, pageid or oldid is used'
622 ),
623 'onlypst' => array(
624 'Do a pre-save transform (PST) on the input, but don\'t parse it',
625 'Returns the same wikitext, after a PST has been applied. Ignored if page, pageid or oldid is used'
626 ),
627 'uselang' => 'Which language to parse the request in',
628 'section' => 'Only retrieve the content of this section number',
629 'disablepp' => 'Disable the PP Report from the parser output',
630 'generatexml' => 'Generate XML parse tree',
631 'contentformat' => 'Content serialization format used for the input text',
632 'contentmodel' => 'Content model of the new content',
633 );
634 }
635
636 public function getDescription() {
637 return array(
638 'Parses wikitext and returns parser output',
639 'See the various prop-Modules of action=query to get information from the current version of a page',
640 );
641 }
642
643 public function getPossibleErrors() {
644 return array_merge( parent::getPossibleErrors(), array(
645 array( 'code' => 'params', 'info' => 'The page parameter cannot be used together with the text and title parameters' ),
646 array( 'code' => 'params', 'info' => 'The text parameter should be passed with the title parameter. Should you be using the "page" parameter instead?' ),
647 array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
648 array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revisions' ),
649 array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
650 array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
651 array( 'nosuchpageid' ),
652 array( 'invalidtitle', 'title' ),
653 array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
654 array( 'code' => 'notwikitext', 'info' => 'The requested operation is only supported on wikitext content.' ),
655 ) );
656 }
657
658 public function getExamples() {
659 return array(
660 'api.php?action=parse&text={{Project:Sandbox}}'
661 );
662 }
663
664 public function getHelpUrls() {
665 return 'https://www.mediawiki.org/wiki/API:Parsing_wikitext#parse';
666 }
667
668 public function getVersion() {
669 return __CLASS__ . ': $Id$';
670 }
671 }