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:

    In such a night, when passing clouds give place,
    Or thinly veil the heaven’s mysterious face;
    When in some river, overhung with green,
    The waving moon and trembling leaves are seen;
    Anne Finch, Countess Of Winchilsea (1661–1720)

    I look on it as no trifling effort of female strength to withstand the artful and ardent solicitations of a man that is thoroughly master of our hearts. Should we in the conflict come off victorious, it hardly pays us for the pain we suffer from the experiment ... and I still persist in it that such a behaviour in any man I love would rob me of that most pleasing thought, namely, the obligation I have to him for not making such a trial.
    Sarah Fielding (1710–1768)