mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-24 07:53:51 +00:00
Handle multi-part-template-block output from Parsoid's linter
The messaging is a bit tricky. In some cases, the flag is set because the output involves a single template and some top-level content -- not multiple templates always. Ex: '{{1x|<div>}}foo</span>' In this case, the entire content is considered template-affected because of DOM structuring reasons. This wikitext will generate lint errors with multi-part-template-block template info. In production usage, however, the probability is quite high that multiple templates will be involved. This is usually because of tables that are constructed with multiple templates, for example. So, if we want to fudge and hand-wave a bit, the i18n message can say that the output came from multiple templates. Bug: T162920 Change-Id: I35cee6787800b03724856775fdf53991ae8e8125
This commit is contained in:
parent
21dad2b852
commit
3eea8ed824
|
@ -43,6 +43,7 @@
|
|||
"linter-heading-high-priority": "High priority",
|
||||
"linter-heading-medium-priority": "Medium priority",
|
||||
"linter-heading-low-priority": "Low priority",
|
||||
"multi-part-template-block": "Output not from a single template",
|
||||
"pageinfo-linter": "Lint errors",
|
||||
"apihelp-query+linterrors-description": "Get a list of lint errors",
|
||||
"apihelp-query+linterrors-param-categories": "Categories of lint errors",
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
"linter-heading-high-priority": "Heading on [[Special:LintErrors]]",
|
||||
"linter-heading-medium-priority": "Heading on [[Special:LintErrors]]",
|
||||
"linter-heading-low-priority": "Heading on [[Special:LintErrors]]",
|
||||
"multi-part-template-block": "Table cell on [[Special:LintErrors]] indicating that content block is not produced by a single template",
|
||||
"pageinfo-linter": "Heading on ?action=info for a page if it has lint errors",
|
||||
"apihelp-query+linterrors-description": "{{doc-apihelp-description|query+linterrors}}",
|
||||
"apihelp-query+linterrors-param-categories": "{{doc-apihelp-param|query+linterrors|categories}}",
|
||||
|
|
|
@ -145,11 +145,16 @@ class LintErrorsPager extends TablePager {
|
|||
if ( !$lintError->templateInfo ) {
|
||||
return '—';
|
||||
}
|
||||
$templateName = $lintError->templateInfo['name'];
|
||||
$templateTitle = Title::newFromText( $templateName, NS_TEMPLATE );
|
||||
if ( !$templateTitle ) {
|
||||
// Shouldn't be possible...???
|
||||
return '—';
|
||||
|
||||
if ( isset( $lintError->templateInfo['multiPartTemplateBlock'] ) ) {
|
||||
return $this->msg( 'multi-part-template-block' )->escaped();
|
||||
} else {
|
||||
$templateName = $lintError->templateInfo['name'];
|
||||
$templateTitle = Title::newFromText( $templateName, NS_TEMPLATE );
|
||||
if ( !$templateTitle ) {
|
||||
// Shouldn't be possible...???
|
||||
return '—';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->linkRenderer->makeLink(
|
||||
|
|
Loading…
Reference in a new issue