From 5e7b3994fd824b86c107685a1d8448888441b5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 17 Sep 2018 22:56:57 +0200 Subject: [PATCH] Move Parsoid output overrides to 'mediawiki.skinning.content.parsoid' skinStyles We need to load these only when VisualEditor is loaded. This is the best way to ensure that. They have been haphazardly placed in different files. The goal of this change is to move content styling for Minerva out of mobile.editor.ve/minerva.less, and thus to be able to move this file to mediawiki/extensions/MobileFrontend (T202978). But I spotted the other places while working on that. Moved as-is: * skins.minerva.content.styles/links.less * mobile.editor.ve/minerva.less No longer needed: * skins.minerva.content.styles/text.less Parsoid now uses tags for references rather than , so the existing rules for tags are enough. See T45094, . Was never needed: * skins.minerva.content.styles/thumbnails.less The styles from the core module 'mediawiki.skinning.content.parsoid' are never loaded, so we don't need to override them. Bug: T202978 Change-Id: I45e1cb89b65a41a29d2b1a361a79199745ccec14 --- .../skins.minerva.content.styles/links.less | 12 ----- .../skins.minerva.content.styles/text.less | 2 - .../thumbnails.less | 6 +-- skin.json | 4 +- .../minerva.less | 52 +++++++++++++++++++ skinStyles/mobile.editor.ve/minerva.less | 37 ------------- 6 files changed, 56 insertions(+), 57 deletions(-) create mode 100644 skinStyles/mediawiki.skinning.content.parsoid/minerva.less diff --git a/resources/skins.minerva.content.styles/links.less b/resources/skins.minerva.content.styles/links.less index 7a6c90f..728e41e 100644 --- a/resources/skins.minerva.content.styles/links.less +++ b/resources/skins.minerva.content.styles/links.less @@ -62,15 +62,3 @@ a { background: none !important; padding: 0 !important; } - -// Numbered external links, copied from content.parsoid.less -// TODO: Separate theme-agnostic rules from that module -// so we can load it here. -.mw-parser-output { - counter-reset: mw-numbered-ext-link; - - a[ rel~='mw:ExtLink' ]:empty:after { - content: '[' counter( mw-numbered-ext-link ) ']'; - counter-increment: mw-numbered-ext-link; - } -} diff --git a/resources/skins.minerva.content.styles/text.less b/resources/skins.minerva.content.styles/text.less index 13cc94f..435b64a 100644 --- a/resources/skins.minerva.content.styles/text.less +++ b/resources/skins.minerva.content.styles/text.less @@ -62,7 +62,6 @@ i { font-style: italic; } -.mw-ref, // For Parsoid content (e.g. mediawiki.skinning.content.parsoid) sup { vertical-align: super; } @@ -71,7 +70,6 @@ sub { vertical-align: sub; } -.mw-ref, // For Parsoid content (e.g. mediawiki.skinning.content.parsoid) sub, sup { font-size: 0.75em; diff --git a/resources/skins.minerva.content.styles/thumbnails.less b/resources/skins.minerva.content.styles/thumbnails.less index 7a76a37..77ffffc 100644 --- a/resources/skins.minerva.content.styles/thumbnails.less +++ b/resources/skins.minerva.content.styles/thumbnails.less @@ -43,11 +43,7 @@ } // Hide the image magnification icon normally displayed in image captions - .magnify, - // Parsoid version of magnification icon (T160960) - figure[ typeof*='mw:Image/Thumb' ] > a:after, - figure[ typeof*='mw:Video/Thumb' ] > a:after, - figure[ typeof*='mw:Audio/Thumb' ] > a:after { + .magnify { display: none; } } diff --git a/skin.json b/skin.json index 4303f8d..5c4c41e 100644 --- a/skin.json +++ b/skin.json @@ -105,7 +105,9 @@ "mediawiki.special.search.styles": [ "skinStyles/mediawiki.special.search.styles/minerva.less" ], - "mediawiki.skinning.content.parsoid": [], + "mediawiki.skinning.content.parsoid": [ + "skinStyles/mediawiki.skinning.content.parsoid/minerva.less" + ], "mediawiki.hlist": [ "skinStyles/mediawiki.hlist/minerva.less" ], diff --git a/skinStyles/mediawiki.skinning.content.parsoid/minerva.less b/skinStyles/mediawiki.skinning.content.parsoid/minerva.less new file mode 100644 index 0000000..0c6a854 --- /dev/null +++ b/skinStyles/mediawiki.skinning.content.parsoid/minerva.less @@ -0,0 +1,52 @@ +/** + * Style Parsoid HTML+RDFa output consistent with wikitext from PHP parser. + */ + +/* + * Auto-numbered external links + * (copied from MediaWiki's content.parsoid.less) + */ +.mw-parser-output { + counter-reset: mw-numbered-ext-link; + + a[ rel~='mw:ExtLink' ]:empty:after { + content: '[' counter( mw-numbered-ext-link ) ']'; + counter-increment: mw-numbered-ext-link; + } +} + +/** + * Block media items + * (mostly derived from MediaWiki's content.parsoid.less) + */ +figure[ typeof*='mw:Image' ], +figure[ typeof*='mw:Video' ], +figure[ typeof*='mw:Audio' ] { + max-width: 100%; + // Defaults to right alignment when not explicitly set. Should be flippable. + margin: 0.6em 0 0.6em 1.4em; + + &.mw-halign-left { + /* @noflip */ + margin: 0.6em 1.4em 0.6em 0; + /* @noflip */ + clear: left; + /* @noflip */ + float: left; + } + + &.mw-halign-right { + /* @noflip */ + margin: 0.6em 0 0.6em 1.4em; + /* @noflip */ + clear: right; + /* @noflip */ + float: right; + } + + &.mw-halign-center { + margin: 0.6em auto 0.6em auto; + clear: none; + float: none; + } +} diff --git a/skinStyles/mobile.editor.ve/minerva.less b/skinStyles/mobile.editor.ve/minerva.less index db7eb20..58bad79 100644 --- a/skinStyles/mobile.editor.ve/minerva.less +++ b/skinStyles/mobile.editor.ve/minerva.less @@ -8,43 +8,6 @@ h1, h2, h3, h4, h5 { display: block; } - - // Styling for images (as output by Parsiod) - // These styles are mostly derived from content.parsoid.less, which the Minerva skin - // opts out of (since the styles are largely Vectorish). - // FIXME: Once Parser and Parsoid output are synchronized, we'll want to move these - // from here into the regular Minerva content styles. - figure[ typeof*='mw:Image' ], - figure[ typeof*='mw:Video' ], - figure[ typeof*='mw:Audio' ] { - max-width: 100%; - // Defaults to right alignment when not explicitly set. Should be flippable. - margin: 0.6em 0 0.6em 1.4em; - - &.mw-halign-left { - /* @noflip */ - margin: 0.6em 1.4em 0.6em 0; - /* @noflip */ - clear: left; - /* @noflip */ - float: left; - } - - &.mw-halign-right { - /* @noflip */ - margin: 0.6em 0 0.6em 1.4em; - /* @noflip */ - clear: right; - /* @noflip */ - float: right; - } - - &.mw-halign-center { - margin: 0.6em auto 0.6em auto; - clear: none; - float: none; - } - } } .overlay-content {