Template talk:Hide in print

From GLPS2 Wiki
Jump to: navigation, search
WikiProject Wikipedia-Books (Rated Template-class)
80pxThis template is within the scope of WikiProject Wikipedia-Books a collaborative effort to improve the coverage of Wikipedia:Books.
16px Template  This template does not require a rating on the quality scale.



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

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 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 ===

Header 3

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)
Personal tools