Difference between revisions of "Template talk:Hgame"
(→Renaming the navigation) |
(→WTF) |
||
Line 27: | Line 27: | ||
:: Forgot to mention: in case you need to duplicate a parserfunction in multiple places, it might be a good idea to place it into a template of its own, ''(eg. {{t|GetGameName}} or something)'' to simplify things. - [[User:Loliturma|Loliturma]] ([[User talk:Loliturma|talk]]) 11:39, 24 March 2014 (UTC) | :: Forgot to mention: in case you need to duplicate a parserfunction in multiple places, it might be a good idea to place it into a template of its own, ''(eg. {{t|GetGameName}} or something)'' to simplify things. - [[User:Loliturma|Loliturma]] ([[User talk:Loliturma|talk]]) 11:39, 24 March 2014 (UTC) | ||
::: In fact, a simple <nowiki>{{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}}</nowiki> should do the trick. I'll check it on my testwiki. For the human-readable versions: those may mess with the spacing of e.g. lists, so beware --[[User:Hmoeller|<span style="font:bold 12px Times New Roman;">hmoeller</span>]] <sup style="font: normal 10px Times New Roman"> [ [[User talk:Hmoeller|Talk]] - [[Special:Contributions/Hmoeller|Contribs]] ]</sup> 11:47, 24 March 2014 (UTC) | ::: In fact, a simple <nowiki>{{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}}</nowiki> should do the trick. I'll check it on my testwiki. For the human-readable versions: those may mess with the spacing of e.g. lists, so beware --[[User:Hmoeller|<span style="font:bold 12px Times New Roman;">hmoeller</span>]] <sup style="font: normal 10px Times New Roman"> [ [[User talk:Hmoeller|Talk]] - [[Special:Contributions/Hmoeller|Contribs]] ]</sup> 11:47, 24 March 2014 (UTC) | ||
+ | :::: Good point! I am not familiar with magic words inside parserfunctions inside parameter default values, but it definitely should work. Also, all normal whitespaces inside parserfunctions are ignored unless they're part of input/output strings. | ||
+ | <nowiki>That's {{ | ||
+ | |||
+ | #if: | ||
+ | |||
+ | string | ||
+ | |||
+ | |||
+ | |||
+ | | true | false | ||
+ | |||
+ | |||
+ | }}.</nowiki> | ||
+ | :::: Even something silly like this would print "That's true." so there's no need worry about breaking page formatting with parserfunctions! Just check where they begin/end. - [[User:Loliturma|Loliturma]] ([[User talk:Loliturma|talk]]) 16:09, 24 March 2014 (UTC) | ||
== Renaming the navigation == | == Renaming the navigation == |
Revision as of 17:09, 24 March 2014
WTF
I peeked at the template and noticed multiple duplications of this code: {{#ifeq: {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}}|{{#titleparts: {{FULLPAGENAME}}|1}}|{{#titleparts: {{FULLPAGENAME}}|1}}|{{{game}}}}}
The same with better readability {{#ifeq: {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}} | {{#titleparts: {{FULLPAGENAME}}|1}} | {{#titleparts: {{FULLPAGENAME}}|1}} | {{{game}}} }}
So, it checks if the value of game is equal to the first part of fullpagename.
- if yes, it prints the first part of fullpagename
- if no, it prints the value of game
It prints a string equal to game in any case. I'm going to poke around the template a bit to get a better idea what's going on. - Loliturma (talk) 09:11, 24 March 2014 (UTC)
- The reason for that is to enable the template to guess it's game in a subpaged structure, so the game= parameter is no longer needed when using subpages - without breaking compatibility with the "classic" page structure of older games. The target is to reduce the number of parameters to the template and make the template more "smart". --hmoeller [ Talk - Contribs ] 10:33, 24 March 2014 (UTC)
- Ahhh, now I get the idea. However, the code did not do that: It doesn't work if the game parameter is unspecified. I guess the equal / not equal options were accidentally set backwards? Anyways, it could be simplified to
{{#if:{{{game|}}}|{{{game}}}|{{#titleparts:{{FULLPAGENAME}}|1}}}}
- Ahhh, now I get the idea. However, the code did not do that: It doesn't work if the game parameter is unspecified. I guess the equal / not equal options were accidentally set backwards? Anyways, it could be simplified to
human-readable version {{#if: {{{game|}}} | {{{game}}} | {{#titleparts: {{FULLPAGENAME}}|1}} }}
- That would print game's value if it is specified, otherwise it will print the first part of fullpagename. Is that what it should do? - Loliturma (talk) 11:28, 24 March 2014 (UTC)
- Forgot to mention: in case you need to duplicate a parserfunction in multiple places, it might be a good idea to place it into a template of its own, (eg. {{GetGameName}} or something) to simplify things. - Loliturma (talk) 11:39, 24 March 2014 (UTC)
- In fact, a simple {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}} should do the trick. I'll check it on my testwiki. For the human-readable versions: those may mess with the spacing of e.g. lists, so beware --hmoeller [ Talk - Contribs ] 11:47, 24 March 2014 (UTC)
- Good point! I am not familiar with magic words inside parserfunctions inside parameter default values, but it definitely should work. Also, all normal whitespaces inside parserfunctions are ignored unless they're part of input/output strings.
- In fact, a simple {{{game|{{#titleparts: {{FULLPAGENAME}}|1}}}}} should do the trick. I'll check it on my testwiki. For the human-readable versions: those may mess with the spacing of e.g. lists, so beware --hmoeller [ Talk - Contribs ] 11:47, 24 March 2014 (UTC)
That's {{ #if: string | true | false }}.
Can't we make a new template for navigation? At the moment we use Template:{{{game}}}}
for the navigation contents, but my Idea is to use a new template Template:{{{game}}}Nav
for the links. That would allow us to use the template with the game name e.g. @HomeMate as it was intended: We can put Template:Hgame with its parameters and even additional modivications if required on Template:*game* and use it on the game pages.
I think this would be more simple then it is now. --trololove (talk) 11:51, 24 March 2014 (UTC)
- Indeed that would make it much easier for other contributors to add game pages. I'd say we use
{{#ifexist: Template:{{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav | {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}}Nav | {{{game|{{#titleparts:{{FULLPAGENAME}}|1}}}}} }}