Template:Talkspace detect/sandbox: Difference between revisions

Content deleted Content added
Adding the "anytalk" parameter.
Use the "page" parameter instead of the "demospace" parameter. More flexible. And compatible with {{basepage subpage}} etc.
Line 1:
{{#switch:
{{#if:{{{demospacepage|}}}
{{lc: <!--Lower-case the result-->
| {{#ifeq:{{NAMESPACE:{{{page}}} }}|{{SUBJECTSPACE:{{{page}}} }}
<!--If no or empty "demospace" parameter then detect namespace-->
| anysubject
{{#if:{{{demospace|}}}
| {{TALKSPACE:{demospace{{page}}} }}
}}
| {{#ifeq:{{NAMESPACE}}|{{SUBJECTSPACE}}
| subjectanysubject
| {{TALKSPACE}}
}}
}}
}}
<!-- Only one of the lines below will be executed -->.
 
<!-- Respecting empty parameters on purpose. -->
<!-- Only one of the lines below will be executed -->
| anysubject = {{{other|}}} <!--Any subject space-->
<!-- Respecting empty parameters on purpose -->
| talkTalk = {{{talkmain| {{{anytalkdefault| {{{other|}}} }}} }}}
 
| userUser talk = {{{user talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| main <!-- demospace = main ... portal -->
| wikipediaWikipedia talk = {{{wikipedia talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| user
| fileFile talk = {{{file talk| {{{anytalkimage| {{{otherdefault|}}} }}} }}}
| wikipedia
| mediawikiMediaWiki talk = {{{mediawiki talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| file
| templateTemplate talk = {{{template talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| mediawiki
| helpHelp talk = {{{help talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| template
| categoryCategory talk = {{{category talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| help
| portalPortal talk = {{{portal talk| {{{anytalkdefault| {{{other|}}} }}} }}}
| category
| #default = {{{otherdefault|}}} <!--"demospace=other" or aA new talkspacetalk space-->
| portal
}}<!--End switch--><noinclude>
| subject = {{{subject| {{{other|}}} }}}
 
| anytalk = {{{anytalk| {{{other|}}} }}} <!-- demospace=anytalk -->
 
| talk = {{{talk| {{{anytalk| {{{other|}}} }}} }}}
| user talk = {{{user talk| {{{anytalk| {{{other|}}} }}} }}}
| wikipedia talk = {{{wikipedia talk| {{{anytalk| {{{other|}}} }}} }}}
| file talk = {{{file talk| {{{anytalk| {{{other|}}} }}} }}}
| mediawiki talk = {{{mediawiki talk| {{{anytalk| {{{other|}}} }}} }}}
| template talk = {{{template talk| {{{anytalk| {{{other|}}} }}} }}}
| help talk = {{{help talk| {{{anytalk| {{{other|}}} }}} }}}
| category talk = {{{category talk| {{{anytalk| {{{other|}}} }}} }}}
| portal talk = {{{portal talk| {{{anytalk| {{{other|}}} }}} }}}
 
| other
| #default = {{{other|}}} <!--"demospace=other" or a new talkspace-->
 
}}<!--End switch--><noinclude>