Difference between revisions of "Template talk:Date"

From The iPhone Wiki
Jump to: navigation, search
(Question)
Line 1: Line 1:
== Question ==
+
== Purpose ==
 
What is the point of having this template? It's not difficult to type out "13 Mar 2015" in a table. --[[User:Dialexio|Dialexio]] ([[User talk:Dialexio|talk]]) 15:37, 13 March 2015 (UTC)
 
What is the point of having this template? It's not difficult to type out "13 Mar 2015" in a table. --[[User:Dialexio|Dialexio]] ([[User talk:Dialexio|talk]]) 15:37, 13 March 2015 (UTC)
:Dates should be written out with a non-breaking space (<code>&amp;nbsp;</code>) between the "items". <code><nowiki>{{date|2015|03|13}}</nowiki></code> produces <code>13&amp;nbsp;Mar&amp;nbsp;2015</code>. Sure, we could litter the source with <code>&amp;nbsp;</code> escape codes, but it's easier to understand the markup without syntax highlighting or any other fun stuff.<br />This isn't a good analogy, but why do bother indenting code with comment tags (<code>&lt;!-- comment --&gt;</code>) when one could just not indent at all? Because it's easier to read. What's easier to understand at first glance: <code>9:30&amp;nbsp;13&amp;nbsp;Mar&amp;nbsp;2015</code> or <code><nowiki>{{date|2015|03|13|09|30}}</nowiki></code>? I don't know about you, but I'd prefer the second option (and so does [[User:iAdam1n|Adam]]). So again, it's not necessary, but it makes the markup easier to read. --[[User:5urd|5urd]] ([[User talk:5urd|talk]]) 16:37, 13 March 2015 (UTC)
+
:Dates should be written out with a non-breaking space (<code>&amp;nbsp;</code>) between the "items". <code><nowiki>{{date|2015|03|13}}</nowiki></code> produces <code>13&amp;nbsp;Mar&amp;nbsp;2015</code>. Sure, we could litter the source with <code>&amp;nbsp;</code> escape codes, but it's easier to understand the markup without syntax highlighting or any other fun stuff.<br />This isn't a good analogy, but why bother indenting template code with comment tags (<code>&lt;!-- comment --&gt;</code>) when one could just not indent at all? Because it's easier to read. What's easier to understand at first glance: <code>9:30&amp;nbsp;13&amp;nbsp;Mar&amp;nbsp;2015</code> or <code><nowiki>{{date|2015|03|13|09|30}}</nowiki></code>? I don't know about you, but I'd prefer the second option (and so does [[User:iAdam1n|Adam]]). So again, it's not necessary, but it makes the markup easier to read. --[[User:5urd|5urd]] ([[User talk:5urd|talk]]) 16:37, 13 March 2015 (UTC)
 
::Okay, that makes more sense. (I've never indented HTML with comments, but I digress.) But wouldn't it have been easier to just assign a fixed width or use CSS (<code>white-space:nowrap</code> or <code>white-space:pre</code>)? --[[User:Dialexio|Dialexio]] ([[User talk:Dialexio|talk]]) 02:02, 14 March 2015 (UTC)
 
::Okay, that makes more sense. (I've never indented HTML with comments, but I digress.) But wouldn't it have been easier to just assign a fixed width or use CSS (<code>white-space:nowrap</code> or <code>white-space:pre</code>)? --[[User:Dialexio|Dialexio]] ([[User talk:Dialexio|talk]]) 02:02, 14 March 2015 (UTC)
  +
:::We could, but that would mean that everywhere we use a date, we have to wrap it in a <code>&lt;span&gt;</code> tag. I personally would prefer <code><nowiki>{{date|2015|03|14}}</nowiki></code> over <code>&lt;span style="white-space:nowrap;"&gt;14 Mar 2015&lt;/span&gt;</code>. Or did you mean, why is <code>14&amp;nbsp;Mar&amp;nbsp;2015</code> instead of <code>&lt;span style="white-space:nowrap;"&gt;14 Mar 2015&lt;/span&gt;</code>? For that, there is no real reason other than, I guess, I just didn't think of that. Also, I'm planning on adding an [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time HTML5 &lt;time&gt; tag] around the date with the machine-readable <code>datetime</code> attribute. We could then add <code>time { white-space: nowrap; }</code> to [[MediaWiki:Common.css]]. --[[User:5urd|5urd]] ([[User talk:5urd|talk]]) 19:20, 14 March 2015 (UTC)

Revision as of 19:20, 14 March 2015

Purpose

What is the point of having this template? It's not difficult to type out "13 Mar 2015" in a table. --Dialexio (talk) 15:37, 13 March 2015 (UTC)

Dates should be written out with a non-breaking space (&nbsp;) between the "items". {{date|2015|03|13}} produces 13&nbsp;Mar&nbsp;2015. Sure, we could litter the source with &nbsp; escape codes, but it's easier to understand the markup without syntax highlighting or any other fun stuff.
This isn't a good analogy, but why bother indenting template code with comment tags (<!-- comment -->) when one could just not indent at all? Because it's easier to read. What's easier to understand at first glance: 9:30&nbsp;13&nbsp;Mar&nbsp;2015 or {{date|2015|03|13|09|30}}? I don't know about you, but I'd prefer the second option (and so does Adam). So again, it's not necessary, but it makes the markup easier to read. --5urd (talk) 16:37, 13 March 2015 (UTC)
Okay, that makes more sense. (I've never indented HTML with comments, but I digress.) But wouldn't it have been easier to just assign a fixed width or use CSS (white-space:nowrap or white-space:pre)? --Dialexio (talk) 02:02, 14 March 2015 (UTC)
We could, but that would mean that everywhere we use a date, we have to wrap it in a <span> tag. I personally would prefer {{date|2015|03|14}} over <span style="white-space:nowrap;">14 Mar 2015</span>. Or did you mean, why is 14&nbsp;Mar&nbsp;2015 instead of <span style="white-space:nowrap;">14 Mar 2015</span>? For that, there is no real reason other than, I guess, I just didn't think of that. Also, I'm planning on adding an HTML5 <time> tag around the date with the machine-readable datetime attribute. We could then add time { white-space: nowrap; } to MediaWiki:Common.css. --5urd (talk) 19:20, 14 March 2015 (UTC)