Template talk:Tag: Difference between revisions
→Redundant space (again): Reply |
|||
Line 142: | Line 142: | ||
:::::No, we can say pretty certainly say that MediaWiki is not varying the output HTML based on browser just for the br tag (otherwise the caches would double). Something in the browsers is being funky, so someone should consult the MediaWiki source to verify what it's actually being output as. |
:::::No, we can say pretty certainly say that MediaWiki is not varying the output HTML based on browser just for the br tag (otherwise the caches would double). Something in the browsers is being funky, so someone should consult the MediaWiki source to verify what it's actually being output as. |
||
:::::Either way, you do not {{em|need}} to use this template for arbitrary tags. I have demonstrated two ways in the response above (nowiki, as well as character escape) that suffice for a particular page if this template does not provide the precision necessary. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 19:01, 23 March 2024 (UTC) |
:::::Either way, you do not {{em|need}} to use this template for arbitrary tags. I have demonstrated two ways in the response above (nowiki, as well as character escape) that suffice for a particular page if this template does not provide the precision necessary. [[User:Izno|Izno]] ([[User talk:Izno|talk]]) 19:01, 23 March 2024 (UTC) |
||
::::::OK, my mistake on the first point. (Incidentally, how would one "consult the MediaWiki source"?) |
|||
::::::And yes, I know we don't need to use this template. That's why I gave two options: update the template, or do it manually, i.e. use <code><nowiki><code><nowiki><br/></nowiki></code></nowiki></code>. I didn't say the former was the only way, just more clean-looking on pages where the <code><nowiki><br/></nowiki></code> version is needed. But I'm happy to go along with whatever you think would be the better option. [[User:Mr. Starfleet Command|Mr. Starfleet Command]] ([[User talk:Mr. Starfleet Command|talk]] • [[Special:Contributions/Mr. Starfleet Command|contributions]]) 19:12, 23 March 2024 (UTC) |
Revision as of 19:12, 23 March 2024
Category link
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
{{editprotected}}
- This protected page has been detected in [[Category:Wikipedia formatting templates]], but that category has been redirected to [[Category:Wikipedia formatting and function templates]]. Please update the category link. --RussBot (talk) 13:10, 27 August 2008 (UTC)
ref group=
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
I don't think the last example actually works. It simply throws an error:
Unknown extension tag "ref group=note"
--Subversive Sound (talk) 21:21, 27 January 2010 (UTC)
<ref group=note>
seems to be working. ---— Gadget850 (Ed) talk 00:36, 28 January 2010 (UTC)
Re-use of same reference
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
Hello, how do you input the same instance of tag#ref?
I.e. so it'll look like: "The cat was in a hat.[1] Also the hat was on the cat.[1]"
As it is now it justs auto-updates numbering so it's [1] and [2] with same content.
Cheers!Sandman888 (talk) 19:28, 29 April 2010 (UTC)
- The #tag magic word has no relationship to this tag template. #tag:ref should be used only where you need to include
<ref>...</ref>
tags inside a reference. The syntax is {{#tag:ref|content|name="name"|group="groupname"}} where the optional name and groupname must come after the content. ---— Gadget850 (Ed) talk 23:36, 29 April 2010 (UTC)
Attributes in closing tag
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
Attributes used in the opening tag are placed in the closed tag. This is an error, or how should it be tagged?
<ref group=note>foo</ref group=note>
Douglaspaulwade (talk) 14:31, 30 June 2010 (UTC)
- You need to use
|params=
to include text in the open tag that is not included in the close tag:
{{tag|ref|params=group=note|content=foo}}
<ref group=note>foo</ref>
One redundant space
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
Why
{{tag|references|single}} → <references />
and not
{{tag|references|single}} → <references/>
like here? --79.118.40.95 (talk) 15:33, 22 March 2011 (UTC)
- HTML elements with no content are called empty elements. The space is required per specifactions.[1][2] ---— Gadget850 (Ed) talk 17:11, 22 March 2011 (UTC)
![](http://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Red_question_mark.svg/20px-Red_question_mark.svg.png)
- Gadget850 The space is no longer required, and may never have been, since
<ref/>
is a function of MediaWiki, not HTML or XTML. Finally got a definitive answer on this at Help talk:List-defined references#Formatting question. Would it be possible to remove the extra space from this template so the documentation isn't instructing editors to use an unnecessary space? It all adds up. Thanks! - —D'Ranged 1 VTalk 00:43, 24 February 2016 (UTC)
- @D'Ranged 1: The
{{tag}}
template is not just used for demonstrating<references />
and<ref name="refname" />
(which are MediaWiki extensions, and where the space is definitely optional), but is also used for demonstrating markup in HTML, XHTML, XML, SVG and several related markup languages. In some of these the space is mandatory. --Redrose64 (talk) 11:24, 24 February 2016 (UTC)
- @D'Ranged 1: The
- Gadget850 The space is no longer required, and may never have been, since
@Redrose64: Is it possible that you could alter the template so that the space in question is a non-breaking space ( )? On mobile, where paragraphs of text are wrapped a lot more, the tags with spaces can sometimes wrap around due to the space. It's insignificant but it can be confusing when the /> is dangling on the next line. OlliverWithDoubleL (talk) 09:38, 30 July 2022 (UTC)
- No, because the template is usually used for example code. People sometimes mark-and-copy the tag(s), and if they copied a nbsp they would then paste invalid markup. As far as HTML, XHTML and the others that I mentioned are concerned, newlines count as whitespace but nbsps do not. --Redrose64 🌹 (talk) 21:47, 30 July 2022 (UTC)
Intuitiveness problem
One of the most common styles for referring to [X]HTML mark-up is <span>...</span>
(I'm using "..." as a literal string here). It's certainly more common than <span></span>
, and it should be easy to do, instead of requiring long-winded input like {{tag|span|content=...}}
. By extending the switch
, we should be able to have it default to assuming that any second parameter that does not match one of the pre-defined values is actually content, unless |content=
is explicitly specified. After this fix, {{tag|span|...}}
would produce <span>...</span>
. Better yet, not only fix that (it would make it easier to do things like {{tag|span|{{var|text here}}}}
to produce <span>text here</span>
), but make the default display be the ... version, and have the odd <span></span>
version be something manually obtained with a new value, |2=empty
, along with the open
, closed
, etc. values. — SMcCandlish Talk⇒ ʕ(Õلō)ˀ Contribs. 20:29, 19 June 2011 (UTC)
- Asuming that the second parameter is content requires a lot of contitional coding, so I don't see that happening. Having said that, showing ... is easy if a pair has no content. If that is the established convention, I'll just add it. — Edokter (talk) — 22:59, 19 June 2011 (UTC)
- That would be very helpful. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 11:49, 13 August 2014 (UTC)
Style
With the style change to <code>
, I propose to with to switch to <kbd>
. The box is just too much. -- Gadget850 talk 15:34, 10 August 2014 (UTC)
- But semantically, its output is code.
-- [[User:Edokter]] {{talk}}
18:56, 10 August 2014 (UTC)- But it is keyboard code, not output. -- Gadget850 talk 19:55, 10 August 2014 (UTC)
- I ment the template's output; the HTML is code.
-- [[User:Edokter]] {{talk}}
20:32, 10 August 2014 (UTC)- I give up. I overrode the style in my CSS. Help:HTML in wikitext will just have to look horrible to everyone else. -- Gadget850 talk 01:04, 11 August 2014 (UTC)
- It's not that bad, and we didn't have a mass-complaint campaign.
-- [[User:Edokter]] {{talk}}
08:52, 11 August 2014 (UTC)
- It's not that bad, and we didn't have a mass-complaint campaign.
- I give up. I overrode the style in my CSS. Help:HTML in wikitext will just have to look horrible to everyone else. -- Gadget850 talk 01:04, 11 August 2014 (UTC)
- I ment the template's output; the HTML is code.
- But it is keyboard code, not output. -- Gadget850 talk 19:55, 10 August 2014 (UTC)
- This is wrong; we don't abandon use of the correct markup (
<code>...</code>
) to get around a style issue; just fix it with CSS. The<kbd>...</kbd>
element is for examples of user input (i.e. the values of parameters, and only when we're giving literal examples, not variables, for which use<var>...</var>
), not theparameter=
code! It's semantically incorrect to use kbd this way. See Jonesey95's CSS fixes at the essentially duplicate discussions at Help talk:Citation style 1 and Template talk:Para. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 11:52, 13 August 2014 (UTC)
![](http://upload.wikimedia.org/wikipedia/en/thumb/f/fb/Yes_check.svg/20px-Yes_check.svg.png)
Fixed for me in personal CSS. -- Gadget850 talk 12:58, 13 August 2014 (UTC)
- @SMcCandlish: Not Jonesey95's CSS fix - mine. See Wikipedia:Village pump (technical)/Archive 129#Displaying 'code' font text and search for "inherit". --Redrose64 (talk) 15:20, 13 August 2014 (UTC)
- @Redrose64: Answered at Help talk:Citation Style 1/Archive 5#Restore error message style.
- @Gadget850: Re: "Resolved" – Fair enough for your part, but proposals to make semantic-HTML-breaking changes have continued at Template talk:Para. <sigh> — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 19:21, 13 August 2014 (UTC)
- @SMcCandlish: Not Jonesey95's CSS fix - mine. See Wikipedia:Village pump (technical)/Archive 129#Displaying 'code' font text and search for "inherit". --Redrose64 (talk) 15:20, 13 August 2014 (UTC)
Let's consolidate this discussion at Template talk:Para#Site-wide solution. Having it forked like this is pointless and already leading to conflicting proposals. — SMcCandlish ☺ ☏ ¢ ≽ʌⱷ҅ᴥⱷʌ≼ 19:21, 13 August 2014 (UTC)
Changes
@Sardanaphalus and Edokter: Would y'all please work this out in the sandbox and talk page. I can't follow the issues from edit summaries. -- Gadget850 talk 21:32, 14 December 2014 (UTC)
- I try to, but if others don't, I can't either.
-- [[User:Edokter]] {{talk}}
22:38, 14 December 2014 (UTC)- How about we revert back to the last stable version, give it a full-prot and discuss? I see nothing above that proposes, let alone supports, any of the recent changes. --Redrose64 (talk) 10:48, 15 December 2014 (UTC)
- I agree, this should have been discussed first.
-- [[User:Edokter]] {{talk}}
12:16, 15 December 2014 (UTC)
- I agree, this should have been discussed first.
- How about we revert back to the last stable version, give it a full-prot and discuss? I see nothing above that proposes, let alone supports, any of the recent changes. --Redrose64 (talk) 10:48, 15 December 2014 (UTC)
Name tag
Is it possible to add a name parameter (like with <ref name="refname">....) if multiple targets on a page needs the same tag. Thanks, Sander.v.Ginkel (Je suis Charlie) 12:12, 5 March 2015 (UTC)
- You can use
|params=
for that. See the documentation.-- [[User:Edokter]] {{talk}}
12:23, 5 March 2015 (UTC)
Template edit request
![]() | This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Could somebody add another parameter which is similar to |single
/ |s
but does not include a space before the slash?
- Example
{{tag|references|s2}}
→ <references/>
―PapíDimmi (talk | contribs) 17:21, 17 May 2017 (UTC)
Not done: please establish a consensus for this alteration before using the
{{edit template-protected}}
template. This doesn't seem to add any value to the template, TBH. This template is for demonstration of a tag, not to provide a user any which way to display trivial whitespace. Izno (talk) 21:01, 17 May 2017 (UTC)
Closing tag broken
![]() | This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Closing tags aren't displayed. For example {{tag|b|c}}
results in: </b>
. This is also evidenced in the the documentation. Anon126 (notify me of responses! / talk / contribs) 00:41, 6 August 2017 (UTC)
Done – Train2104 (t • c) 01:04, 6 August 2017 (UTC)
Template-protected edit request on 29 June 2018
![]() | This edit request has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
I have worked on the coding for this template to modify the rendering for the HTML hidden comment which currently renders as <!--comment--> seeming odd without white space on each side of the comment; the normal appearance when that markup is in use. The hidden comments above and below this request (as seen when editing the page) demonstrates hiding text with HTML comment tags and the white space mentioned here is easily observable from the markup in use.
The modified coding causes the hidden comment example to render instead as <!-- comment -->; consistent with the markup's standard appearance normal to its use. All of the other {{tag}} examples are unaffected by the code modifications associated with this edit request, and they remain unchanged under the modified coding.
The template's documentation uses 14 examples to encompass its functionality. All 14 are listed on Template:Tag/testcases along with the same examples rendering from the modified coding, as drawn from Template:Tag/sandbox. The comparisons demonstrate the new code's fitness for its requested use herein.
To effect this edit request, I am asking for Template:Tag to be completely blanked, and for its content to be replaced by the complete coding that is in the sandbox by this edit. Thank you. --John Cline (talk) 01:30, 30 June 2018 (UTC)
- I have set
|answered=
to yes; placing this request on hold. There are other aspects of this change that require testing I have yet to do. I will request this edit anew if and when these additional tests are successfully logged. Thank you.--John Cline (talk) 03:18, 2 July 2018 (UTC)
Redundant space (again)
Though the space often used in void element tags (i.e., <br />
) may have been the proper usage in the past, MediaWiki now seems to convert said usage to <br/>
. (You can see this by opening the page source of any Wikipedia article containing a <br />
.) So, now that the space is actually redundant (unlike the last time this was brought up), can we get rid of it? Mr. Starfleet Command (talk • contributions) 13:14, 23 March 2024 (UTC)
- @Mr. Starfleet Command: I refer you to my post of 11:24, 24 February 2016 (UTC):
The
--Redrose64 🌹 (talk) 14:24, 23 March 2024 (UTC){{tag}}
template is ... also used for demonstrating markup in HTML, XHTML, XML, SVG and several related markup languages. In some of these the space is mandatory.- @Redrose64: Fair enough. However, there are some instances where this template needs to give a result without the space, such as at H:BR, which currently tells us that "All of them [
<br>, <br >, <br/>, <br />
] are converted to<br />
in the HTML that browsers read." This is incorrect, as they are actually converted into<br/>
. Do you recommend editing that page to manually declare<br/>
, or should an option be added to this template allowing for the removal of the space? Mr. Starfleet Command (talk • contributions) 14:44, 23 March 2024 (UTC)- Always give examples when you state that such-and-such happens. I've tried viewing the source for Iffley Halt railway station, using the Ctrl+U feature of Firefox. In that, I see three br tags with a space, and none without. So I don't see a need for any change to this template. I would also refer you to the post of 21:01, 17 May 2017 (UTC) by Izno (talk · contribs). --Redrose64 🌹 (talk) 17:52, 23 March 2024 (UTC)
- Here is some brs of each form:
<br>
: A
B<br >
: A
B<br/>
: A
B<br />
: A
B- Interestingly, in Firefox source view (Ctrl + U), these all get normalized to
<br />
; when viewing in Firefox console (F12) they all get normalized as<br>
. I think the source view is what MediaWiki is generating and the console is just the 'prettified' version because developers prefer to think in HTML 5 and not in XHTML. - That would seem to suggest that some browsers are doing different things with their display, possibly. One would need to investigate the code path in MediaWiki directly or pull out the good old Wireshark. Izno (talk) 18:09, 23 March 2024 (UTC)
- @Izno and Redrose64: On Chrome, the tags are normalized to
<br/>
in the page source, while they become<br>
in the console. Given the info you have both provided, it seems that MediaWiki converts the tags slightly differently on different browsers (with the space on Firefox, without it on Chrome). In the end, the browsers both seem to convert it to<br>
, which is why that displays in the console. - So the accurate statement for H:BR would be, "The MediaWiki software uses any of them for a single forced line break, converting them to
<br/>
or<br />
, depending on which browser is being used." The question at hand is how to achieve this. Should we simply use<code><nowiki><br/></nowiki></code>
, or should we add that functionality to this template? I support the latter, as it simplifies the process and would make it easier to illustrate these differences on other pages. - Do you have an opinion on the matter, Izno? Mr. Starfleet Command (talk • contributions) 18:37, 23 March 2024 (UTC)
- No, we can say pretty certainly say that MediaWiki is not varying the output HTML based on browser just for the br tag (otherwise the caches would double). Something in the browsers is being funky, so someone should consult the MediaWiki source to verify what it's actually being output as.
- Either way, you do not need to use this template for arbitrary tags. I have demonstrated two ways in the response above (nowiki, as well as character escape) that suffice for a particular page if this template does not provide the precision necessary. Izno (talk) 19:01, 23 March 2024 (UTC)
- OK, my mistake on the first point. (Incidentally, how would one "consult the MediaWiki source"?)
- And yes, I know we don't need to use this template. That's why I gave two options: update the template, or do it manually, i.e. use
<code><nowiki><br/></nowiki></code>
. I didn't say the former was the only way, just more clean-looking on pages where the<br/>
version is needed. But I'm happy to go along with whatever you think would be the better option. Mr. Starfleet Command (talk • contributions) 19:12, 23 March 2024 (UTC)
- @Izno and Redrose64: On Chrome, the tags are normalized to
- @Redrose64: Fair enough. However, there are some instances where this template needs to give a result without the space, such as at H:BR, which currently tells us that "All of them [