Editing User:Yfmcpxpj/Sandbox

Jump to: navigation, search

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 1: Line 1:
Sandbox for testing things.
+
__TOC__
  
 
= 2x comic template test =
 
= 2x comic template test =
Line 6: Line 6:
  
 
Experimental template, adding a "2x" button to automatically link to the double-resolution comic images on xkcd.com.
 
Experimental template, adding a "2x" button to automatically link to the double-resolution comic images on xkcd.com.
 
== Comics as of [[1084]] ==
 
 
Comic [[1084]] was the first comic to include a 2x image, so for all comics as of 1084, automatically insert a "2x" button to link directly to the higher resolution image on xkcd.com.
 
 
Code:
 
 
<pre>
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1084
 
| date      = July 20, 2012
 
| title    = Server Problem
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
}}
 
</pre>
 
 
Result:
 
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1084
 
| date      = July 20, 2012
 
| title    = Server Problem
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
}}
 
  
 
== Comics up to and including [[1083]] (no 2x image) ==
 
== Comics up to and including [[1083]] (no 2x image) ==
  
For comics ''before'' [[1084]], no double-resolution image exists, so they should ''not'' have a "2x" button.
+
[[1084]] was the first comic to include a 2x image, so comics before that should ''not'' have a "2x" button.
  
 
Code:
 
Code:
Line 59: Line 33:
 
}}
 
}}
  
== Comics without a number ==
+
== Comics as of [[1084]] ==
 
 
[[Template:comic]] is also used for one-off comics hosted outside of xkcd.com, for example, [[:Category:Extra comics]].  Those comics don't have a "number", and should also ''not'' have a "2x" button.
 
 
 
Code:
 
 
 
<pre>
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| date      = October 22, 2015
 
| title    = XKCD Marks the Spot
 
| image    = world_polio_day.png
 
| before    = Original blog post on ''gatesnotes'': http://www.gatesnotes.com/Health/XKCD-Marks-the-Spot
 
| titletext    = World Polio Day XKCD comic
 
| ldomain  = gatesnotes.com/Health/XKCD-Marks-the-Spot#
 
| lappend  =
 
| extra    = yes
 
}}
 
</pre>
 
 
 
Result:
 
 
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| date      = October 22, 2015
 
| title    = XKCD Marks the Spot
 
| image    = world_polio_day.png
 
| before    = Original blog post on ''gatesnotes'': http://www.gatesnotes.com/Health/XKCD-Marks-the-Spot
 
| titletext    = World Polio Day XKCD comic
 
| ldomain  = gatesnotes.com/Health/XKCD-Marks-the-Spot#
 
| lappend  =
 
| extra    = yes
 
}}
 
 
 
== Omitting 2x button ==
 
 
 
If the "2x" button target is broken, or if the button just needs to be omitted for whatever reason, that can be done with the new <code>omit2x</code> parameter.
 
 
 
Code:
 
 
 
<pre>
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1084
 
| date      = July 20, 2012
 
| title    = Server Problem
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
| omit2x    = true
 
}}
 
</pre>
 
 
 
Result:
 
 
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1084
 
| date      = July 20, 2012
 
| title    = Server Problem
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
| omit2x    = true
 
}}
 
 
 
== Overriding 2x target ==
 
  
Alternatively, if the "2x" button needs to link to a different filename (for example, if the filename on xkcd.com doesn't match the filename on explainxkcd.com), the alternate filename can be specified in the <code>override2x</code> parameter.
+
For comics as of [[1084]], insert a "2x" button to link directly to the higher resolution image on xkcd.com.
  
 
Code:
 
Code:
Line 132: Line 46:
 
| image    = server_problem.png
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
| override2x= contextbot_2x.png
 
 
}}
 
}}
 
</pre>
 
</pre>
Line 144: Line 57:
 
| image    = server_problem.png
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
| override2x= contextbot_2x.png
 
 
}}
 
}}
 
This could also be used to add a "2x" button to older comics, if appropriate.
 
 
Code:
 
 
<pre>
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1
 
| date      = September 30, 2005
 
| title    = Barrel - Part 1
 
| image    = barrel_cropped_(1).jpg
 
| titletext = Don't we all.
 
| override2x= contextbot_2x.png
 
}}
 
</pre>
 
 
Result:
 
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1
 
| date      = September 30, 2005
 
| title    = Barrel - Part 1
 
| image    = barrel_cropped_(1).jpg
 
| titletext = Don't we all.
 
| override2x= contextbot_2x.png
 
}}
 
 
Note, however, that <code>omit2x</code> takes precedence over <code>override2x</code>.
 
 
Code:
 
 
<pre>
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1084
 
| date      = July 20, 2012
 
| title    = Server Problem
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
| override2x= contextbot_2x.png
 
| omit2x    = true
 
}}
 
</pre>
 
 
Result:
 
 
{{User:Yfmcpxpj/Template:comic 2x test
 
| number    = 1084
 
| date      = July 20, 2012
 
| title    = Server Problem
 
| image    = server_problem.png
 
| titletext = Protip: Annoy Ray Kurzweil by always referring to it as the 'Cybersingularity'.
 
| override2x= contextbot_2x.png
 
| omit2x    = true
 
}}
 
 
== Reference documentation ==
 
 
* [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions MediaWiki: ParserFunctions Extension]
 
** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##expr <code>#expr</code>] – evaluate an expression.
 
** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##if <code>#if</code>] – conditional inclusion.
 
** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##ifeq <code>#ifeq</code>] – conditional inclusion from string equality/inequality.
 
** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##ifexpr <code>#ifexpr</code>] – conditional from the result of an expression.
 
** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#StringFunctions StringFunctions]
 
*** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##rpos <code>#rpos</code>] – return the ''last'' position of the specified text within a string.
 
*** [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions##sub <code>#sub</code>] – return a sub-string.
 
* [https://www.mediawiki.org/wiki/Help:Parser_functions_in_templates MediaWiki: Parser functions in templates]
 
* [https://www.mediawiki.org/wiki/Help:Magic_words#Technical_metadata MediaWiki: Magic words > Technical metadata] > <code>DEFAULTSORT</code>
 

Please note that all contributions to explain xkcd may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see explain xkcd:Copyrights for details). Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:

Cancel | Editing help (opens in new window)

Templates used on this page: