}
public function execute() {
- global $wgContLang;
-
// Get parameters
$params = $this->extractRequestParams();
* @param array $res Result array
* @param string $key Result key
* @param Message[] $msgs
+ * @param bool $joinLists
*/
- protected function formatHelpMessages( array &$res, $key, array $msgs ) {
+ protected function formatHelpMessages( array &$res, $key, array $msgs, $joinLists = false ) {
switch ( $this->helpFormat ) {
case 'none':
break;
$ret[] = $m->setContext( $this->context )->text();
}
$res[$key] = join( "\n\n", $ret );
+ if ( $joinLists ) {
+ $res[$key] = preg_replace( '!^(([*#:;])[^\n]*)\n\n(?=\2)!m', "$1\n", $res[$key] );
+ }
break;
case 'html':
foreach ( $msgs as $m ) {
$ret[] = $m->setContext( $this->context )->parseAsBlock();
}
- $res[$key] = join( "\n", $ret );
+ $ret = join( "\n", $ret );
+ if ( $joinLists ) {
+ $ret = preg_replace( '!\s*</([oud]l)>\s*<\1>\s*!', "\n", $ret );
+ }
+ $res[$key] = $ret;
break;
case 'raw':
$res[$key] = array();
foreach ( $msgs as $m ) {
- $res[$key][] = array(
+ $a = array(
'key' => $m->getKey(),
'params' => $m->getParams(),
);
+ if ( $m instanceof ApiHelpParamValueMessage ) {
+ $a['forvalue'] = $m->getParamValue();
+ }
+ $res[$key][] = $a;
}
$this->getResult()->setIndexedTagName( $res[$key], 'msg' );
break;
'name' => $name
);
if ( isset( $paramDesc[$name] ) ) {
- $this->formatHelpMessages( $item, 'description', $paramDesc[$name] );
+ $this->formatHelpMessages( $item, 'description', $paramDesc[$name], true );
}
if ( !empty( $settings[ApiBase::PARAM_REQUIRED] ) ) {
$this->context->msg( "apihelp-{$path}-paraminfo-{$tag}" )
->numParams( count( $i ) )
->params( $this->context->getLanguage()->commaList( $i ) )
+ ->params( $module->getModulePrefix() )
) );
$result->setSubelements( $info, 'text' );
$item['info'][] = $info;