Difference between revisions of "Template:Epcode"

From LGPedia
Jump to: navigation, search
(Reorganized, please watch out for counting errors.)
m (Returning zero for general false)
Line 1: Line 1:
<includeonly>{{ #if: {{#ifeq: {{#ifexpr: {{{1}}} | true}} | true | {{{1|}}} |}} <!-- -->|{{ #ifexpr: {{{1}}} <= 0 | {{#switch: {{{2}}} | raw = {{{1}}} | season = 0 | 0x{{{1}}} }} |}}<!-- -->{{ #ifexpr: ({{{1}}} >= 1) and ({{{1}}} <= 256) | {{#switch: {{{2}}} | raw = {{#expr:{{{1}}}}} | season = 1 | 1x{{ #ifexpr: {{{1}}} < 100 |0|}}{{ #ifexpr: {{{1}}} < 10 |0|}}{{#expr:{{{1}}}}} }} |}}<!-- -->{{ #ifexpr: {{{1}}} >= 257 | {{#switch: {{{2}}} | raw = {{#expr: {{{1}}}-256 }} | season = 2 | 2x{{ #ifexpr: ({{{1}}}-256) < 100 |0|}}{{ #ifexpr: ({{{1}}}-256) < 10 |0|}}{{#expr: {{{1}}}-256 }} }} |}}<!-- -->}}</includeonly><noinclude>This template generates episode codes in the form of (seasonnumber)x(episodenumber within season) from normal, continuous episode numbers.<br>'''Usage:''' <code><nowiki>{{epcode|Normal episode number}}</nowiki></code><br>'''Example:''' <code><nowiki>{{epcode|260}}</nowiki></code> gives {{epcode|260}}<br><code>raw</code> can be passed as a second argument to turn off the leading #x.<br><code>season</code> can be passed as a second argument to return only the season number.[[Category:Templates]]</noinclude>
+
<includeonly>{{ #if: {{#ifeq: {{#ifexpr: {{{1}}} | true}} | true | {{{1|}}} |}} <!-- -->|{{ #ifexpr: {{{1}}} <= 0 | {{#switch: {{{2}}} | raw = {{{1}}} | season = 0 | 0x{{{1}}} }} |}}<!-- -->{{ #ifexpr: ({{{1}}} >= 1) and ({{{1}}} <= 256) | {{#switch: {{{2}}} | raw = {{#expr:{{{1}}}}} | season = 1 | 1x{{ #ifexpr: {{{1}}} < 100 |0|}}{{ #ifexpr: {{{1}}} < 10 |0|}}{{#expr:{{{1}}}}} }} |}}<!-- -->{{ #ifexpr: {{{1}}} >= 257 | {{#switch: {{{2}}} | raw = {{#expr: {{{1}}}-256 }} | season = 2 | 2x{{ #ifexpr: ({{{1}}}-256) < 100 |0|}}{{ #ifexpr: ({{{1}}}-256) < 10 |0|}}{{#expr: {{{1}}}-256 }} }} |0}}<!-- -->}}</includeonly><noinclude>This template generates episode codes in the form of (seasonnumber)x(episodenumber within season) from normal, continuous episode numbers.<br>'''Usage:''' <code><nowiki>{{epcode|Normal episode number}}</nowiki></code><br>'''Example:''' <code><nowiki>{{epcode|260}}</nowiki></code> gives {{epcode|260}}<br><code>raw</code> can be passed as a second argument to turn off the leading #x.<br><code>season</code> can be passed as a second argument to return only the season number.[[Category:Templates]]</noinclude>

Revision as of 20:21, 20 September 2007

This template generates episode codes in the form of (seasonnumber)x(episodenumber within season) from normal, continuous episode numbers.
Usage: {{epcode|Normal episode number}}
Example: {{epcode|260}} gives 2x004
raw can be passed as a second argument to turn off the leading #x.
season can be passed as a second argument to return only the season number.