Deploying TemplateStyles to production would give a lot more power to our template editors to create experiences that are optimised for mobile.
See the subtasks for the various things that need to be resolved before this work can be finalised.
Description
Details
Project | Branch | Lines +/- | Subject | |
---|---|---|---|---|
mediawiki/tools/release | master | +1 -0 | Branch TemplateStyles |
Event Timeline
Sorry for taking so long on this :( Somehow it managed to be #2 on my todo list for a very long time, with various other things always taking priority.
I don't have much opinion on the idea itself either way but after trying to do the implementation I think I agree it would be better to go without it. I don't see a way to do it without interacting with parser frames which are entirely undocumented and one of the more complex parts of the MediaWiki codebase, so depending on them would probably make a deployment more risky, not less.
Well, that's disappointing.
Why would including any others that pile up make it any worse, though?
As @Anomie noted there, T186965: Output HTML should not contain `<p><style>...</style></p>` is fixed (or will be once the patch is merged) for wikis using Remex but not for ones using Tidy (there a <templatestyles> tag in the middle of a paragraph will break it into two paragraphs), so switching to Remex should be a blocker for deploying TemplateStyles. (Tracking task: T175706: Progressively switch Wikimedia wikis from Tidy to RemexHTML. Search for wgTidyConfig here to see the current state; the ones with a null line still use Tidy.) Swedish and Russian have already switched so this has no immediate impact on plans.
Quick overview of the open technical tasks:
- T186965: Output HTML should not contain `<p><style>...</style></p>`:
- On sites using Tidy, styles will split paragraphs they are embedded in. Not an issue for templates which render as a block, but problematic for inline templates. Fixable, but with Tidy going away in a few month might not be worth the effort. IMO a deployment blocker for those wikis.
- On Parsoid (currently this means VE, Flow, the mobile apps and whatever third parties use the REST API) if the <templatestyles/> tag is on its own line it will result in an empty paragraph (and consequently weird spacing). Needs a Parsoid change; would be nice to get it fixed.
- T187141: Deduplicate template styles in mobileviews API: on the mobile web, styles are not deduplicated. Practically no user-visible impact, probably not much performance impact either.
- T187142: Deduplicate template styles in Parsoid: same thing on Parsoid.
- T188443: Wrap indicators in mw-parser-output class: TemplateStyle styles do not apply to page status indicators. Not sure how many indicators need CSS in the first place, I would expect them to mostly be images with no special CSS needs.
- T187729: Add a user right for editing sanitised CSS / TemplateStyles files: has been requested by some communities. IMO it's probably based on misunderstanding the threat model - there is not much point in preventing people from adding CSS to Template:*.css pages when they can just add it to the template or article directly.
That depends on the specific styles that apply to <p> tags. In Firefox 52.6.0 the <p> tag in question seems to collapse to 0 height in all skins on enwiki in a simple test, no weird spacing observed.
That depends. Try something like this:
<div style="height:10px; border:1px solid black;"></div> <p></p> <div style="height:10px; border:1px solid black;"></div>
The two divs should touch but won't.
A <p> with no content adds an empty box with 14px margin (on Vector, anyway); if the neighboring elements have at least that much margin (e.g. they are also paragraphs) the margins will collapse and there will be no change at all. Otherwise there will be some extra empty space.
Certainly a very fringe problem though.
Not sure I understand your question. Are you asking how to fix the lint errors so that wikis can switch from Tidy to Remex? In that case, there is plenty of information on https://www.mediawiki.org/wiki/Help:Extension:Linter and its subpages.
Hey there. Assuming you're talking about the switch to Remex, you can see https://www.mediawiki.org/wiki/Parsing/Replacing_Tidy/FAQ#What_will_editors_need_to_do? . You can ask any followup questions on the talk page there. At T190731 you'll see the list of the wikis whose switch is happening next week.
Shouldn't this be mentioned on https://www.mediawiki.org/wiki/Extension:TemplateStyles#Configuration (or #Caveats)?