Page MenuHomePhabricator

Search results display css from TemplateStyles tags
Closed, ResolvedPublic

Description

In Swedish Wikipedia css code from TemplateStyles are shown in article extracts in search results in some searches:

For example first item "Alec John Such" in this search shows:

"nested-talk{border:1px solid#c0c090;background-color:#f8eaba;width:100%;margin:2px 4px}Alec John Such, född 14 november 1956 i Yonkers i New York, är en amerikansk musiker"

and third item "John Entwistle" shows:

".mw-parser-output .infobox.geography .maptable th{border:0;padding:0}John Alec Entwistle, född 9 oktober 1944 i Chiswick i västra London, död 27 juni"

Those articles contains templates that get their css from TemplateStyles tags.

Details

Related Gerrit Patches:

Event Timeline

Lejonel created this task.Mar 12 2018, 9:02 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 12 2018, 9:02 PM
Lejonel updated the task description. (Show Details)Mar 12 2018, 9:05 PM
Restricted Application added projects: Discovery, Discovery-Search. · View Herald TranscriptMar 12 2018, 9:18 PM
Tgr added a subscriber: Tgr.Mar 13 2018, 2:15 AM

Probably style and link should be added to WikiTextStructure::$excludedElementSelectors?

Deskana triaged this task as High priority.Mar 13 2018, 10:52 AM
Deskana added a subscriber: Deskana.

This blocks further deployments of TemplateStyles.

Anomie added a subscriber: Anomie.Mar 13 2018, 6:56 PM

link tags aren't needed since they have no content:

>>> $text = 'text ' . Html::inlineStyle( 'stylesheet' ) . ' ' . Html::element( 'link', [ 'rel' => 'mw-deduplicated-inline-style', 'href' => 'mw-data:abcdefg' ] );                                                                             
=> "text <style>stylesheet</style> <link rel="mw-deduplicated-inline-style" href="mw-data:abcdefg"/>"
>>> ( new WikiTextStructure( new ParserOutput( $text ) ) )->getMainText()
=> "text stylesheet"

Change 419259 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] WikiTextStructure: Exclude <style> tags

https://gerrit.wikimedia.org/r/419259

Tgr moved this task from Up next to Doing on the TemplateStyles board.Mar 13 2018, 8:38 PM
EBjune added a subscriber: EBjune.Mar 13 2018, 9:11 PM
TheDJ awarded a token.Mar 14 2018, 3:15 PM

Change 419259 merged by jenkins-bot:
[mediawiki/core@master] WikiTextStructure: Exclude <style> tags

https://gerrit.wikimedia.org/r/419259

From a code perspective this is done now, the fix will be deployed with 1.31.0-wmf.26.

@dcausse, do you want to keep this open to track the reindexing you mentioned, or should we close this task?

@Anomie I think this task can be closed, I have T189694 to track the reindexing.

Anomie closed this task as Resolved.Mar 14 2018, 7:22 PM
Anomie claimed this task.

Thanks for addressing this so quickly @Anomie

ggellerman moved this task from Doing to Done on the TemplateStyles board.Mar 21 2018, 6:14 PM