Template talk:Clear

From Wikimedia Commons, the free media repository
Jump to: navigation, search

Substitute[edit]

Should this be substituted by using

{{subst:Clear}}

I am often unsure when Wikipedia:Template substitution should be used. --Timeshifter 13:42, 23 October 2007 (UTC)

It can be, but it makes little difference performance-wise and kinda ruins the point of the template—to be a shortcut, so I wouldn't. Rocket000(talk) 19:37, 7 September 2008 (UTC)

Code[edit]

I changed it to

<br clear="all" />

instead of

<br style="clear:both" />

I did a search of Google, and it seems that

<br clear="all" />

is better supported. Also, this makes these 2 templates the same:

{{-}}

{{clear}}

Here is a Google search of the two code phrases, and one result:

Template not working as designed[edit]

{{clear}} and {{-}} are syntactically different templates from each other that do almost the same thing. Someone with editing privleges please change this template to the following version from en.wiki:

<div style="clear:both"></div><noinclude>{{documentation}}</noinclude>

For a technical explanation of the differences between the two syntaxes, please refer to w:Template talk:Clear. In a nutshell, the current version causes the MediaWiki software to add a paragraph with a <br> in it. This leads to excess spacing that is not always desirable. Actually, at the moment, the template is a redirect to {{-}}. It needs to be corrected so that the {{clear}} template uses an empty div with CSS formatting (the preferred current standard in Web design and now well supported by nearly all browsers in common use). That generally provides a little extra spacing, but not a whole paragraph plus a line break. Thanks in advance for fixing this! --Willscrlt (Talk) 09:35, 7 September 2008 (UTC)

Well, you're assuming our templates should be exactly like en.wp's, but ok. Would it be better to make {{-}} use <div style="clear:both" />? That one seems to be used more. Rocket000(talk) 19:29, 7 September 2008 (UTC)
I fully understand that each project is unique and that just because en.wiki does something one way (and en.books and meta do it the same way) doesn't automatically make it the best or only way to do things on other projects. However, I have created several templates from scratch and I have copied over several templates from en.wiki to en.books and a few to Commons, an also to a non-Foundation wiki that I administer. It really helps when templates work as expected. In this case, having two different ways of saying "Hey, I need a little extra space between these two things." is helpful. Sometimes the <br> is the better choice, and sometimes the empty <div> is the way to go. The difference is subtle, but the MediaWiki software does render each slightly differently, and the browsers do, too. The reason it is even an issue is because of how the MediaWiki software renders the templates. By placing {{-}} on a line of its own, it generates an empty paragraph with a line break inside (<p><br><\p>), which renders in a browser as a pretty large blank space. The {{clear}} template doesn't suffer from the extra spacing, because MediaWiki doesn't wrap <div> tags inside an empty paragraph. The CSS inside the <div> or <br> tag (style="clear:both") isn't even a factor at this point, because it doesn't affect whether or not MW inserts the blank paragraph.
I'm sure there are some templates here that were copied over from en.wiki that make use of {{clear}} that look a little funky as a result from the extra spacing. It's not a life or death thing, but having different options empowers template designers with the ability to make things look a little nicer and give the visitors a little bit better experience. It's like the difference between different bullet sizes ( · ∙ · •  ). You really only need one bullet, right? But it's nice to have different size options to get exactly the look that helps to give the best visual presentation to our visitors. Here at Commons, media is generally more important than written text, but that doesn't mean we can't strive to have good looking text, too.
As to changing {{-}} to <div style="clear:both" /> instead of <br clear="all" />, I don't think that's a good idea, either, for the same reason. Each template has a particular purpose, and keeping them distinct is helpful to template developers. Other projects, like Meta, use <div style="clear:both" /> for {{-}}, too. Standardization among popular templates is preferable to being unique. --Willscrlt (Talk) 23:26, 7 September 2008 (UTC)