Village Pump (technical) - Mysterious Behaviour of Template:Talk Other

Mysterious Behaviour of Template:Talk Other

The template {{talk other}} takes two positional parameters, and returns the first if used on a talk page, and returns the second if used on a non-talk page. Thus,

{{talk other|This is a talk page|This is a subject page}} returns This is a subject page

when used here. However, it breaks if all or part of the second parameter is wrapped in :

{{talk other|This is a talk page|This is a }} returns

(i.e. nothing). I spotted this because I found a case of {{edit semi-protected}} being used on an article here, when searching for bad edits by this anon. It should have shown Error: Semi-protected edit requests should only be made on the talk page. and put the page into Category:Non-talk pages requesting an edit to a semi-protected page, but did neither of these. If I amend {{edit semi-protected}} to remove the class="error", it works. I've determined that if the has no attributes, it works - but as soon as it's given an attribute, whether class= id= or style=, regardless of whether the attribute has a value or not, the whole of the second positional parameter is ignored. --Redrose64 (talk) 15:41, 14 December 2012 (UTC)

Try this:
{{talk other|This is a talk page|This is a subject page}} returns This is a subject page
Otherwise the equals sign is interpreted as part of the template syntax. Jafeluv (talk) 16:15, 14 December 2012 (UTC)
Or this:
{{talk other|1=This is a talk page|2=This is a -- WOSlinker (talk) 16:23, 14 December 2012 (UTC)
Ah yes, that would do it; or even
{{talk other|This is a talk page|2=This is a }} returns This is a subject page
which is a bot more "obvious". Thank you --Redrose64 (talk) 16:25, 14 December 2012 (UTC)
All non-user pages now fixed up. Some had carried the {{edit semi-protected}} for over a year. --Redrose64 (talk) 17:59, 14 December 2012 (UTC)

Read more about this topic:  Village Pump (technical)

Famous quotes containing the words mysterious and/or behaviour:

    We must believe that He permits it [this war] for some wise purpose of his own, mysterious and unknown to us; and though with our limited understandings we may not be able to comprehend it, yet we cannot but believe, that he who made the world still governs it.
    Abraham Lincoln (1809–1865)

    I cannot be much pleased without an appearance of truth; at least of possibility—I wish the history to be natural though the sentiments are refined; and the characters to be probable, though their behaviour is excelling.
    Frances Burney (1752–1840)