Last modified: 2014-09-21 21:52:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T52750, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 50750 - Add css "onlyinprint" class to hide content from anything except print output
Add css "onlyinprint" class to hide content from anything except print output
Status: PATCH_TO_REVIEW
Product: MediaWiki
Classification: Unclassified
Interface (Other open bugs)
1.22.0
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-04 15:02 UTC by Volker Haas
Modified: 2014-09-21 21:52 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Volker Haas 2013-07-04 15:02:42 UTC
The Extension:Collection was recently altered as per community request. The intended result was lua support for PDF output (which was achieved). 

The problem is that due to technical reasons special templates "exclude in print" and "only in print" stopped working (and the functionality can't be restored).

There is an easy work-around for this, but it requires a css class used by Wikipedia that hides elements from regular output.

> .onlyinprint {display: none;}

Any content that is specially crafted for PDF output should be "marked" with the "onlyinprint" class and thus be hidden in the browser but visible in the PDFs.

The following fragment would therefore only be visible in a PDF:

> <div class="onlyinprint">blub onlyinprint</div>

=> I hearby kindly ask for the css snippet to be included in the Mediawiki core css file.

---------
Sidenote:
The opposite can already be achieved:
Content that is not supposed to be included in the PDF can already be marked with the css class "noprint":

> <div class="noprint">blub noprint</div>
Comment 1 Bartosz Dziewoński 2013-07-08 18:24:17 UTC
Wouldn't this also require some changes in Collection? Adding the class in core would only change the behavior of normal "printable" version (&printable=yes).

Also, I'd use "printonly" as the class name here – it IMO sounds better and would be consistent with some other naming conventions, like noinclude and includeonly.
Comment 2 Volker Haas 2013-07-12 08:34:54 UTC
Changes to the Collection extension are not necessary. The "noprint" case is already handled - only if the css class used to suppress printing mwlib would need to be adapted. 

Handling the onlyinprint/printonly case is basically isolated from the Collection extension, therefore it doesn't matter how the css class is named. However it is important that the css class name to hide things from display in the browser is used consistently in the css file and templates/articles/Collection extension help pages.
Comment 3 Derk-Jan Hartman 2013-07-12 08:43:01 UTC
Historically, we don't really like to do hiding in 'screen' versions of the HTML. printonly would basically reintroduce 'hiddenStructure' http://en.wikipedia.org/wiki/Wikipedia:HiddenStructure, a hack that we desperately sought to get rid of because it was far from ideal for accessibility reasons. I'd not quickly care to reintroduce such a thing. Also something like Google search would have no clue how to interpret something like that.

I'm not sure if this structure would still be controversial, but I think it is important to point this out.

(BTW, we do use similar tricks for targeting content at specific user groups (sysops), but this is generally only in interface or in maintenance templates), it isn't used in content, as this might be.
Comment 4 Helder 2013-07-12 12:21:59 UTC
(In reply to comment #3)
+1. It makes no sense to send content for the readers if it will be always hidden. If users shouldn't see it, just don't add it to the HTML of the pages.

We are still struggling on Portuguese Wikipedia to get rid of the 'hiddenStructure's:
http://pt.wikipedia.org/w/index.php?oldid=36240812
Comment 5 Helder 2013-11-13 12:25:55 UTC
Change 94954 had a related patch set uploaded by MaxSem:
Remove template blacklisting functionality

https://gerrit.wikimedia.org/r/94954
Comment 6 Gerrit Notification Bot 2014-03-25 20:32:44 UTC
Change 120865 had a related patch set uploaded by Apsdehal:
Adds onlyinprint class to skins

https://gerrit.wikimedia.org/r/120865

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links