Hi. I don't understand. Is there a chance that TemplateStyles tag has nothing to do with templates? Because I tried to add the tag in mainspace, and it works. Thank you.
Topic on Help talk:TemplateStyles
Yes, currently the only link to templates is the fact that it must be added to the template namespace (although it can be configured differently - Extension:TemplateStyles). It also seems that originally the templatestyles tag could only be added to the template namespace, as it would have no effect anywhere else. That's where it got its name from, aside from its primary usage planned in templates rather than pages.
Perhaps eventually they could all be moved to a dedicated namespace, e.g. Styles:Mainpage.css . In fact it is already possible,because any community can ask for an extra namespace, and those with the rights to change the content model can add as many styles there as they want.
It might be a good idea to read up on the background history of the tool (Requests for comment/Allow styling in templates).
Thank you for your answer. You just said "as it would have no effect anywhere else". Why do you think so? It's definetely wrong. Usage in other namespaces makes it more powerful dozens of times.
> It's definetely wrong. Usage in other namespaces makes it more powerful dozens of times.
You misunderstood. The <templatestyles> tag could only be added to the template namespace. The template in which it was added could be transcluded everywhere, and its styles would apply to content in the template.
At some point they removed that limitation, and now the <templatestyles> tag can be added everywhere. You can see the huge discussion about it here (https://phabricator.wikimedia.org/T483) and inhttps://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)/Archive_145#Template_styles
I also tried it at the time, so it was definitely working like that before they changed it.
So, what do you think, it helps in other namespaces or not?
It is certainly helpful to use in other namespaces. although it needs to be used cautiously. People might start adding it to signatures, and other unnecessary places. It will be really chaotic because sitewide css allows users to add frivolous features like blinking stuff, marquee, spinning things random transitions, and much more.
I'm not sure if any of those animations are whitelisted though.
Yes, it can be a problem. But the question is: Can I be sure it will work for mainspace forever or long enough? Because is so, it's much easy to use, and I can ask the commubity to deploy it now.
The whole purpose of the extension is to reduce the need of inline styling in the main namespace (and templates), so as long as that goal doesn't change it will continue to work there.
Whether it will work forever, or long enough is something only the developers (or their bosses) can answer.
It's not just inline. It actually resques RTL wiki from a huge problem we had before. And usage in mainspace will allow all the users make it easily, not just some that work with templates. How can I ask them, please?
One of their potential goals is to completely get rid of inline styling (https://phabricator.wikimedia.org/T37704
My guess is that they will keep it. Performance in some pages is pretty horrible because of an exaggerated number of html tags, and the inline styling added for them.
Anyway, phabricator would probably be the right place to ask about whether adding these tags directly to the namespaces is a feature or a bug, and whether it will remain if it is a feature.
Don't sure it's a good idea. How can I ask in phabricator? You mean some old task?
Just to be clear, my guess is that they'll keep templatestyles, and completely kill off inline styles.
Although the process of disabling inline styling will probably take many years.
Either a new task or maybe https://phabricator.wikimedia.org/T483. Since it is an RFC, and it still hasn't been closed, the final configuration for the implementation is probably still being discussed.
Thank you very much for your help.
You're welcome.
At some point use of the tag outside of templates might become forbidden. Ideally the CSS should be scoped to the template the tag is used in, and not affect other parts of the article, but that was implausible with current technology.
Thank you, Tgr (WMF). Could you tell me, please how vandal actions are prevented until then? As black background color, white font color or 15% font size? Maybe only autopatrolled users can edit sanitized css or something?
They aren't; vandalism enabled by TemplateStyles is not particularly worse than plain inline styles vandalism. (Which is to say, you can already do pretty nasty things via inline syles.) That can be changed if it proves to be a problem. See also the FAQ answer.
(For context, the project focused on technical issues so far and had no product owner. Soon it will get one, so it's possible some decisions or priorities will be reevaluated.)
Thank you, Tgr. It looks as bad news. ערן, what do you think?
I agree with the last answer of Tgr, that vandalism by TemplateStyles is not worse than plain inline vandalism.
Ok, you are the boss.
I have no plans and know of no plans to remove the ability to use <templatestyles> outside of templates. I can't promise the Editing Contributors team might not try to do that in the future though. They've already reserved the right to make the styles not apply to any content outside of the template that actually contains the tag.
For vandalism of stylesheets themselves, the primary mechanism is to protect the stylesheets as you'd protect any template. It would probably be possible to set a default protection level for everything that uses the content model, but since most problematic things that can be done with TemplateStyles can be done with inline CSS too that doesn't seem like something that needs attention right now.
For vandalism by including a stylesheet onto a page, again, since most problematic things that can be done with TemplateStyles can be done with inline CSS too that doesn't seem like something that needs attention right now.
Thank for your answer, Anomie, but there are two huge differences between inline vandalism and stylesheet. One: The last does not appear in watchlist of users that watch the page, not the stylesheet. Two: if user that watches some page see anonime user changed something in line 55 of page, and they does not know css, they can see the line 55 result and check if it looks reasonable. If they even knew about stylesheet edit, they can't know where they should look in the page without some css master help. So I thought that only autopatrolled should edit sanitized css, it will resolve these problems. Am I wrong?
Your "One" applies equally well to template vandalism, and communities already deal with that. They should deal with TemplateStyles stylesheets in the same manner.
Your "Two" doesn't make sense. They can see the diff of the TemplateStyles stylesheet as easily as they can see the diff of a wikitext page. In neither case does MediaWiki say "line 55" and expect the user to figure out which line that is. Unless you're trying to say that they'd have to understand CSS well enough to figure out what a change to the stylesheet is going to do to the page as a whole? But even then, a change in a complex module or template is unlikely to be clear to someone unfamiliar with Lua or complex wikitext in the same way.
Well. Anomie: We deal with template vandalism by protecting templates that used in 10,000 articles for example. Here it will be used in one article.\ About two: neither. The css font-size:35% added to text can be checked immediately. When it added to class name, you should understand how to find where this class is used - how to find affected places in the article.