User:Mheguy/Archive/001: Difference between revisions

From SGUTranscripts
Jump to navigation Jump to search
No edit summary
m (Mheguy moved page Template:PublishDate to User:Mheguy/Archive/001: Retiring the concept)
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
Value provided:
<noinclude>
{{{1}}}
A proof of concept to have a Single Source of Truth for the publish date of all episodes.
</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}}


Output:
Get the fourth character from the right from the left-padded value.
{{#time: Y-m-d | {{{1}}}}}
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}} }}


<noinclude>
Get the third character from the right from the left-padded value.
Welcome to my little sandbox.
If the original value is 1234, we return 2.
</noinclude>
If the original value is 25, we return 0.
Left-padded value, trimmed to 1 char:{{padleft:|1|{{padleft:{{{1}}}|3|0}} }}
 
-->
 
<includeonly>
{{#switch: {{padleft:|1|{{padleft:{{{1}}}|4|0}} }}
| 0 = {{PublishDate0000s|}}
| 1 = {{PublishDate1000s}}
| #default = 0000-00-00
}}
</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.