3 * Created on Dec 01, 2007
5 * Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
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.
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.
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
28 class ApiParse
extends ApiBase
{
30 /** @var string $section */
31 private $section = null;
33 /** @var Content $content */
34 private $content = null;
36 /** @var Content $pstContent */
37 private $pstContent = null;
39 public function execute() {
40 // The data is hot but user-dependent, like page views, so we set vary cookies
41 $this->getMain()->setCacheMode( 'anon-public-user-private' );
44 $params = $this->extractRequestParams();
45 $text = $params['text'];
46 $title = $params['title'];
47 if ( $title === null ) {
48 $titleProvided = false;
49 // A title is needed for parsing, so arbitrarily choose one
52 $titleProvided = true;
55 $page = $params['page'];
56 $pageid = $params['pageid'];
57 $oldid = $params['oldid'];
59 $model = $params['contentmodel'];
60 $format = $params['contentformat'];
62 if ( !is_null( $page ) && ( !is_null( $text ) ||
$titleProvided ) ) {
64 'The page parameter cannot be used together with the text and title parameters',
69 $prop = array_flip( $params['prop'] );
71 if ( isset( $params['section'] ) ) {
72 $this->section
= $params['section'];
73 if ( !preg_match( '/^((T-)?\d+|new)$/', $this->section
) ) {
75 "The section parameter must be a valid section id or 'new'", "invalidsection"
79 $this->section
= false;
82 // The parser needs $wgTitle to be set, apparently the
83 // $title parameter in Parser::parse isn't enough *sigh*
84 // TODO: Does this still need $wgTitle?
85 global $wgParser, $wgTitle;
90 $result = $this->getResult();
92 if ( !is_null( $oldid ) ||
!is_null( $pageid ) ||
!is_null( $page ) ) {
93 if ( $this->section
=== 'new' ) {
95 'section=new cannot be combined with oldid, pageid or page parameters. ' .
96 'Please use text', 'params'
99 if ( !is_null( $oldid ) ) {
100 // Don't use the parser cache
101 $rev = Revision
::newFromId( $oldid );
103 $this->dieUsage( "There is no revision ID $oldid", 'missingrev' );
105 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $this->getUser() ) ) {
106 $this->dieUsage( "You don't have permission to view deleted revisions", 'permissiondenied' );
109 $titleObj = $rev->getTitle();
110 $wgTitle = $titleObj;
111 $pageObj = WikiPage
::factory( $titleObj );
112 $popts = $this->makeParserOptions( $pageObj, $params );
114 // If for some reason the "oldid" is actually the current revision, it may be cached
115 // Deliberately comparing $pageObj->getLatest() with $rev->getId(), rather than
116 // checking $rev->isCurrent(), because $pageObj is what actually ends up being used,
117 // and if its ->getLatest() is outdated, $rev->isCurrent() won't tell us that.
118 if ( $rev->getId() == $pageObj->getLatest() ) {
119 // May get from/save to parser cache
120 $p_result = $this->getParsedContent( $pageObj, $popts,
121 $pageid, isset( $prop['wikitext'] ) );
122 } else { // This is an old revision, so get the text differently
123 $this->content
= $rev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() );
125 if ( $this->section
!== false ) {
126 $this->content
= $this->getSectionContent( $this->content
, 'r' . $rev->getId() );
129 // Should we save old revision parses to the parser cache?
130 $p_result = $this->content
->getParserOutput( $titleObj, $rev->getId(), $popts );
132 } else { // Not $oldid, but $pageid or $page
133 if ( $params['redirects'] ) {
137 if ( !is_null( $pageid ) ) {
138 $reqParams['pageids'] = $pageid;
140 $reqParams['titles'] = $page;
142 $req = new FauxRequest( $reqParams );
143 $main = new ApiMain( $req );
144 $pageSet = new ApiPageSet( $main );
146 $redirValues = $pageSet->getRedirectTitlesAsResult( $this->getResult() );
149 foreach ( $pageSet->getRedirectTitles() as $title ) {
150 $to = $title->getFullText();
152 $pageParams = array( 'title' => $to );
153 } elseif ( !is_null( $pageid ) ) {
154 $pageParams = array( 'pageid' => $pageid );
156 $pageParams = array( 'title' => $page );
159 $pageObj = $this->getTitleOrPageId( $pageParams, 'fromdb' );
160 $titleObj = $pageObj->getTitle();
161 if ( !$titleObj ||
!$titleObj->exists() ) {
162 $this->dieUsage( "The page you specified doesn't exist", 'missingtitle' );
164 $wgTitle = $titleObj;
166 if ( isset( $prop['revid'] ) ) {
167 $oldid = $pageObj->getLatest();
170 $popts = $this->makeParserOptions( $pageObj, $params );
172 // Potentially cached
173 $p_result = $this->getParsedContent( $pageObj, $popts, $pageid,
174 isset( $prop['wikitext'] ) );
176 } else { // Not $oldid, $pageid, $page. Hence based on $text
177 $titleObj = Title
::newFromText( $title );
178 if ( !$titleObj ||
$titleObj->isExternal() ) {
179 $this->dieUsageMsg( array( 'invalidtitle', $title ) );
181 $wgTitle = $titleObj;
182 if ( $titleObj->canExist() ) {
183 $pageObj = WikiPage
::factory( $titleObj );
185 // Do like MediaWiki::initializeArticle()
186 $article = Article
::newFromTitle( $titleObj, $this->getContext() );
187 $pageObj = $article->getPage();
190 $popts = $this->makeParserOptions( $pageObj, $params );
191 $textProvided = !is_null( $text );
193 if ( !$textProvided ) {
194 if ( $titleProvided && ( $prop ||
$params['generatexml'] ) ) {
196 "'title' used without 'text', and parsed page properties were requested " .
197 "(did you mean to use 'page' instead of 'title'?)"
200 // Prevent warning from ContentHandler::makeContent()
204 // If we are parsing text, do not use the content model of the default
205 // API title, but default to wikitext to keep BC.
206 if ( $textProvided && !$titleProvided && is_null( $model ) ) {
207 $model = CONTENT_MODEL_WIKITEXT
;
208 $this->setWarning( "No 'title' or 'contentmodel' was given, assuming $model." );
212 $this->content
= ContentHandler
::makeContent( $text, $titleObj, $model, $format );
213 } catch ( MWContentSerializationException
$ex ) {
214 $this->dieUsage( $ex->getMessage(), 'parseerror' );
217 if ( $this->section
!== false ) {
218 if ( $this->section
=== 'new' ) {
219 // Insert the section title above the content.
220 if ( !is_null( $params['sectiontitle'] ) && $params['sectiontitle'] !== '' ) {
221 $this->content
= $this->content
->addSectionHeader( $params['sectiontitle'] );
224 $this->content
= $this->getSectionContent( $this->content
, $titleObj->getPrefixedText() );
228 if ( $params['pst'] ||
$params['onlypst'] ) {
229 $this->pstContent
= $this->content
->preSaveTransform( $titleObj, $this->getUser(), $popts );
231 if ( $params['onlypst'] ) {
232 // Build a result and bail out
233 $result_array = array();
234 $result_array['text'] = $this->pstContent
->serialize( $format );
235 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'text';
236 if ( isset( $prop['wikitext'] ) ) {
237 $result_array['wikitext'] = $this->content
->serialize( $format );
238 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'wikitext';
240 if ( !is_null( $params['summary'] ) ||
241 ( !is_null( $params['sectiontitle'] ) && $this->section
=== 'new' )
243 $result_array['parsedsummary'] = $this->formatSummary( $titleObj, $params );
244 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'parsedsummary';
247 $result->addValue( null, $this->getModuleName(), $result_array );
252 // Not cached (save or load)
253 if ( $params['pst'] ) {
254 $p_result = $this->pstContent
->getParserOutput( $titleObj, null, $popts );
256 $p_result = $this->content
->getParserOutput( $titleObj, null, $popts );
260 $result_array = array();
262 $result_array['title'] = $titleObj->getPrefixedText();
263 $result_array['pageid'] = $pageid ?
$pageid : $pageObj->getId();
265 if ( !is_null( $oldid ) ) {
266 $result_array['revid'] = intval( $oldid );
269 if ( $params['redirects'] && !is_null( $redirValues ) ) {
270 $result_array['redirects'] = $redirValues;
273 if ( $params['disabletoc'] ) {
274 $p_result->setTOCEnabled( false );
277 if ( isset( $prop['text'] ) ) {
278 $result_array['text'] = $p_result->getText();
279 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'text';
282 if ( !is_null( $params['summary'] ) ||
283 ( !is_null( $params['sectiontitle'] ) && $this->section
=== 'new' )
285 $result_array['parsedsummary'] = $this->formatSummary( $titleObj, $params );
286 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'parsedsummary';
289 if ( isset( $prop['langlinks'] ) ) {
290 $langlinks = $p_result->getLanguageLinks();
292 if ( $params['effectivelanglinks'] ) {
293 // Link flags are ignored for now, but may in the future be
294 // included in the result.
295 $linkFlags = array();
296 Hooks
::run( 'LanguageLinks', array( $titleObj, &$langlinks, &$linkFlags ) );
302 if ( isset( $prop['langlinks'] ) ) {
303 $result_array['langlinks'] = $this->formatLangLinks( $langlinks );
305 if ( isset( $prop['categories'] ) ) {
306 $result_array['categories'] = $this->formatCategoryLinks( $p_result->getCategories() );
308 if ( isset( $prop['categorieshtml'] ) ) {
309 $result_array['categorieshtml'] = $this->categoriesHtml( $p_result->getCategories() );
310 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'categorieshtml';
312 if ( isset( $prop['links'] ) ) {
313 $result_array['links'] = $this->formatLinks( $p_result->getLinks() );
315 if ( isset( $prop['templates'] ) ) {
316 $result_array['templates'] = $this->formatLinks( $p_result->getTemplates() );
318 if ( isset( $prop['images'] ) ) {
319 $result_array['images'] = array_keys( $p_result->getImages() );
321 if ( isset( $prop['externallinks'] ) ) {
322 $result_array['externallinks'] = array_keys( $p_result->getExternalLinks() );
324 if ( isset( $prop['sections'] ) ) {
325 $result_array['sections'] = $p_result->getSections();
328 if ( isset( $prop['displaytitle'] ) ) {
329 $result_array['displaytitle'] = $p_result->getDisplayTitle() ?
330 $p_result->getDisplayTitle() :
331 $titleObj->getPrefixedText();
334 if ( isset( $prop['headitems'] ) ||
isset( $prop['headhtml'] ) ) {
335 $context = $this->getContext();
336 $context->setTitle( $titleObj );
337 $context->getOutput()->addParserOutputMetadata( $p_result );
339 if ( isset( $prop['headitems'] ) ) {
340 $headItems = $this->formatHeadItems( $p_result->getHeadItems() );
342 $css = $this->formatCss( $context->getOutput()->buildCssLinksArray() );
344 $scripts = array( $context->getOutput()->getHeadScripts() );
346 $result_array['headitems'] = array_merge( $headItems, $css, $scripts );
349 if ( isset( $prop['headhtml'] ) ) {
350 $result_array['headhtml'] = $context->getOutput()->headElement( $context->getSkin() );
351 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'headhtml';
355 if ( isset( $prop['modules'] ) ) {
356 $result_array['modules'] = array_values( array_unique( $p_result->getModules() ) );
357 $result_array['modulescripts'] = array_values( array_unique( $p_result->getModuleScripts() ) );
358 $result_array['modulestyles'] = array_values( array_unique( $p_result->getModuleStyles() ) );
359 // To be removed in 1.27
360 $result_array['modulemessages'] = array();
361 $this->setWarning( 'modulemessages is deprecated since MediaWiki 1.26' );
364 if ( isset( $prop['jsconfigvars'] ) ) {
365 $result_array['jsconfigvars'] =
366 ApiResult
::addMetadataToResultVars( $p_result->getJsConfigVars() );
369 if ( isset( $prop['encodedjsconfigvars'] ) ) {
370 $result_array['encodedjsconfigvars'] = FormatJson
::encode(
371 $p_result->getJsConfigVars(), false, FormatJson
::ALL_OK
373 $result_array[ApiResult
::META_SUBELEMENTS
][] = 'encodedjsconfigvars';
376 if ( isset( $prop['modules'] ) &&
377 !isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) {
378 $this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " .
379 "or 'encodedjsconfigvars'. Configuration variables are necessary " .
380 "for proper module usage." );
383 if ( isset( $prop['indicators'] ) ) {
384 $result_array['indicators'] = (array)$p_result->getIndicators();
385 ApiResult
::setArrayType( $result_array['indicators'], 'BCkvp', 'name' );
388 if ( isset( $prop['iwlinks'] ) ) {
389 $result_array['iwlinks'] = $this->formatIWLinks( $p_result->getInterwikiLinks() );
392 if ( isset( $prop['wikitext'] ) ) {
393 $result_array['wikitext'] = $this->content
->serialize( $format );
394 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'wikitext';
395 if ( !is_null( $this->pstContent
) ) {
396 $result_array['psttext'] = $this->pstContent
->serialize( $format );
397 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'psttext';
400 if ( isset( $prop['properties'] ) ) {
401 $result_array['properties'] = (array)$p_result->getProperties();
402 ApiResult
::setArrayType( $result_array['properties'], 'BCkvp', 'name' );
405 if ( isset( $prop['limitreportdata'] ) ) {
406 $result_array['limitreportdata'] =
407 $this->formatLimitReportData( $p_result->getLimitReportData() );
409 if ( isset( $prop['limitreporthtml'] ) ) {
410 $result_array['limitreporthtml'] = EditPage
::getPreviewLimitReport( $p_result );
411 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'limitreporthtml';
414 if ( isset( $prop['parsetree'] ) ||
$params['generatexml'] ) {
415 if ( !isset( $prop['parsetree'] ) ) {
416 $this->logFeatureUsage( 'action=parse&generatexml' );
418 if ( $this->content
->getModel() != CONTENT_MODEL_WIKITEXT
) {
419 $this->dieUsage( "parsetree is only supported for wikitext content", "notwikitext" );
422 $wgParser->startExternalParse( $titleObj, $popts, Parser
::OT_PREPROCESS
);
423 $dom = $wgParser->preprocessToDom( $this->content
->getNativeData() );
424 if ( is_callable( array( $dom, 'saveXML' ) ) ) {
425 $xml = $dom->saveXML();
427 $xml = $dom->__toString();
429 $result_array['parsetree'] = $xml;
430 $result_array[ApiResult
::META_BC_SUBELEMENTS
][] = 'parsetree';
433 $result_mapping = array(
436 'categories' => 'cl',
440 'externallinks' => 'el',
445 'indicators' => 'ind',
446 'modulescripts' => 'm',
447 'modulestyles' => 'm',
448 'modulemessages' => 'm',
449 'properties' => 'pp',
450 'limitreportdata' => 'lr',
452 $this->setIndexedTagNames( $result_array, $result_mapping );
453 $result->addValue( null, $this->getModuleName(), $result_array );
457 * Constructs a ParserOptions object
459 * @param WikiPage $pageObj
460 * @param array $params
462 * @return ParserOptions
464 protected function makeParserOptions( WikiPage
$pageObj, array $params ) {
466 $popts = $pageObj->makeParserOptions( $this->getContext() );
467 $popts->enableLimitReport( !$params['disablepp'] );
468 $popts->setIsPreview( $params['preview'] ||
$params['sectionpreview'] );
469 $popts->setIsSectionPreview( $params['sectionpreview'] );
470 $popts->setEditSection( !$params['disableeditsection'] );
476 * @param WikiPage $page
477 * @param ParserOptions $popts
479 * @param bool $getWikitext
480 * @return ParserOutput
482 private function getParsedContent( WikiPage
$page, $popts, $pageId = null, $getWikitext = false ) {
483 $this->content
= $page->getContent( Revision
::RAW
); //XXX: really raw?
485 if ( $this->section
!== false && $this->content
!== null ) {
486 $this->content
= $this->getSectionContent(
488 !is_null( $pageId ) ?
'page id ' . $pageId : $page->getTitle()->getPrefixedText()
491 // Not cached (save or load)
492 return $this->content
->getParserOutput( $page->getTitle(), null, $popts );
495 // Try the parser cache first
496 // getParserOutput will save to Parser cache if able
497 $pout = $page->getParserOutput( $popts );
499 $this->dieUsage( "There is no revision ID {$page->getLatest()}", 'missingrev' );
501 if ( $getWikitext ) {
502 $this->content
= $page->getContent( Revision
::RAW
);
509 * @param Content $content
510 * @param string $what Identifies the content in error messages, e.g. page title.
511 * @return Content|bool
513 private function getSectionContent( Content
$content, $what ) {
514 // Not cached (save or load)
515 $section = $content->getSection( $this->section
);
516 if ( $section === false ) {
517 $this->dieUsage( "There is no section {$this->section} in " . $what, 'nosuchsection' );
519 if ( $section === null ) {
520 $this->dieUsage( "Sections are not supported by " . $what, 'nosuchsection' );
528 * This mimicks the behavior of EditPage in formatting a summary
530 * @param Title $title of the page being parsed
531 * @param Array $params the API parameters of the request
532 * @return Content|bool
534 private function formatSummary( $title, $params ) {
536 $summary = !is_null( $params['summary'] ) ?
$params['summary'] : '';
537 $sectionTitle = !is_null( $params['sectiontitle'] ) ?
$params['sectiontitle'] : '';
539 if ( $this->section
=== 'new' && ( $sectionTitle === '' ||
$summary === '' ) ) {
540 if ( $sectionTitle !== '' ) {
541 $summary = $params['sectiontitle'];
543 if ( $summary !== '' ) {
544 $summary = wfMessage( 'newsectionsummary' )
545 ->rawParams( $wgParser->stripSectionName( $summary ) )
546 ->inContentLanguage()->text();
549 return Linker
::formatComment( $summary, $title, $this->section
=== 'new' );
552 private function formatLangLinks( $links ) {
554 foreach ( $links as $link ) {
556 $bits = explode( ':', $link, 2 );
557 $title = Title
::newFromText( $link );
559 $entry['lang'] = $bits[0];
561 $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT
);
562 // localised language name in 'uselang' language
563 $entry['langname'] = Language
::fetchLanguageName(
564 $title->getInterwiki(),
565 $this->getLanguage()->getCode()
568 // native language name
569 $entry['autonym'] = Language
::fetchLanguageName( $title->getInterwiki() );
571 ApiResult
::setContentValue( $entry, 'title', $bits[1] );
578 private function formatCategoryLinks( $links ) {
585 // Fetch hiddencat property
587 $lb->setArray( array( NS_CATEGORY
=> $links ) );
588 $db = $this->getDB();
589 $res = $db->select( array( 'page', 'page_props' ),
590 array( 'page_title', 'pp_propname' ),
591 $lb->constructSet( 'page', $db ),
594 array( 'page_props' => array(
595 'LEFT JOIN', array( 'pp_propname' => 'hiddencat', 'pp_page = page_id' )
598 $hiddencats = array();
599 foreach ( $res as $row ) {
600 $hiddencats[$row->page_title
] = isset( $row->pp_propname
);
603 foreach ( $links as $link => $sortkey ) {
605 $entry['sortkey'] = $sortkey;
606 ApiResult
::setContentValue( $entry, 'category', $link );
607 if ( !isset( $hiddencats[$link] ) ) {
608 $entry['missing'] = true;
609 } elseif ( $hiddencats[$link] ) {
610 $entry['hidden'] = true;
618 private function categoriesHtml( $categories ) {
619 $context = $this->getContext();
620 $context->getOutput()->addCategoryLinks( $categories );
622 return $context->getSkin()->getCategories();
625 private function formatLinks( $links ) {
627 foreach ( $links as $ns => $nslinks ) {
628 foreach ( $nslinks as $title => $id ) {
631 ApiResult
::setContentValue( $entry, 'title', Title
::makeTitle( $ns, $title )->getFullText() );
632 $entry['exists'] = $id != 0;
640 private function formatIWLinks( $iw ) {
642 foreach ( $iw as $prefix => $titles ) {
643 foreach ( array_keys( $titles ) as $title ) {
645 $entry['prefix'] = $prefix;
647 $title = Title
::newFromText( "{$prefix}:{$title}" );
649 $entry['url'] = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT
);
652 ApiResult
::setContentValue( $entry, 'title', $title->getFullText() );
660 private function formatHeadItems( $headItems ) {
662 foreach ( $headItems as $tag => $content ) {
664 $entry['tag'] = $tag;
665 ApiResult
::setContentValue( $entry, 'content', $content );
672 private function formatCss( $css ) {
674 foreach ( $css as $file => $link ) {
676 $entry['file'] = $file;
677 ApiResult
::setContentValue( $entry, 'link', $link );
684 private function formatLimitReportData( $limitReportData ) {
686 $apiResult = $this->getResult();
688 foreach ( $limitReportData as $name => $value ) {
690 $entry['name'] = $name;
691 if ( !is_array( $value ) ) {
692 $value = array( $value );
694 ApiResult
::setIndexedTagNameRecursive( $value, 'param' );
695 $entry = array_merge( $entry, $value );
702 private function setIndexedTagNames( &$array, $mapping ) {
703 foreach ( $mapping as $key => $name ) {
704 if ( isset( $array[$key] ) ) {
705 ApiResult
::setIndexedTagName( $array[$key], $name );
710 public function getAllowedParams() {
714 ApiBase
::PARAM_TYPE
=> 'text',
719 ApiBase
::PARAM_TYPE
=> 'integer',
721 'redirects' => false,
723 ApiBase
::PARAM_TYPE
=> 'integer',
726 ApiBase
::PARAM_DFLT
=> 'text|langlinks|categories|links|templates|' .
727 'images|externallinks|sections|revid|displaytitle|iwlinks|properties',
728 ApiBase
::PARAM_ISMULTI
=> true,
729 ApiBase
::PARAM_TYPE
=> array(
745 'encodedjsconfigvars',
754 ApiBase
::PARAM_HELP_MSG_PER_VALUE
=> array(
755 'parsetree' => array( 'apihelp-parse-paramvalue-prop-parsetree', CONTENT_MODEL_WIKITEXT
),
760 'effectivelanglinks' => false,
762 'sectiontitle' => array(
763 ApiBase
::PARAM_TYPE
=> 'string',
765 'disablepp' => false,
766 'disableeditsection' => false,
767 'generatexml' => array(
768 ApiBase
::PARAM_DFLT
=> false,
769 ApiBase
::PARAM_HELP_MSG
=> array(
770 'apihelp-parse-param-generatexml', CONTENT_MODEL_WIKITEXT
772 ApiBase
::PARAM_DEPRECATED
=> true,
775 'sectionpreview' => false,
776 'disabletoc' => false,
777 'contentformat' => array(
778 ApiBase
::PARAM_TYPE
=> ContentHandler
::getAllContentFormats(),
780 'contentmodel' => array(
781 ApiBase
::PARAM_TYPE
=> ContentHandler
::getContentModels(),
786 protected function getExamplesMessages() {
788 'action=parse&page=Project:Sandbox'
789 => 'apihelp-parse-example-page',
790 'action=parse&text={{Project:Sandbox}}&contentmodel=wikitext'
791 => 'apihelp-parse-example-text',
792 'action=parse&text={{PAGENAME}}&title=Test'
793 => 'apihelp-parse-example-texttitle',
794 'action=parse&summary=Some+[[link]]&prop='
795 => 'apihelp-parse-example-summary',
799 public function getHelpUrls() {
800 return 'https://www.mediawiki.org/wiki/API:Parsing_wikitext#parse';