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.
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)reply
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:
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.
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
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.
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)reply
Possible Fix
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