Template talk:Start and end dates
Latest comment: 6 years ago by 78.28.45.127 in topic Whitespace
Whitespace
- For help with this template, please post a comment on the template talk page with a
{{reply to}}
one or more of the previous editors.
Can somebody please help remove the unnecessary whitespace in this template? Example:
- (January 12, 1916 – June 6, 2018 )
Note there is a space before the closing parenthesis. AlbanGeller (talk) 22:20, 20 June 2018 (UTC)
- I'm not an expert at coding, but looking at syntax it seems sound. I even added "0" next to the 6 in the day and that seems to not helped. This might be a bug. Phearson (talk) 00:48, 21 June 2018 (UTC)
- @AlbanGeller: What an interesting puzzle!
- The template is including a hidden set of elements for the start and end dates that is not displayed. This has to be for the benefit of some other tools, or WikiData, since the reader does not see them. The extra white space appears in front of the
span style="display:none">
directive which starts the hidden elements. My conclusion is that this extra space is generated automatically by the wikimedia engine. I have spent a couple of hours trying different ideas about how to keep this space from being inserted, all to no avail. - For instance, I added a span directive with class="dtvisible" around the main part of the template and left no space between its closing tag of the first span and the opening tag of the next. In most cases, this lack of space between tags would be preserved in the generated HTML, but, no, the unwanted space was still being inserted. I saw that you had had the idea of placing HTML comments around some of the possible white-space elements, but I tried the admittedly extreme experiment of removing all whitespace from the template preceding the span directive with no better luck.
- So that leaves us with a couple of alternatives that involve using a modified version of this template.
- I've tried out both of these options and either one will give you the visible result you wanted.
- However, I'm just an amateur at template programming, so we still need to get someone more experienced to look at this problem to see if there's a better solution available than cluttering up Template: space with additional variants for special purposes. — jmcgnh(talk) (contribs) 07:16, 21 June 2018 (UTC)
- @Netoholic: Pinging the template's author. 78.28.45.127 (talk) 18:10, 21 June 2018 (UTC)