FANDOM


This page is a Sandbox and should only be modified by the user it belongs to.


You would destroy me if you ever saw my code [...] But on the upside, it's probably the most beautifully-documented code you'll ever see in your life.

–Anonymous

This page serves as User:Ironwestie's documentation and testing area for templates and Mediawiki functions developed for this wiki.

Articles without images parsing

Description
Intended to be used on Template:Infobox webcomic. Checks to see whether:
  1. The image parameter is valid
  2. The file name associated with image is a valid file name on the wiki.

Works with and without the File: prefix.

Resources
Notes
#ifexist is a very "expensive" parser function that uses a lot of server resources. It cannot be invoked too many times on a single page.
{{#if: {{{image|}}}
   |{{#ifexist:{{{image}}}
       |true
       |{{#ifexist:File:{{{image}}}|true|false}}
    }}
   |false
}}
{{#if: {{{image|}}}
   |{{#ifexist: {{{image}}}
       |
       |{{#ifexist:File:{{{image}}}||[[:Category:Articles without images]]}}
   }}
   |[[:Category:Articles without images]]
}}
{{#if: {{{image|}}}|{{#ifexist: {{{image}}}||{{#ifexist:File:{{{image}}}||[[:Category:Articles without images]]}}}}|[[:Category:Articles without images]]}}
Input Output
Example.jpg
File.Example.jpg
Foo.jpg Category:Articles without images

Namespace checking

Description
Checks to see whether the page the parser is put on is in the Main namespace. Intended to be used on Template:Infobox webcomic to make sure draft articles (which are in the User namespace) are not categorized as if they were full pages.
Resources
Code
Input Output
{{#ifeq: {{NAMESPACE:User:Ironwestie}}|{{ns:0}}|true|false}}
false
{{#ifeq: {{NAMESPACE:Main}}|{{ns:0}}|true|false}}
true

Schedule Icons

Incomplete.
Description
Inserts an icon at the top right-hand corner of a page. To be used to display a comic's schedule or status in icons (such as "[M] [W] [F]", "[C]", "[H]"])
  • Possibly in infobox instead of on the top of the page.
References / Resources
Code (Icons)
<div id="va-titleicons" class="va-titleicons">{{Toprighticon|{{{1|}}}}} {{Toprighticon|{{{2|}}}}} {{Toprighticon|{{{3|}}}}} {{Toprighticon|{{{4|}}}}} {{Toprighticon|{{{5|}}}}} {{Toprighticon|{{{6|}}}}} {{Toprighticon|{{{7|}}}}} {{Toprighticon|{{{8|}}}}} {{Toprighticon|{{{9|}}}}}{{Toprighticon|{{{10|}}}}}{{Toprighticon|{{{11|}}}}}{{Toprighticon|{{{12|}}}}}</div>
Code (toprighticon)
{{#switch {{{1|}}}
|Su=[[File:SundayIcon.png|30px|This webcomic updates on Sundays.]]
|M=[[File:MondayIcon.png|30px|This webcomic updates on Mondays.]]
|Tu=[[File:TuesdayIcon.png|30px|This webcomic updates on Tuesdays.]]
|W=[[File:WednesdayIcon.png|30px|This webcomic updates on Wednesdays.]]
|Th=[[File:ThursdayIcon.png|30px|This webcomic updates on Thursdays.]]
|F=">[[File:FridayIcon.png|30px|This webcomic updates on Fridays.]]
|Sa=[[File:SaturdayIcon.png|30px|This webcomic updates on Saturdays.]]
|Hiatus=[[File:HiatusIcon.png|30px|This webcomic is on a hiatus.]]
|Ended=[[File:EndedIcon.png|30px|This webcomic has ended.]]
|protected1=[[File:SilverLockIcon.png|30px|This page is semi-protected. Only logged-in users may edit it.]]
|protected2=[[File:BlackLockIcon.png|30px|This page is fully-protected. Only administrators may edit it.]]
|featured=[[File:FeaturedIcon.png|30px|This article has been featured]]
}}
Icons
Name Description Image
SundayIcon This webcomic updates on Sundays.
MondayIcon This webcomic updates on Mondays.
TuesdayIcon This webcomic updates on Tuesdays.
WednesdayIcon This webcomic updates on Wednesdays.
ThursdayIcon This webcomic updates on Thursdays.
FridayIcon This webcomic updates on Fridays.
SaturdayIcon This webcomic updates on Saturdays.
HiatusIcon This webcomic is on a hiatus.
EndedIcon This webcomic has ended.
SilverLockIcon This page is semi-protected. Only logged-in users may edit it.
BlackLockIcon This page is fully-protected. Only administrators may edit it.
FeaturedIcon This article has been featured
Example call
{{Icons|Monday|Tuesday|Wednesday}}

Parameter Type Parsing

Description
Parses a date for its year. To be used to extract the year of Template:Infobox webcomic's launched or ended parameters for automatic categorization into Category:Comics by Start Date.
Code
[[:Category:Started in <parsed year>]]
Resources

Using #time:

Description

Formats the given date parameter into a date and then returns the date's year.

Notes

Using {{#time:}} has some limitations:

  • The parameter must be properly formatted
  • If no year is given, the default value is the current year (i.e. 2020).
Code
{{#time: Y|{{{date|}}} }}
Input Output
2020
December 2020
13 Error: Invalid time.
December 13 2020
December 13, 2000 2000
2000, December 13 2020
13-12-2000 2000
12-13-2000 Error: Invalid time.
2000-12-13 2000
Final code

Compare with above.

  • Only checks the parameter if launched has a value.
  • Does not categorize if #time throws an error while parsing launched
{{#if: {{{launched|}}}|{{#iferror: {{#time: Y|{{{launched}}}}}|ERROR|
category:Started in {{#time: Y|{{{launched}}}}}}}
|NOTHING}}
Input Output
NOTHING
December category:Started in 2020
13 ERROR
December 13 category:Started in 2020
December 13, 2000 category:Started in 2000
2000, December 13 category:Started in 2020
13-12-2000 category:Started in 2000
12-13-2000 ERROR
2000-12-13 category:Started in 2000
Dec 13, 2000 category:Started in 2000

Semantic Properties

A summary of what I understand about Semantic Properties (to be moved and made into a full article)

  • Properties are for pages and can displayed when viewing a page through Special:Browse
  • Properties are defined at pages with the prefix Property:
    • To give a property a data type, insert [[Property name::value]] on the Property's page.
  • The above syntax will work for any page; it will make a link and also set its property
    • e.g. for a comic about Gorillaz, with an existing Property called Subject (of type text). [[Subject::Gorillaz]]
  • Property values can be:
    • Set using #set (or the code above)
    • Retrieved using #show
Resources

Semantic Mediawiki

Community content is available under CC-BY-SA unless otherwise noted.