Template talk:Hide in print

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
WikiProject Wikipedia-Books (Rated Template-class)
WikiProject iconThis template is within the scope of WikiProject Wikipedia-Books a collaborative effort to improve the coverage of Wikipedia:Books.
 Template  This template does not require a rating on the project's quality scale.
 

Merge[edit]

This should possible be merged with {{Noprint}} --TheDJ (talkcontribs) 12:25, 1 March 2009 (UTC)

There isn't really any legit reason I can see to use {{noprint}} - the noprint CSS class has no use outside of templates. --- RockMFR 21:00, 10 March 2009 (UTC)
I have done some testing of these templates and it seems TheDJ might be right. {{noprint}} works well and hides its content both when printing directly from the web browser, and when exporting as a PDF or book. While {{hide in print}} only hides its content when exporting as a PDF or book, which probably is not as useful.
Although it has one use: It is the exact opposite of {{only in print}} which only shows its content when exporting as a PDF or book. But now we have {{print version}} that supplies that "print vs. web" selection in a single template, so now we don't need {{hide in print}} as the opposite to {{only in print}}.
If we are going to redirect {{hide in print}} to {{noprint}} then we must first check if there is any such {{hide in print}} vs. {{only in print}} usage and change that to use {{print version}} instead.
--David Göthberg (talk) 03:09, 21 February 2010 (UTC)
noprint wraps it's argument in <span> tags. which is much different from generating no content at all, which "hide in print" does. "hide in print" also does not hide content when viewed as print version in your browser. They are very different templates. Schmir (talk) 09:58, 1 March 2010 (UTC)
I'll contact the devs to see if they have some insight to offer. Headbomb {ταλκκοντριβς – WP Physics} 05:04, 1 March 2010 (UTC)

Hides edit link bug[edit]

Template {{Hide in print}} appears to suppress the edit link when it encloses a section. See the See also section of this Zeppelin article version.

Without the Hide in print wrapper, any printed book or PDF will include the unwanted See also section.

Is there a workaround or fix? 84user (talk) 08:13, 11 September 2009 (UTC)

I ran some tests, this happens when a header is inside parserFunctions and other such template code. It is a MediaWiki bug and not the fault of this template. Look at this code:
{{#if: x
| === Header 1 ===
}}
{{{a parameter|=== Header 2 ===}}}
Here on this talkpage that renders this:

Header 1

Header 2

The above two headers get no ed
The above two headers get no edit section links. The strange thing is that when transcluding in a whole page, like we do in template {{documentation}}, then we do get edit section links no matter how much parserFunctions surround the transclusion.
I did a search on bugzilla: and found some bug reports that seems related to such header problems, and the devs seems to be working on it. But I didn't understand those bug reports and discussions so I am not entirely sure the devs are aware of this.
--David Göthberg (talk) 03:09, 21 February 2010 (UTC)
I found a solution. You can use <div class="noprint"></div> instead of this template when you want to hide a whole section. Then the section headers still get their edit links. Like this:
<div class="noprint">
=== Header 3 ===
</div>

Header 3[edit]

I have applied this fix to the "See also" section of the Zeppelin article. Note that this means the section is now also hidden when printing directly from the web browser. (I have no point of view on when and if we should hide "See also" sections.)
Technical details:
When just hiding some words or a sentence use <span class="noprint"></span> instead, or this template. Since span tags don't cause new lines before and after themselves. But when hiding "block elements" such as tables, images, whole paragraphs or headings, then we must use div tags for HTML technical reasons. But if only hiding block elements but no heading, then this template can be used instead of the div tags.
--David Göthberg (talk) 13:34, 22 February 2010 (UTC)
Thank you for this analysis. These details should help me and others better understand template behaviour. I also looked at bugzilla but the details are somewhat beyond me. bugzilla:21844 could be related. I am going to remove the markup around the See also in Zeppelin as I now think it's better to see it in print than have markup that must be confusing to an editor. I will leave a html comment linking here so that Hide in print could be re-instated when the MediaWiki bug is resolved. -84user (talk) 20:57, 24 February 2010 (UTC)

Possible Fix[edit]

Since the fix for Bug 45861 was activated, template based content omission in exports does not work anymore.

A possible fix would be to rewrite this template to

<span class="noprint">{{{1|}}}</span>

He!ko (talk) 10:20, 26 March 2013 (UTC)

That would make it identical to {{noprint}}, so might as well redirect then right ? —TheDJ (talkcontribs) 23:26, 26 March 2013 (UTC)
Check my comment which links to the required resources for a work-around. ----Volker.haas (talk) 15:10, 4 July 2013 (UTC)
There should be a warning in the doc for this template that it is presently not functioning. Boud (talk) 23:36, 30 October 2013 (UTC)

Per above, please redirect this template to Template:Noprint. The functionality for this template has been removed years ago and there are no signs it will come back, while noprint works as documented at mw:Manual:Skinning#Print_mode (user:saper confirmed). --Nemo 08:35, 6 October 2014 (UTC)

Yes check.svg DoneMr. Stradivarius ♪ talk ♪ 10:10, 6 October 2014 (UTC)
This has since been reverted, as it broke table formatting that relied on the code {{{!}} being the first thing that the template outputs. It looks like a proper fix will be more laborious than just redirecting. I've started the ball rolling at Wikipedia:Templates for discussion/Log/2014 October 6#Template:Only in print. — Mr. Stradivarius ♪ talk ♪ 13:44, 6 October 2014 (UTC)