X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiParamInfo.php;h=b74d52866f8c4666737f088c8b999f6732ec22bf;hb=f26e34fa2866584f7a86f559578aab7b2bb35f7a;hp=07670f6eae9634c46d1229dc99d95fb1e19ba3cf;hpb=79168e0f8b0d20d2ffdfbbb51d1acf42ecea05a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiParamInfo.php b/includes/api/ApiParamInfo.php index 07670f6eae..b74d52866f 100644 --- a/includes/api/ApiParamInfo.php +++ b/includes/api/ApiParamInfo.php @@ -37,8 +37,6 @@ class ApiParamInfo extends ApiBase { } public function execute() { - global $wgContLang; - // Get parameters $params = $this->extractRequestParams(); @@ -131,8 +129,9 @@ class ApiParamInfo extends ApiBase { * @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; @@ -143,6 +142,9 @@ class ApiParamInfo extends ApiBase { $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': @@ -150,16 +152,24 @@ class ApiParamInfo extends ApiBase { 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*\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; @@ -234,7 +244,7 @@ class ApiParamInfo extends ApiBase { '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] ) ) { @@ -331,6 +341,7 @@ class ApiParamInfo extends ApiBase { $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;