r79310 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79309‎ | r79310 | r79311 >
Date:01:14, 31 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
tweaked wikitext output
Modified paths:
  • /trunk/extensions/Validator/includes/parserHooks/Validator_Describe.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/parserHooks/Validator_Describe.php
@@ -135,7 +135,11 @@
136136 $descriptionData = $parserHook->getDescriptionData( ParserHook::TYPE_TAG ); // TODO
137137 $this->sortParameters( $descriptionData['parameters'], $descriptionData['defaults'] );
138138
139 - $description = "<h2> {$hookName} </h2>\n\n";
 139+ $description =
 140+ ( $parameters['pre'] ? '== ' : '<h2>' ) .
 141+ $hookName .
 142+ ( $parameters['pre'] ? ' ==' : '</h2>' ) . "\n\n";
 143+
140144
141145 if ( $descriptionData['description'] !== false ) {
142146 $description .= wfMsgExt( 'validator-describe-descriptionmsg', 'parsemag', $descriptionData['description'] );
@@ -169,10 +173,10 @@
170174 $description .= "\n\n";
171175 }
172176
173 - $description .= $this->getParameterTable( $descriptionData['parameters'], $descriptionData['defaults'] );
 177+ $description .= $this->getParameterTable( $descriptionData['parameters'], $descriptionData['defaults'], $parameters['pre'] );
174178
175179 if ( $parserHook->forTagExtensions || $parserHook->forParserFunctions ) {
176 - $description .= $this->getSyntaxExamples( $hookName, $descriptionData['parameters'], $parserHook, $descriptionData['defaults'] );
 180+ $description .= $this->getSyntaxExamples( $hookName, $descriptionData['parameters'], $parserHook, $descriptionData['defaults'], $parameters['pre'] );
177181 }
178182
179183 if ( $parameters['pre'] ) {
@@ -219,11 +223,16 @@
220224 * @param array $parameters
221225 * @param ParserHook $parserHook
222226 * @param array $defaults
 227+ * @param boolean $pre
223228 *
224229 * @return string
225230 */
226 - protected function getSyntaxExamples( $hookName, array $parameters, ParserHook $parserHook, array $defaults ) {
227 - $result = '<h3>' . wfMsg( 'validator-describe-syntax' ) . "</h3>\n\n";
 231+ protected function getSyntaxExamples( $hookName, array $parameters, ParserHook $parserHook, array $defaults, $pre ) {
 232+ $result = "\n\n" .
 233+ ( $pre ? '=== ' : '<h3>' ) .
 234+ wfMsg( 'validator-describe-syntax' ) .
 235+ ( $pre ? ' ===' : '</h3>' );
 236+ $result .= "\n\n";
228237
229238 $params = array();
230239 $requiredParams = array();
@@ -331,10 +340,11 @@
332341 *
333342 * @param array $parameters
334343 * @param array $defaults
 344+ * @param boolean $pre
335345 *
336346 * @return string
337347 */
338 - protected function getParameterTable( array $parameters, array $defaults ) {
 348+ protected function getParameterTable( array $parameters, array $defaults, $pre ) {
339349 $tableRows = array();
340350
341351 foreach ( $parameters as $parameter ) {
@@ -353,7 +363,12 @@
354364
355365 $table = implode( "\n|-\n", $tableRows );
356366
357 - $table = '<h3>' . wfMsg( 'validator-describe-parameters' ) . '</h3>' . "\n" .
 367+ $h3 =
 368+ ( $pre ? '=== ' : '<h3>' ) .
 369+ wfMsg( 'validator-describe-parameters' ) .
 370+ ( $pre ? ' ===' : '</h3>' );
 371+
 372+ $table = "$h3\n\n" .
358373 '{| class="wikitable sortable"' . "\n" .
359374 $table .
360375 "\n|}";

Status & tagging log