Index: trunk/extensions/Validator/includes/parserHooks/Validator_Describe.php |
— | — | @@ -59,6 +59,9 @@ |
60 | 60 | |
61 | 61 | $params['hooks'] = new ListParameter( 'hooks' ); |
62 | 62 | |
| 63 | + $params['pre'] = new Parameter( 'pre', Parameter::TYPE_BOOLEAN ); |
| 64 | + $params['pre']->setDefault( 'off' ); |
| 65 | + |
63 | 66 | return $params; |
64 | 67 | } |
65 | 68 | |
— | — | @@ -94,19 +97,39 @@ |
95 | 98 | $parts[] = wfMsgExt( 'validator-describe-notfound', 'parsemag', $hookName ); |
96 | 99 | } |
97 | 100 | else { |
98 | | - $parts[] = $this->getParserHookDescription( $parserHook ); |
| 101 | + $parts[] = $this->getParserHookDescription( $hookName, $parameters, $parserHook ); |
99 | 102 | } |
100 | 103 | } |
101 | 104 | |
102 | | - return implode( "\n\n", $parts ); |
| 105 | + $output = $this->parser->parse( |
| 106 | + implode( "\n\n", $parts ), |
| 107 | + $this->parser->mTitle, |
| 108 | + $this->parser->mOptions, |
| 109 | + true, |
| 110 | + false |
| 111 | + ); |
| 112 | + |
| 113 | + return $output->getText(); |
103 | 114 | } |
104 | 115 | |
105 | | - protected function getParserHookDescription( ParserHook $parserHook ) { |
| 116 | + protected function getParserHookDescription( $hookName, array $parameters, ParserHook $parserHook ) { |
106 | 117 | $descriptionData = $parserHook->getDescriptionData( ParserHook::TYPE_TAG ); // TODO |
| 118 | + |
| 119 | + $description = "<h2> {$hookName} </h2>\n\n"; |
107 | 120 | |
| 121 | + $description .= $this->getParameterTable( $descriptionData['parameters'] ); |
| 122 | + |
| 123 | + if ( $parameters['pre'] ) { |
| 124 | + $description = '<pre>' . $description . '</pre>'; |
| 125 | + } |
| 126 | + |
| 127 | + return $description; |
| 128 | + } |
| 129 | + |
| 130 | + protected function getParameterTable( array $parameters ) { |
108 | 131 | $tableRows = array(); |
109 | 132 | |
110 | | - foreach ( $descriptionData['parameters'] as $parameter ) { |
| 133 | + foreach ( $parameters as $parameter ) { |
111 | 134 | $tableRows[] = $this->getDescriptionRow( $parameter ); |
112 | 135 | } |
113 | 136 | |
— | — | @@ -119,14 +142,13 @@ |
120 | 143 | $table = implode( "\n|-\n", $tableRows ); |
121 | 144 | |
122 | 145 | $table = <<<EOT |
123 | | -{| class="wikitable sortable"' |
| 146 | +{| class="wikitable sortable" |
124 | 147 | {$table} |
125 | 148 | |} |
126 | 149 | EOT; |
127 | 150 | } |
128 | 151 | |
129 | | - //return $table; // TODO |
130 | | - return '<pre>' . $table . '</pre>'; |
| 152 | + return $table; // TODO |
131 | 153 | } |
132 | 154 | |
133 | 155 | protected function getDescriptionRow( Parameter $parameter ) { |