Template transclusion done "behind the scenes" when saving a user .js page
OpenPublic

Assigned To
None
Priority
Low
Author
Ilmari_Karonen
Subscribers
He7d3r, Ilmari_Karonen, Jackmcbarn, wikibugs-l
Projects
Reference
bz8761
Security
None
Description

If a user .js page (such as User:Foo/monobook.js) contains something that looks like template transclusion syntax, it is apparently parsed as such behind the scenes when the page is saved. The transcluded template is never actually shown to the user, since such pages are shown as raw wikitext, but if the template contains any category links, the .js page gets placed in those categories (although no categories are shown on the page itself) and is listed on Special:Whatlinkshere as transclusing the template.

Fixing this properly may be somewhat tricky, since the fact that wikilinks (including category links) and {{subst:...}} are parsed even on user .js pages is generally considered a desirable feature. (The former is used for keeping track of which user .js pages include which scripts, while the latter is used for including standard boilerplate code.) Ideally, the pages should probably go through the pre-save transform (for "subst:") and get parsed for wikilinks, but not for (non-subst) transclusions.

As a workaround, any occurrences of "{{" in user JavaScript may be mangled (for example as "{"+"{") or the entire script (or just the affected parts) may be wrapped in commented-out <nowiki> tags. However, using <nowiki> also disables subst: and link tracking.

Example pages:


Version: 1.10.x
Severity: normal
URL: https://en.wikipedia.org/wiki/Wikipedia:Village_pump_%28technical%29/Archive_AH#Problem_with_monobook.js_files

bzimport added a project: MediaWiki-Templates.Via ConduitNov 21 2014, 9:31 PM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz8761.
Ilmari_Karonen created this task.Via LegacyJan 25 2007, 4:09 AM
bzimport added a comment.Via ConduitJan 25 2007, 8:52 AM

ais523 wrote:

Note that most WMF wikis, at least, use templates for the 'owner' of a user subpage
to request its deletion. Trying to place a {{db-user}} template on a .js subpage of
my own (on the English Wikipedia), I found that the category didn't appear and the
page wasn't in [[CAT:CSD]] (but other users reported that the category did appear
when they tried it, so it's possible that this is an intermittent bug). So having
categories in templates appear on .js pages is a desirable feature sometimes, but not
always, and its operation appears to be intermittent at the moment.

He7d3r added a comment.Via ConduitApr 3 2011, 1:23 PM

(In reply to comment #1)

Note that most WMF wikis, at least, use templates for the 'owner' of a user
subpage to request its deletion. Trying to place a {{db-user}} template on a .js subpage of my own (on the English Wikipedia), I found that the category didn't appear and the page wasn't in CAT:CSD (but other users reported that the category did appear when they tried it

FWI: This was my case: after I added {{delete}} to my [[JS]] and [[CSS]] pages, I noticed the page was added to the [[Category:Speedy deletion]], but the link to that category was not displayed in the footer of the pages (making me think I did something wrong, until I looked at the category itself)

Is this problem related to Bug 17525?

bzimport added a comment.Via ConduitJul 18 2011, 4:25 AM

EN.WP.ST47 wrote:

This problem may be a duplicate of bug 8449.

Aklapper added a comment.Via ConduitAug 23 2014, 7:35 PM

(In reply to Dan Collins from comment #3)

This problem may be a duplicate of bug 8449.

Yeah, sounds like. Anybody eles agreeing that this is a dup?

He7d3r added a comment.Via ConduitAug 23 2014, 7:52 PM

I don't think so. I think that problem is fixed, because nowadays templates are not expanded in any way that would increase the size of JS and CSS pages.

Jackmcbarn added a comment.Via ConduitSep 20 2014, 6:38 PM

(In reply to Andre Klapper from comment #4)

(In reply to Dan Collins from comment #3)
> This problem may be a duplicate of bug 8449.

Yeah, sounds like. Anybody eles agreeing that this is a dup?

Yes.

  • This bug has been marked as a duplicate of bug 8449 ***
He7d3r added a comment.EditedVia ConduitSep 20 2014, 6:53 PM

This is not a duplicate. See T10761#129833.

Jackmcbarn added a comment.Via ConduitSep 20 2014, 7:11 PM

IMO, bug 8449 was never completely fixed, and this is just another symptom of it.

He7d3r edited the task description. (Show Details)Via WebDec 11 2014, 10:12 AM
He7d3r set Security to None.

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.