Page MenuHomePhabricator

Template style not applied if first use is inside a wikilink
Closed, DuplicatePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create a template (whether a normal template or a module-based template) that uses a template style
  • Use the template on an article, making sure the first use of the template is inside a wikilink

What happens?:
The style is not applied. The generated HTML suggests MediaWiki incorrectly concludes that the CSS has already been injected and therefore should be “deduplicated” (when in fact the CSS has never been injected).

You can verify that this is indeed the case by manually adding a templatestyles into the article, before the wikilink. When this templatestyles call is present, or when the first template call is not inside a wikilink, the style sheet is applied, but when the templatestyles call is absent and the template call is inside a wikilink, the style sheet is not applied.

Note that this means if the first template call is a wikilink but subsequent calls are not wikilinks, the template styles are still not applied because the first wikilink will disable the CSS.

What should have happened instead?:
Whether the style’s first use is inside a wikilink should have no relevance. Requested styles should be injected.

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
Demonstration:

Note that the CSS is not applied in test cases 2 and 5. In particular, in test case 5, even though the second use of the template is not a wikilink, the CSS is still not applied because MediaWiki has already incorrectly concluded that the CSS had been injected and should be “deduplicated”.