Add example property to HTML rendering

Follows-up ec0467c65a.

Bug: T53049
Change-Id: I07dd73b7e2ba0994f29e1b9e619c5cbf347d4d9d
This commit is contained in:
Timo Tijhof 2015-04-28 16:48:11 +01:00
parent 1dfab89159
commit 65b101e60c
3 changed files with 24 additions and 0 deletions

View file

@ -617,6 +617,11 @@ class TemplateDataBlob {
if ( $paramObj->default !== null ) {
$paramObj->default = self::getInterfaceTextInLanguage( $paramObj->default, $langCode );
}
// Param.example
if ( $paramObj->example !== null ) {
$paramObj->example = self::getInterfaceTextInLanguage( $paramObj->example, $langCode );
}
}
foreach ( $data->sets as $setObj ) {
@ -694,6 +699,11 @@ class TemplateDataBlob {
array(),
wfMessage( 'templatedata-doc-param-default' )->inLanguage( $lang )->text()
)
. Html::element(
'th',
array(),
wfMessage( 'templatedata-doc-param-example' )->inLanguage( $lang )->text()
)
. Html::element(
'th',
array(),
@ -783,6 +793,16 @@ class TemplateDataBlob {
$paramObj->default :
wfMessage( 'templatedata-doc-param-default-empty' )->inLanguage( $lang )->text()
)
// Example
. Html::element( 'td', array(
'class' => array(
'mw-templatedata-doc-muted' => $paramObj->example === null
)
),
$paramObj->example !== null ?
$paramObj->example :
wfMessage( 'templatedata-doc-param-example-empty' )->inLanguage( $lang )->text()
)
// Auto value
. Html::rawElement( 'td', array(
'class' => array(

View file

@ -18,6 +18,8 @@
"templatedata-doc-param-autovalue-empty": "empty",
"templatedata-doc-param-default": "Default",
"templatedata-doc-param-default-empty": "empty",
"templatedata-doc-param-example": "Example",
"templatedata-doc-param-example-empty": "empty",
"templatedata-doc-param-desc": "Description",
"templatedata-doc-param-desc-empty": "no description",
"templatedata-doc-param-name": "Parameter",

View file

@ -25,6 +25,8 @@
"templatedata-doc-param-autovalue-empty": "Displayed when a template parameter has no auto filled value (should not be a full sentence, used in a table).\n{{Identical|Empty}}",
"templatedata-doc-param-default": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Default}}",
"templatedata-doc-param-default-empty": "Displayed when a template parameter has no default value (should not be a full sentence, used in a table).\n{{Identical|Empty}}",
"templatedata-doc-param-example": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Example}}",
"templatedata-doc-param-example-empty": "Displayed when a template parameter has no example value (should be short, used in a table).\n{{Identical|Empty}}",
"templatedata-doc-param-desc": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Description}}",
"templatedata-doc-param-desc-empty": "Displayed when a template parameter has no description (should not be a full sentence, used in a table cell).\n{{Identical|No description}}",
"templatedata-doc-param-name": "Used as column heading in the table.\n{{Related|Templatedata-doc-param}}\n{{Identical|Parameter}}",