Jump to content

Wikipedia talk:Substitution

Page contents not supported in other languages.
Page semi-protected
From Wikipedia, the free encyclopedia

Cleanup

There are quite a few cases of failed substitution within references that need to be cleaned up, found with insource:/\{\{subst:/ -insource:"Anchor comment" -insource:"rfd". Letcord (talk) 18:33, 2 April 2022 (UTC)[reply]

@Letcord: You posted this at Help talk:Substitution#Cleanup, please see WP:MULTI. --Redrose64 🌹 (talk) 19:30, 2 April 2022 (UTC)[reply]
I know I did. I don't expect my posts to start any discussion that would be fragmented, as they're just pointers to a set of articles needing cleanup. Letcord (talk) 19:38, 2 April 2022 (UTC)[reply]

I noticed a few hundred in the search hits with {{subst:rfd}}, but they're in a comment and as-intended, it appears. Dicklyon (talk) 15:28, 3 April 2022 (UTC)[reply]

I've narrowed the search to exclude those now. Letcord (talk) 18:33, 3 April 2022 (UTC)[reply]

This page needs more instruction.

There needs to be more instructions on what to do when you see :subst. I saw it on the Nominate for Adminship page and can't figure out how to use it. Oo-rah! the marines are here (talk) 18:04, 9 January 2024 (UTC)[reply]

subst not working on title year range template

I raised this over at Template talk:Subst but no-one seems to be monitoring that page.

I've found that adding subst: works fine on templates such as {{title year}} and {{Title year+1}}, but just results in a blank when used on {{title year range}}. Try it in 1983–84 New York Islanders season for example. Any explanation, or fix available? Colonies Chris (talk) 13:07, 11 January 2024 (UTC)[reply]

I'll start off by pointing out that only {{subst:title year}} substs cleanly - {{subst:title year+1}} emits {{#expr:{{title year}} +1}}. --Redrose64 🌹 (talk) 19:54, 11 January 2024 (UTC)[reply]
@Colonies Chris:  Fixed, with this edit.
You probably didn't get a reply at Template talk:Subst because it has very few watchers (12). It's also nothing to do with Template:Subst. --Redrose64 🌹 (talk) 20:10, 11 January 2024 (UTC)[reply]
Thanks, that's working fine now. Colonies Chris (talk) 21:11, 11 January 2024 (UTC)[reply]

title case substitution?

Through substitution, there is a function {{subst:lc:STRINGS}} which allows for upper case "STRINGS" to be converted to lower case ("strings"). Is there a similar one that allows conversion into Title Case?  Ohc revolution of our times 15:44, 11 July 2025 (UTC)[reply]

@Ohconfucius: Please note that this is only tangentially relevant to Wikipedia:Substitution, {{lc:}} is a parser function built into the MediaWiki software.
That said, you can use parser functions to manipulate the string in its entirety, or its first letter alone. For instance, to lowercase the string but uppercase its first letter, use this: {{ucfirst:{{lc:STRINGS}}}} → Strings. We also have Template:Title case, as in {{Title case|STRINGS}} → Strings. For more complex cases, there may be something in Module:String2. --Redrose64 🌹 (talk) 14:02, 12 July 2025 (UTC)[reply]
I amended my sources script to insert the #invoke:String2 template to convert the contents of the |title=. The trial run failed to convert the target string to Title Case. Amending it to substitute the {{Title case}} template also failed to do the job. What should I do to get the result I am after?  Ohc revolution of our times 17:36, 13 July 2025 (UTC)[reply]
You cannot WP:SUBST in between <ref>...</ref> tags. This has been a known problem for over twenty years. --Redrose64 🌹 (talk) 20:49, 13 July 2025 (UTC)[reply]
Shame. It's a frequent enough issue that the parameter is populated with titles in block caps that would warrant a bit of automation to put right.  Ohc revolution of our times 10:29, 14 July 2025 (UTC)[reply]

Edits changed meaning and emphasis

Recent comprehensive edits (in the last day or two) to this page's prose have changed the meaning of some of the sentences. In some places, the changes introduced inaccuracies. I do not have the energy to comb through the page right now, but I am leaving this marker in case someone else wants to check the edits and fix them. – Jonesey95 (talk) 22:55, 19 August 2025 (UTC)[reply]

I'll add an edited version of my edit summary here for context for other editors coming in:
I rewrote the lede and the first two sections. I remember when i first joined wikipedia, I had no idea what a substitution was so i read this page and thought, "wow, this stuff is really complex". I then read this page many times, but eventually I had to go check reddit to actually understand. Subst is such a simple comcept, and this page is linked to from almost every documentation page, yet it wasn't explained properly. It should be simple but not oversimplified, and that's what I tried to do, using simple terms and keeping technical details. If I were my 4-year-oder self, I'd understand substituition more easily with this change.
FaviFake (talk) 17:22, 20 August 2025 (UTC)[reply]

Should H:SUBST and WP:SUBST be merged?

Both H:SUBST and WP:SUBST seem to cover the technical and the usage aspects of substitution. While one is a guideline and the other isn't, they both explain the aspects of subst:ing that in theory keep them separate. The difference isn't clear-cut. What should be on this page? What on the other? What on both? For example, I found these sections from both pages that talk about the same thing:

  1. Wikipedia:Substitution § Benefits and Help:Substitution § When to use substitution
  2. Wikipedia:Substitution § Drawbacks and Help:Substitution § When to use substitution (second list)
  3. Wikipedia:Substitution § Usage and Help:Substitution § Syntax
  4. Wikipedia:Substitution § Neutral and Help:Substitution § When to use substitution (first list)
  5. Wikipedia:Substitution § Benefits (last bullet) and Help:Substitution § Recursive substitution
  6. Wikipedia:Substitution § Templates that must be substituted and Help:Substitution § Templates for substitution (both are about templates)

Other editors have also previously requested that text on one page be added to the other (or vice versa):

For these reasons, I think the page Help:Substitution should be merged into this page. This shouldn't affect the "guideline" status, since the content in the other page is mainly instructions, and will help users understand both...

  • when it must/should be used, and
  • what you actually need to do to substitute

... without having to read two redundant pages. Thoughts? FaviFake (talk) 15:39, 3 October 2025 (UTC)[reply]