}
if ( $this->section !== false ) {
- $this->content = $this->getSectionContent( $this->content, $titleObj->getText() );
+ $this->content = $this->getSectionContent( $this->content, $titleObj->getPrefixedText() );
}
if ( $params['pst'] || $params['onlypst'] ) {
if ( $this->section !== false && $this->content !== null ) {
$this->content = $this->getSectionContent(
$this->content,
- !is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getText()
+ !is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getPrefixedText()
);
// Not cached (save or load)
return $pout;
}
+ /**
+ * @param Content $content
+ * @param string $what Identifies the content in error messages, e.g. page title.
+ */
private function getSectionContent( Content $content, $what ) {
// Not cached (save or load)
$section = $content->getSection( $this->section );
);
}
- public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), array(
- array(
- 'code' => 'params',
- 'info' => 'The page parameter cannot be used together with the text and title parameters'
- ),
- array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
- array(
- 'code' => 'permissiondenied',
- 'info' => 'You don\'t have permission to view deleted revisions'
- ),
- array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
- array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
- array( 'nosuchpageid' ),
- array( 'invalidtitle', 'title' ),
- array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
- array(
- 'code' => 'notwikitext',
- 'info' => 'The requested operation is only supported on wikitext content.'
- ),
- ) );
- }
-
public function getExamples() {
return array(
'api.php?action=parse&page=Project:Sandbox' => 'Parse a page',