Jump to content

Template talk:For

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
[edit]

Unlike other hatnote templates like {{See also}} and {{Details}}, this one doesn't have its own Lua module (see Module:Hatnote). One thing that Lua provides is dynamic link formatting for things like section and category links. Have a look at the following and you'll see the difference:

Markup Renders as
{{see also|PAGE#SECTION}}
{{details|TOPIC|PAGE#SECTION}}
{{for|TOPIC|PAGE#SECTION}}

Ideally this template will eventually join its siblings in module-land. In the meantime, I would like to propose the following edit, using {{Format link}}, to make it behave more like the others:

{{Hatnote|For {{#if:{{{1|}}}|{{{1}}}|other uses}}, see {{format link|{{{2|{{PAGENAME}} (disambiguation)}}}}}{{#if:{{{3|}}}|{{#if:{{{4|}}}|, {{format link|{{{3}}}}}, {{#if:{{{5|}}}|{{format link|{{{4}}}}}, and {{format link|{{{5}}}}}|and {{format link|{{{4}}}}}}}| and {{format link|{{{3}}}}}}}}}.}}

Which would give us...

Markup Renders as
{{for|TOPIC|PAGE#SECTION}}

Does that look correct? Anyone interested can test it using {{For/sandbox}}, with the same parameters as you would use with this template. Ibadibam (talk) 22:36, 24 September 2014 (UTC)[reply]

Edit request

[edit]

Per above and this example. Ibadibam (talk) 23:30, 29 September 2014 (UTC)[reply]

 Done. Thank you — Martin (MSGJ · talk) 08:23, 1 October 2014 (UTC)[reply]
While I like the idea behind the proposed edit, the implementation caused some unwanted results in hatnotes such as at Black Widow (song) where the hatnote is {{For|other songs by the same title|Black Widow (disambiguation)#Songs|Black Widow}} where the expectation is for it to be displayed as a piped link. olderwiser 15:38, 3 October 2014 (UTC)[reply]
It's the same problem that appears when using the {{redirect}} template here. I left a note about that for Edokter (talk · contribs), now archived at User talk:Edokter/Archive 8#Monk (Doctor Who). --Redrose64 (talk) 16:41, 3 October 2014 (UTC)[reply]
The pipe hack seems to work there (for now), but I have no thoughts about how this should be handled in the future. -- [[User:Edokter]] {{talk}} 17:50, 3 October 2014 (UTC)[reply]

Second edit request

[edit]

I tested this edit in my user space (User:Hairy_Dude/For, test case at User:Hairy_Dude/sandbox for the time being) and {{format link}} appears to handle the specific problem identified above correctly now, so I'd like to see the template use it again. Hairy Dude (talk) 00:14, 1 May 2016 (UTC)[reply]

I currently see:
  • {{For}}: "For other songs by the same title, see Black Widow (disambiguation)#Songs and Black Widow."
  • Your output: "For other songs by the same title, see Black Widow (disambiguation) § Songs and Black Widow."
Looks correct. Give me a sec to check a few more things... — Andy W. (talk · contrib) 00:35, 1 May 2016 (UTC)[reply]
I should be done soon. FYI, this template has 116000+ transclusions, so I'm being extra careful. Your change definitely looks right though. Tried Special:Permalinks, namespaces with links, etc, all looks good. — Andy W. (talk · contrib) 00:53, 1 May 2016 (UTC)[reply]

@Hairy Dude:

I'm 99% sure you don't need colons in front of the parameters. I'm actually inclined to publish the current code at Template:For/sandbox (without colons in front), since Module:Hatnote's format link takes care of the colon issue. What was your reasoning about the colons? (in case I'm missing something here) — Andy W. (talk · contrib) 01:10, 1 May 2016 (UTC)[reply]

That's just what {{for}} has right now - all I did (at least, all I think I did) was replace [[ with {{format link| and ]] with }}. There was no other particular reason. I don't really know what their effect is, so I decided to be careful and leave them in. Hairy Dude (talk) 01:20, 1 May 2016 (UTC)[reply]
Here's essentially a master testcase I did:
{{For/sandbox|other songs by the same title|Black_Widow_(disambiguation)#Songs|Special:Permalink/717941754#Tennis_at_the_2012_Summer Olympics|Category:Wikipedia semi-protected templates|User talk:Example user#what}}, with/without colons in front, spaces vs underscores. {{For/sandbox}} was essentially the same as your version, without a colon (which format link is able to take care of). Thanks! :) — Andy W. (talk · contrib) 01:28, 1 May 2016 (UTC)[reply]
Done — Andy W. (talk · contrib) 01:28, 1 May 2016 (UTC)[reply]
Thanks for your work! Hairy Dude (talk) 01:52, 1 May 2016 (UTC)[reply]
Colons are only necessary if the linked page name begins with either (i) File: or (ii) Category:. It's needed to prevent (i) display of the image; (ii) inclusion in that category. --Redrose64 (talk) 08:29, 1 May 2016 (UTC)[reply]

Support for section linking

[edit]

This template seems not to change Article#Section into Article § Section as {{Further}} does. For instance, I was adding this hatnote:

  • {{for|a table of examples of palatalized n and l in Romance languages|Palatalization#Mouillé}}

So I had to use {{For2}}:

Is this intentional, or could it be remedied? — Eru·tuon 08:39, 3 January 2015 (UTC)[reply]

Oh, I see it was already mentioned. So a change was made fixing this problem, but then reverted? — Eru·tuon 08:46, 3 January 2015 (UTC)[reply]

I was coming to ask the same thing. Is this intentional?--Cúchullain t/c 16:56, 3 June 2015 (UTC)[reply]
The rationale for reverting this seems to be that section-liking broke piped links, such as here.
Curiously enough, I find that Black Widow (song) isn't linked from Black Widow.
That seems to be breaking some WP:PDAB advice, as I don't think "Black Widow" rises to the notability standards suggested by "Thriller" and "Revolver".
Nonetheless, I suppose this template should be fixed to recognize when a link is piped, and only use Article § Section on non-piped links. Wbm1058 (talk) 19:25, 13 September 2015 (UTC)[reply]

"Not to be confused with" typos

[edit]

I've occasionally seen the {{confused}} template used in the style of Google's "did you mean..." autocorrect, where one word is spelled very similarly to another. (Reality: "Not to be confused with Realty.") It seems a little perverse to present an easily-misread typo in a vague "don't confuse this with that" sentence where the reader may well misread it. Is it worth having a dedicated template for common typos? Or is "see also this similarly-spelled word" simply an inappropriate hatnote? --McGeddon (talk) 10:30, 15 July 2015 (UTC)[reply]

Unreadable

[edit]

This documentation is unreadable. Can it please give an example of how to code two possible alternatives? Prhartcom (talk) 00:09, 23 September 2015 (UTC)[reply]

@Prhartcom: I did this. It's a start. --Redrose64 (talk) 09:15, 23 September 2015 (UTC)[reply]
That helps. Still doesn't start at the beginning. Made another improvement. Prhartcom (talk) 02:14, 24 September 2015 (UTC)[reply]
I amended it; in particular, I reverted your change of "being produced by" to "producing", since it is incorrect to state

The third, fourth and fifth parameters are used to give two, three, or four supplementary links:

the last producing e.g. {{for|similar terms|Foobar|Bar|Baz|Quux}}.

However, if you really want that word, it would be correct to also exchange the example code with its demonstration, provided the two preceding demonstrations were also removed:

The third, fourth and fifth parameters are used to give two, three, or four supplementary links, {{for|similar terms|Foobar|Bar|Baz|Quux}} producing e.g. .

since "[code] produces [demo]" is equivalent to "[demo] being produced by [code]". --Redrose64 (talk) 10:06, 24 September 2015 (UTC)[reply]

Double periods?

[edit]

Is there any way to avoid the appearance of double periods at the end of a sentence? For instance, the page for Donald S. Lopez, Sr. uses the for template to point to Donald S. Lopez, Jr. (It looks like this: {{For|the Professor of Buddhism|Donald S. Lopez, Jr.}}). The period at the end of the junior appears right next to the sentence-ending period, and it looks awkward: For the Professor of Buddhism, see Donald S. Lopez, Jr.. <--- See the two periods at the end. Anything we can do about instances like this? Thanks 04:29, 4 February 2016 (UTC)

I'd second the need for this: A Theory of Justice requires a hatnote to A Theory of Justice: The Musical!, but this and other comparable templates all contain the period at the end, without giving an option to suppress it, as it currently comes up as punctuated (For the 2013 musical, see A Theory of Justice: The Musical!.). Is there the possibility of making it switchable for cases like these where the article title already ends in punctuation (e.g. |punc=no| to remove the period)? — Sasuke Sarutobi (talk) 10:02, 6 May 2016 (UTC)[reply]

This looks strange at Indigestion

[edit]

That article says (using this template) "For the Negativland album, see Dispepsi." But Dispepsi doesn't sound anything like Indigestion: it really needs an extra sentence saying "Dyspepsia redirects here" to explain why the link is being offered. Can the template do this? Equinox 20:22, 6 February 2017 (UTC)[reply]

@Equinox: I think what you're looking for is the template {{redirect}}. — Eru·tuon 00:26, 7 February 2017 (UTC)[reply]
Yep! I've changed it now. Equinox 18:07, 9 February 2017 (UTC)[reply]

Removing "other uses" defaulting

[edit]

I'd like to remove the defaulting to "other uses" when parameter 1 is empty or undefined. Instead, the template should show an error message instructing users to use {{other uses}} instead. While this might be mildly annoying to editors in each individual case, it avoids newbie-incomprehensible syntax like {{for|2=PAGE}} being left on pages where {{other uses|PAGE}} would be clearer, and an error message would be enough to instruct people to use the correct template.

Currently all offending cases are categorized in Category:Hatnote templates using unusual parameters; I've at various points corrected all the extant article-namespace cases, and there are none left as of this comment, but it collects them over time.

Does anyone have any objections to this change? {{Nihiltres |talk |edits}} 16:59, 19 June 2018 (UTC)[reply]

Seems like a good idea to me, assuming my proposal to merge the two templates fails. {{3x|p}}ery (talk) 17:13, 25 June 2018 (UTC)[reply]
There are so many cases of this use of {{For}} that it seems unnecessarily disruptive to replace it with an error message for the sole purpose of calling attention to something invisible to the reader. Better to fix it through automation. Ibadibam (talk) 22:14, 25 June 2018 (UTC)[reply]
No, that's incorrect. I wrote Module:For, and a while back set it up to categorize pages with that usage in Category:Hatnote templates using unusual parameters, and as of this comment there are zero article-namespace pages (and fewer than fifty total pages) in that category, which currently only collects that case (the others have been resolved). {{Nihiltres |talk |edits}} 02:02, 26 June 2018 (UTC)[reply]
Oh great. Ibadibam (talk) 22:27, 26 June 2018 (UTC)[reply]

I don't see significant objections here, and after waiting for the merge proposal to be resolved (it ended with no consensus), I'm picking this up again. I've set up the new behaviour in the module and template sandboxes, and you can currently see direct comparisons at Template:For/testcases. {{Nihiltres |talk |edits}} 19:58, 14 July 2018 (UTC)[reply]

@Nihiltres: Sorry for not pointing this out earlier, but I would oppose explicitly blocking "other uses" as simply unnecessary (this does not mean I oppose removing the defaulting). {{3x|p}}ery (talk) 21:04, 20 July 2018 (UTC)[reply]
@Pppery: That's fair, I suppose. I'd prefer to include it as uses of the exact-match case should probably be using {{other uses}} instead strictly for semantic clarity, but as {{for}} would still be reasonably correct usage for individual cases of "other X" it's probably OK to leave. As a compromise, why don't we leave the exact-match cases to populate Category:Hatnote templates using unusual parameters? {{Nihiltres |talk |edits}} 19:05, 21 July 2018 (UTC)[reply]
Well, fine with me I guess . {{3x|p}}ery (talk) 19:17, 21 July 2018 (UTC)[reply]
I've updated the sandbox to match the compromise. Look good now? {{Nihiltres |talk |edits}} 19:43, 21 July 2018 (UTC)[reply]
yes, except for the fact that the error message "no context parameter provided." is unclear. {{3x|p}}ery (talk) 22:38, 21 July 2018 (UTC)[reply]
Would you suggest an alternative? I'm trying to balance clarity with concision. I'll write up a longer explanation of the error in the template documentation, as the target of the help link, on implementation. {{Nihiltres |talk |edits}} 15:40, 22 July 2018 (UTC)[reply]
Just "no parameters specified"?. {{3x|p}}ery (talk) 14:28, 23 July 2018 (UTC)[reply]

"No parameters" would be incorrect, as it'll occur with{{for||second parameters|and further}}. I'm going to be bold and implement it; we can fine-tune the error message later as needed. {{Nihiltres |talk |edits}} 16:07, 16 August 2018 (UTC)[reply]

Template-protected edit request on 31 October 2020

[edit]

Please apply Special:Diff/963584211/986365894 to suppress categorization of talk pages and user pages into Category:Hatnote templates using unusual parameters. This is similar to what Module:Hatnote does since Special:Diff/967664662. —⁠andrybak (talk) 11:51, 31 October 2020 (UTC)[reply]

 Done: Special:Diff/986771546. —⁠andrybak (talk) 22:34, 2 November 2020 (UTC)[reply]

Allow multiple targets with multiple descriptions?

[edit]

I think it would be helpful to allow multiple alternate targets with multiple descriptions, just as Template:About does. I had to switch templates here in Marsaglia, as it was not possible to stay with "for", but this makes the hatnote longer for no reason, and certainly not better. --KnightMove (talk) 06:59, 26 January 2021 (UTC)[reply]

How do you envisage this would work, KnightMove? The way the template has been set up, it will chain all positional parameters after the first one into a list of targets, without descriptions:
{{for|A|B|C|D}} outputs:
When using {{About}}, you don't need to make the hatnote longer: you can omit the string "This article is about X" by supplying an empty first parameter [1]. – Uanfala (talk) 20:38, 30 January 2021 (UTC)[reply]
Ok, that's a good practical solution, thank you. But writing my explanation how it could work, I've just found out that Template:For2 does exactly what I want. --KnightMove (talk) 21:15, 30 January 2021 (UTC)[reply]

Adding Template:For2 here in "See also"

[edit]

@Uanfala: and all others: Do you agree on adding Template:For2 in the "See also" section, so users who need that template get to know about it? --KnightMove (talk) 06:17, 31 January 2021 (UTC)[reply]

Sorry, I've just realized how to do it myself on the unprotected documentation page (edit). So in the end, this topic is really done. --KnightMove (talk) 06:47, 31 January 2021 (UTC)[reply]

 Done --KnightMove (talk) 06:47, 31 January 2021 (UTC)[reply]

Sent to TfD

[edit]

I have sent this template to TfD for a merge with Template:For2. See Wikipedia:Templates for discussion#Template:For. Please add the TfD notice:

<noinclude>{{SUBST:Tfm|For2}}</noinclude>

to the top of the template. Thanks. —TypicalWikimedian (talkcontribs) 18:53, 30 June 2021 (UTC)[reply]

 Done firefly ( t · c ) 19:56, 30 June 2021 (UTC)[reply]

Error checking

[edit]

In this version, there is a redlink in hatnote that does not cause an error. Nihiltres, another one to keep in mind if you are able to find a good way to catch these this as in the others. MB 15:31, 3 December 2021 (UTC)[reply]

  • I've been looking at the problem. The best solution will be to put the error-checking in Module:Hatnote, specifically its link-formatting functionality. That would let all hatnote templates naturally inherit the functionality, so that I don't have to implement the same feature a dozen times. The catch is that the functionality is reused in {{format link}}, so I'd probably want to introduce a way to disable the error-checking. Additionally, checking for the existence of other pages is notionally an expensive operation, so it risks causing downstream errors … but it's probably worth it.

    I've been busy the past couple of weeks, so I haven't been able to apply much effort to the problem, but I expect that I can sandbox a solution sometime in the next few days and then apply it once a) tested and b) I've left a chance for others to comment on the change. {{Nihiltres |talk |edits}} 16:50, 3 December 2021 (UTC)[reply]

Template-protected edit request on 6 December 2022

[edit]

Hey there, I am here not to make any changes or edits to this template, but to actually see the code for this template. I work on a fandom wiki and we are having an issue where with our "For" template, we can only get a max of 2 fields. For example, if it have [For|other uses|xxx|xxx|xxx] it will only insert For other uses, see xxx and xxx. I wanted to see the code for it but it wouldn't allow me, so I created this account five minutes ago just so I could talk on here. In case you're wondering, I work on the Call of Duty Wiki. Thanks, FearMePhoenix (talk) 17:23, 6 December 2022 (UTC)[reply]

This template calls a Lua module, Module:For, which should be visible to anyone with or without a registered user account. – Jonesey95 (talk) 17:26, 6 December 2022 (UTC)[reply]

Documentation on italics in hatnote

[edit]

For hatnotes, I believe it would be helpful to include (transclude?) instructions on the appropriate hatnote template pages for how to italicize (unitalicize, really) what would normally be so according to the Manual of Style. I remembered seeing it long ago and recently had to go to random articles (making educated guesses) hoping to see an example of it so I could copy it. Only after I figured it out did I come across WP:ITHAT just now. I'm sure I've added many a hatnote without proper italics.   — TARDIS builder     •       11:24, 29 May 2024 (UTC)[reply]

TARDIS Builder, please see new section in the documentation: Template:For/doc#Styling in italics. Is something like this what you had in mind? —⁠andrybak (talk) 15:34, 29 May 2024 (UTC)[reply]
@Andrybak – Oh yes, that's very helpful. Now, to include that on all the hatnote templates! I wouldn't even know how to find the full list. [cry laughing emoji seems appropriate here]   — TARDIS builder     •       15:50, 29 May 2024 (UTC)[reply]
Do you mean Category:Hatnote templates? This could be tricky due to different layouts of the /doc pages, however, the best way would be to create a shared documentation template. Documentation pages of some of the hatnote templates already use a shared content template – the navbox {{Hatnote templates}}. For "Styling in italics", something like Template:Hatnote italics doc could be created with the content from Special:Diff/1226267598. —⁠andrybak (talk) 18:36, 29 May 2024 (UTC)[reply]
@Andrybak – Sounds good, but way out of my depth. Where would it be appropriate for me to make this request / suggestion?   — TARDIS builder     •       05:43, 30 May 2024 (UTC)[reply]
@Andrybak: In case I did not ping you correctly last time.   — TARDIS builder     ★       21:11, 31 May 2024 (UTC)[reply]
TARDIS Builder, you could try asking at Wikipedia:Requested templates. —⁠andrybak (talk) 21:13, 31 May 2024 (UTC)[reply]