Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F6326
22061.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:55 PM
2014-11-21 22:55:11 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
22061.patch
View Options
Index: api/ApiParse.php
===================================================================
--- api/ApiParse.php (revision 61004)
+++ api/ApiParse.php (working copy)
@@ -157,6 +157,10 @@
$result_array['displaytitle'] = $p_result->getDisplayTitle() ?
$p_result->getDisplayTitle() :
$titleObj->getPrefixedText();
+
+ if( isset( $prop['headitems'] ) )
+ $result_array['headitems'] = $this->formatHeadItems( $p_result->getHeadItems() );
+
if ( !is_null( $oldid ) )
$result_array['revid'] = intval( $oldid );
@@ -169,6 +173,7 @@
'images' => 'img',
'externallinks' => 'el',
'sections' => 's',
+ 'headitems' => 'hi'
);
$this->setIndexedTagNames( $result_array, $result_mapping );
$result->addValue( null, $this->getModuleName(), $result_array );
@@ -212,6 +217,17 @@
return $result;
}
+ private function formatHeadItems( $headItems ) {
+ $result = array();
+ foreach( $headItems as $tag => $content ) {
+ $entry = array();
+ $entry['tag'] = $tag;
+ $this->getResult()->setContent( $entry, $content );
+ $result[] = $entry;
+ }
+ return $result;
+ }
+
private function setIndexedTagNames( &$array, $mapping ) {
foreach ( $mapping as $key => $name ) {
if ( isset( $array[$key] ) )
@@ -242,6 +258,7 @@
'sections',
'revid',
'displaytitle',
+ 'headitems'
)
),
'pst' => false,
Index: OutputPage.php
===================================================================
--- OutputPage.php (revision 61004)
+++ OutputPage.php (working copy)
@@ -601,7 +601,7 @@
$this->enableClientCache( false );
}
$this->mNoGallery = $parserOutput->getNoGallery();
- $this->mHeadItems = array_merge( $this->mHeadItems, (array)$parserOutput->mHeadItems );
+ $this->mHeadItems = array_merge( $this->mHeadItems, $parserOutput->getHeadItems() );
// Versioning...
foreach ( (array)$parserOutput->mTemplateIds as $ns => $dbks ) {
if ( isset( $this->mTemplateIds[$ns] ) ) {
Index: parser/ParserOutput.php
===================================================================
--- parser/ParserOutput.php (revision 61004)
+++ parser/ParserOutput.php (working copy)
@@ -55,6 +55,7 @@
function &getImages() { return $this->mImages; }
function &getExternalLinks() { return $this->mExternalLinks; }
function getNoGallery() { return $this->mNoGallery; }
+ function getHeadItems() { return $this->mHeadItems; }
function getSubtitle() { return $this->mSubtitle; }
function getOutputHooks() { return (array)$this->mOutputHooks; }
function getWarnings() { return array_keys( $this->mWarnings ); }
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5872
Default Alt Text
22061.patch (2 KB)
Attached To
Mode
T24061: API: add prop=headitems to action=parse
Attached
Detach File
Event Timeline
Log In to Comment