Editing User:Yfmcpxpj/Template:comic 2x test
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 58: | Line 58: | ||
--><span style="color: #FFFFFF; padding: 0 12px;">Comic <!-- | --><span style="color: #FFFFFF; padding: 0 12px;">Comic <!-- | ||
-->{{#ifexpr:{{{number|-1}}}>= 1|#|}}{{{number|}}} {{#if:{{{date|}}}|({{#replace:{{{date}}}| | }})}}</span>]</li><!-- | -->{{#ifexpr:{{{number|-1}}}>= 1|#|}}{{{number|}}} {{#if:{{{date|}}}|({{#replace:{{{date}}}| | }})}}</span>]</li><!-- | ||
− | |||
− | |||
− | |||
− | + | Check if the comic is #1084 or above. | |
− | -->{{# | + | -->{{#ifexpr:{{{number|-1}}}>=1084|<!-- |
+ | |||
+ | If so, add a "2x" button linking to the 2x image. | ||
+ | --><li style="background-color: #6E7B91; | ||
+ | border: 1.5px solid #333333; | ||
+ | border-radius: 3px 3px 3px 3px; | ||
+ | box-shadow: 0 0 5px 0 gray; | ||
+ | display: inline; | ||
+ | font-size: 16px; | ||
+ | font-variant: small-caps; | ||
+ | font-weight: 600; | ||
+ | margin: 0 4px; | ||
+ | padding: 1.5px 0;" | ||
+ | class="plainlinks"><!-- | ||
+ | |||
+ | The image files are hosted at imgs.xkcd.com/comics/ | ||
+ | -->[https://imgs.xkcd.com/comics/<!-- | ||
+ | |||
+ | The filename is the same as the original comic, but with "_2x" inserted at the end of the filename before the extension. | ||
+ | So take everything before the final dot. | ||
+ | -->{{#sub:{{{image|}}}|0|{{#rpos:{{{image|}}}|.}}}}<!-- | ||
+ | |||
+ | Then insert "_2x". | ||
+ | -->_2x<!-- | ||
− | + | Then append the dot and filename extension. | |
− | --> | + | -->{{#sub:{{{image|}}}|{{#rpos:{{{image|}}}|.}}}}<!-- |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Finally, add the displayed text for the button. | |
− | + | --> <span style="color: #FFFFFF; padding: 0 12px;">2x</span>]</li>}}<!-- | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Now make the next and >| buttons provided comic number exists | Now make the next and >| buttons provided comic number exists | ||
Line 169: | Line 144: | ||
It otherwise sorts 'alphanumerically'; as in since the first char of 10 is 1, it would normally be placed before 9 | It otherwise sorts 'alphanumerically'; as in since the first char of 10 is 1, it would normally be placed before 9 | ||
The padding turns each into 0009 and 0010 etc. and since 0 is less than 1, #9 gets sorted before #10. | The padding turns each into 0009 and 0010 etc. and since 0 is less than 1, #9 gets sorted before #10. | ||
− | -->{{#ifexpr:{{{number|-1}}}>=1|{{DEFAULTSORT: {{padleft:{{{number}}}|4}} | + | -->{{#ifexpr:{{{number|-1}}}>=1|{{DEFAULTSORT: {{padleft:{{{number}}}|4}}}}|<!-- |
-->}}<!-- | -->}}<!-- | ||
Line 185: | Line 160: | ||
--></includeonly><noinclude> | --></includeonly><noinclude> | ||
<!-- DOCUMENTATION --> | <!-- DOCUMENTATION --> | ||
− | This | + | This is the basic infobox-style header template used to display [[xkcd]] comics on their own pages, including the comic number (with external link to xkcd), publication date, title, comic image, and title text. |
== Sample == | == Sample == | ||
The following is a sample usage of this template: | The following is a sample usage of this template: | ||
− | {{ | + | {{comic |
− | | number = | + | | number = 16 |
− | | date = | + | | date = October 4, 2005 |
− | | title = | + | | title = Monty Python -- Enough |
− | | image = | + | | image = monty_python.jpg |
− | | titletext = | + | | titletext = I went to a dinner where there was a full 10 minutes of Holy Grail quotes exchanged, with no context, in lieu of conversation. It depressed me badly. |
}} | }} | ||
== Usage == | == Usage == | ||
− | <pre>{{ | + | <pre>{{comic |
| number = | | number = | ||
| date = | | date = | ||
Line 211: | Line 186: | ||
| ldomain = | | ldomain = | ||
| lappend = | | lappend = | ||
− | |||
− | |||
}}</pre> | }}</pre> | ||
Line 228: | Line 201: | ||
** '''lappend''' must be defined as <pre>...kd.com/'''lappend'''/</pre> to keep the link to xkcd.com valid. | ** '''lappend''' must be defined as <pre>...kd.com/'''lappend'''/</pre> to keep the link to xkcd.com valid. | ||
** If the link is to eg. a blog post (blog.xkcd.com) '''ldomain''' can be defined as <pre>blog</pre> to change the subdomain in the link. | ** If the link is to eg. a blog post (blog.xkcd.com) '''ldomain''' can be defined as <pre>blog</pre> to change the subdomain in the link. | ||
− | |||
− | |||
− | |||
The above sample is produced by the following code: | The above sample is produced by the following code: | ||
− | <pre>{{ | + | <pre>{{comic |
− | | number = | + | | number = 16 |
− | | date = | + | | date = October 4, 2005 |
− | | title = | + | | title = Monty Python -- Enough |
− | | image = | + | | image = monty_python.jpg |
− | | titletext = | + | | titletext = I went to a dinner where there was a full 10 minutes of Holy Grail quotes exchanged, with no context, in lieu of conversation. It depressed me badly. |
}}</pre> | }}</pre> | ||
[[Category:Templates]] | [[Category:Templates]] | ||
</noinclude> | </noinclude> |