User:Mheguy/Archive/001: Difference between revisions
Jump to navigation
Jump to search
m (Mheguy moved page Template:MheguyTest to Template:PublishDate: PoC seems promising) |
m (Mheguy moved page Template:PublishDate to User:Mheguy/Archive/001: Retiring the concept) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
A proof of concept to have a Single Source of Truth for the publish date of all episodes. | |||
</noinclude> | </noinclude> | ||
<!-- | |||
The variables extension is not enabled on this server. That means we need to re-calculate everything each time. | |||
That's brutal. | |||
Here's some debug code that you can un-comment to understand what we're doing here: | |||
This will show the value that is passed to the template. | |||
Input value: {{{1}}} | |||
This will show a 4-character left-padded version of the value. Ex. "25" becomes "0025". | |||
Left-padded value: {{padleft:{{{1}}}|4|0}} | |||
Get the fourth character from the right from the left-padded value. | |||
If the original value is 1234, we return 1. | |||
If the original value is 25, we return 0. | |||
Left-padded value, trimmed to 1 char:{{padleft:|1|{{padleft:{{{1}}}|4|0}} }} | |||
Get the third character from the right from the left-padded value. | |||
If the original value is 1234, we return 2. | |||
If the original value is 25, we return 0. | |||
Left-padded value, trimmed to 1 char:{{padleft:|1|{{padleft:{{{1}}}|3|0}} }} | |||
--> | --> | ||
<includeonly> | <includeonly> | ||
{{#switch: {{{1}}} | {{#switch: {{padleft:|1|{{padleft:{{{1}}}|4|0}} }} | ||
| 0 = {{PublishDate0000s|}} | |||
| | | 1 = {{PublishDate1000s}} | ||
| | |||
| #default = 0000-00-00 | | #default = 0000-00-00 | ||
}} | }} | ||
</includeonly> | </includeonly> | ||
Latest revision as of 13:57, 25 November 2024
A proof of concept to have a Single Source of Truth for the publish date of all episodes.