Page MenuHomePhabricator

Print stylesheet should be explicitly editable (e.g. MediaWiki:Print.css)
Closed, ResolvedPublic

Description

Author: cs

Description:
Could I request that, ala Monobook.css and Common.css, we are given access to
commonPrint.css? Currently we have a problem where some links are automatically
doing URL expansion, which is mucking up [[Template:Ref]] and [[Template:Note]].
This is causing problems for at least one editor, who is trying to create PDFs
out of webpages.


Version: unspecified
Severity: enhancement

Details

Reference
bz2889

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:40 PM
bzimport set Reference to bz2889.

What you can do is put an @media print section into [[MediaWiki:Monobook.css]].
You may be able to override things with !important declarations.

cs wrote:

OK, though I'm no real expert at CSS :( I have noted this on [[User:Lupo]]'s page... thanks for
the suggestion!

ayg wrote:

Note that @media-specified rules currently won't be used for the "printable
version" link, which is kind of confusing, but it's hard to see a fix unless you
can somehow force the browser to interpret the page as printed.

  • Bug 13831 has been marked as a duplicate of this bug. ***

Doesn't actually work -- applies in ?printable=yes print mode simulation, but not to the actual print stylesheet.

Reverted in r36474

r3638 - New

Same as r3638 but accounting for printing.
I favoured an if-based approach for clarity, but you may prefer a ternary operator. It's up to the committer :-)

Attached:

Merged Platonides and my patches in r36535. Now applies to printable=yes and to actual print media.

herd wrote:

It seems like the best way to do this would be to add another <link> attribute (below the current existing one) pointing to the appropriate MW message. And in printable=yes, remove the media="print".

In template skins:
<link rel="stylesheet" type="text/css" media="print" href="/skins-1.5/common/commonPrint.css?156" />
<link rel="stylesheet" type="text/css" media="print" href="/w/index.php?title=MediaWiki:Print.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=2678400" />

And in cologneblue/standard/nostalgia:
<link rel='stylesheet' type='text/css' media='print' href='/skins-1.5/common/wikiprintable.css?156' />
<link rel="stylesheet" type="text/css" media="print" href="/w/index.php?title=MediaWiki:Print.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=2678400" />

(In reply to comment #1)

What you can do is put an @media print section into [[MediaWiki:Monobook.css]].

Unlike @media print, the media="print" from the link is (and so can be) removed on printable=yes, allowing all changes in commonPrint.css (and hypothetically in this implementation of MediaWiki:Print.css), to apply without printing (or print preview). 2 cents

alexsm333 wrote:

Reopening, since the patch was self-reverted by ^demon in r36536.

Re-did in r40414, using the happy new style setup methods. MediaWiki:Print.css
available by default; MediaWiki:Handheld.css used if $wgHandheldStyle set up.