Template:Infobox/Doc: Difference between revisions

From questden
Jump to navigationJump to search
(May as well let people learn-by-example from test cases I guess.)
(authorextcomma was never documented for some reason)
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
:'''This page is a user-namespaced test.''' Please don't use it on real pages; it's intended to be moved into place when it's ready.
<noinclude>{{Doc}}</noinclude>
<noinclude>:'''This is a template documentation page.''' It is transcluded into place.</noinclude>
== Purpose ==
= Purpose =
{{Infobox|title=Template Quest|author=LionsPhil|thread1=0|suppresscat=1|suppressimg=1}}
{{User:LionsPhil/InfoboxProto|title=Template Quest|author=LionsPhil|thread1=0|suppresscat=1}}
This is the template for making a neat infobox for a quest, as shown on the right. Put it at the top of quest pages. It automatically adds the page to [[:Category:Quests]], to [[:Category:Series Quests]] if it has multiple threads, and will add [[Template:Noauthor]] and [[Template:Nolink]] if appropriate. You'll still need to list other categories manually, as appropriate.
This is the template for making a neat infobox for a quest, as shown on the right. Put it at the top of quest pages. It automatically adds the page to [[:Category:Quests]], and will add [[:Template:Noauthor]] if appropriate. You'll still need to list [[:Category:Running Quests]] and [[:Category:Image Quests]] as appropriate.
 
= Usage =
== Usage ==
Parameters (all are optional, although at least author is expected):
Parameters (all are optional, although at least <code>author</code> and <code>thread1</code> are expected):
== Metadata ==
=== Metadata ===
;title:Title of the quest. Defaults to the current page name; normally you should leave it to do this.
;title:Title of the quest. Defaults to the current page name; normally you should leave it to do this.  Useful if the page name includes a disambiguation in parenthesis.  (Ie, if the page name is "Quest Name (Author)" set <code>|title=Quest Name</code> to avoid the silliness of "Quest Name (Author) by Author").
;author:Quest author; will be linked to as a wiki node, even if it has whitespace.
;author:Quest author; will be linked to as a wiki node, even if it has whitespace.
;image:Quest image, without namespace. Will be thumbnailed to fit. Optional.
;image:Quest image, without namespace. Will be thumbnailed to fit. Optional.
== Threads ==
;imageext:Post number on the board to take the image from. Use this '''or''' <code>image</code>, not both. You can override the board with <code>imageextboard</code>, <s>but should never need to</s>.  Useful if the dis thread OP is better than the thread OP. Optional.
All thread parameters must be numbered, starting from 1 and increasing monotonically (no gaps). For example, <code><nowiki>thread1=500|thread2=600</nowiki></code>&hellip;.
If neither <code>image</code> parameter is provided, the Infobox will fall back to using the OP image of the first thread by default.
 
==== Special cases ====
;authorext:Extra authors; this is appended after the primary author, so if you need to use it you probably want something like <code><nowiki>and [[Dave]]</nowiki></code>, or <code><nowiki>et al.</nowiki></code>. Adds [[:Category:Quests with Multiple Authors]] automatically if used.  Optional.
;authorextcomma:Adds a comma right after the author if set to 1.  Useful if there's more than 2 authors, since ''authorext'' adds a space before its text appears.  Optional.
;authoralias:Author alias; this is used if the author goes by a different name, for instance the infamous [[Silvermoon]] series. Optional.
;dead:Set this to 1 to put the quest in [[:Category:Dead Quests]] instead of [[:Category:Quests]] and keep it off the main list. A quest is considered dead ''if and only if'' all threads are in the [https://tgchan.org/kusaba/graveyard/catalog.html graveyard].
;mouseover:Allows you to set mouseover / title text for the infobox image.  Optional, use sparingly.
 
=== Threads ===
All thread parameters must be numbered, starting from 1. For example, <code><nowiki>thread1=500|thread2=600</nowiki></code>&hellip;.
;threadN:Post numbers for the threads of the quest.
;threadN:Post numbers for the threads of the quest.
;threadNname:Optional 'name' for the thread, e.g. "Chapters 1&ndash;2". If the first thread is named, a numbered list is used to automatically provide the thread numbers.
;threadNname:Optional 'name' for the thread, e.g. "Chapters 1&ndash;2". If the first thread is named, a numbered list is used to automatically provide the thread numbers.
;disthreadN:Post numbers for discussion threads.
;disthreadN:Post numbers for discussion threads.
=== Specials ===
;disthreadNname:Optional name for discussion threads.
 
==== Specials ====
For example, 'April Fool' versions of quests.
For example, 'April Fool' versions of quests.
;specthreadN:Post numbers for any 'special' threads.
;specthreadN:Post numbers for any 'special' threads.
;specthreadNboard:Board for corresponding 'special' thread; defaults to <code>quest</code>.
;specthreadNboard:Board for corresponding 'special' thread; defaults to <code>quest</code>.
;specthreadNname:Required name for corresponding special thread.
;specthreadNname:Required name for corresponding special thread.
== Other ==
 
;suppresscat:Set this to something non-blank to prevent automatic categorisation. You probably don't want to use this.
=== Other ===
== Example ==
;prethreads:Value is spat out verbatim in the thread block, before thread 1. ''Avoid using this''; it's for some very special cases where quests have some of their threads hosted externally. It is '''not''' for subheadings.
;threadNpre:Place some markup before a thread entry, for example to do horizontal rules separating the list. You need to do a <code><nowiki><nowiki></nowiki></nowiki></code> (or <code><nowiki><nowiki/></nowiki></code>, same thing) trick to get a leading newline to separate it from a previous list element; see [[Bubble Bucket]] and [[Cutebold Slaughter Fest]] for examples. The matching <code>threadN</code> must be specified.
;postthreads:Works like prethreads, but spits out information after the last thread instead of before thread 1.  Useful only in special cases, say, when the final thread or epilogue material is hosted externally.
 
If you really need them, there are dis and spec thread versions of the previous three commands, as well.  (Namely '''predisthreads''', '''disthreadNpre''', '''postdisthreads''', '''prespecthreads''', '''specthreadNpre''' and '''postspecthreads''').  They use the same syntax and function in the same manner, just in different blocks of the infobox.
 
;suppresscat:Set this to 1 to disable automatic categorisation. You probably don't want to use this.
;suppressnum:Set this to 1 to disable automatic numbering of threads when using thread names.
;suppressimg:Set this to 1 to disable automatic fallback to using the OP image of <code>thread1</code>. Has no effect if you manually specify an image with <code>image</code> or <code>imageext</code>.
;caption:Places a caption centered beneath the infobox.  Useful if you need to have a footnote, for some reason.
 
=== Example ===
A quick reminder of MediaWiki template syntax; whitespace is reasonably flexible either side of the pipes, so do whatever is most readable:
A quick reminder of MediaWiki template syntax; whitespace is reasonably flexible either side of the pipes, so do whatever is most readable:
<pre><nowiki>{{InfoboxQuest|author=TestPattern|image=tozol_title.png
<pre><nowiki>{{Infobox
|thread1=79880|thread2=94645
|author=TestPattern
|image=tozol_title.png
|thread1=79880
|thread2=94645
|disthread1=316424
|disthread1=316424
|specthread1=156238|specthread1name=April Fool's Edition
|specthread1=156238|specthread1name=April Fool's Edition
}}</nowiki></pre>
}}</nowiki></pre>
There are some more abstract examples on the [[User:LionsPhil/InfoboxTest|development testing page]].
There are some more abstract examples on the [[User:LionsPhil/InfoboxTest|development testing page]], and you can [http://tgchan.org/wiki/Special:WhatLinksHere/Template:Infobox find pages using this template].
= Maintenance notes =
 
* Depends on the automatic redirect from <code>/quest/</code> to <code>/questarch/</code> for archived threads (semantically, the <code>/quest/</code> version is considered its canonical URI). This allows the "current thread" to work without having to be flagged as special in any way.
== Maintenance notes ==
* Depends on the automatic redirect from <code>/quest/</code> to <code>/questarch/</code> (or <code>/graveyard/</code>) for archived threads (semantically, the <code>/quest/</code> version is considered its canonical URI). This allows the "current thread" to work without having to be flagged as special in any way.
* Automatic image fallback depends on the same redirects as [[Template:Fanart]].
* Depends on the [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions ParserFunctions extension] to support optional parameters gracefully. This makes the code pretty hairy, so take care editing.
* Depends on the [http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions ParserFunctions extension] to support optional parameters gracefully. This makes the code pretty hairy, so take care editing.
* The maximum number of threads is limited by the implementation repeating the definition for each number. Unfortunately this is a common MediaWiki paradigm as it has no set handling in templates.
* The maximum number of threads is limited by the implementation repeating the definition for each number. Unfortunately this is a common MediaWiki paradigm as it has no set handling in templates.
* The width is set as a battle between a desired table width of 250px, which sets a softer maximum than a max-width, and a div strut in the title which may be matched by a 250px image, which acts as a min-width for the ''inner'' (content) boundary of the table.

Latest revision as of 20:24, 11 August 2018

This is a template documentation page. It is transcluded into place.

Purpose

Template Quest by LionsPhil

This is the template for making a neat infobox for a quest, as shown on the right. Put it at the top of quest pages. It automatically adds the page to Category:Quests, to Category:Series Quests if it has multiple threads, and will add Template:Noauthor and Template:Nolink if appropriate. You'll still need to list other categories manually, as appropriate.

Usage

Parameters (all are optional, although at least author and thread1 are expected):

Metadata

title
Title of the quest. Defaults to the current page name; normally you should leave it to do this. Useful if the page name includes a disambiguation in parenthesis. (Ie, if the page name is "Quest Name (Author)" set |title=Quest Name to avoid the silliness of "Quest Name (Author) by Author").
author
Quest author; will be linked to as a wiki node, even if it has whitespace.
image
Quest image, without namespace. Will be thumbnailed to fit. Optional.
imageext
Post number on the board to take the image from. Use this or image, not both. You can override the board with imageextboard, but should never need to. Useful if the dis thread OP is better than the thread OP. Optional.

If neither image parameter is provided, the Infobox will fall back to using the OP image of the first thread by default.

Special cases

authorext
Extra authors; this is appended after the primary author, so if you need to use it you probably want something like and [[Dave]], or et al.. Adds Category:Quests with Multiple Authors automatically if used. Optional.
authorextcomma
Adds a comma right after the author if set to 1. Useful if there's more than 2 authors, since authorext adds a space before its text appears. Optional.
authoralias
Author alias; this is used if the author goes by a different name, for instance the infamous Silvermoon series. Optional.
dead
Set this to 1 to put the quest in Category:Dead Quests instead of Category:Quests and keep it off the main list. A quest is considered dead if and only if all threads are in the graveyard.
mouseover
Allows you to set mouseover / title text for the infobox image. Optional, use sparingly.

Threads

All thread parameters must be numbered, starting from 1. For example, thread1=500|thread2=600….

threadN
Post numbers for the threads of the quest.
threadNname
Optional 'name' for the thread, e.g. "Chapters 1–2". If the first thread is named, a numbered list is used to automatically provide the thread numbers.
disthreadN
Post numbers for discussion threads.
disthreadNname
Optional name for discussion threads.

Specials

For example, 'April Fool' versions of quests.

specthreadN
Post numbers for any 'special' threads.
specthreadNboard
Board for corresponding 'special' thread; defaults to quest.
specthreadNname
Required name for corresponding special thread.

Other

prethreads
Value is spat out verbatim in the thread block, before thread 1. Avoid using this; it's for some very special cases where quests have some of their threads hosted externally. It is not for subheadings.
threadNpre
Place some markup before a thread entry, for example to do horizontal rules separating the list. You need to do a <nowiki></nowiki> (or <nowiki/>, same thing) trick to get a leading newline to separate it from a previous list element; see Bubble Bucket and Cutebold Slaughter Fest for examples. The matching threadN must be specified.
postthreads
Works like prethreads, but spits out information after the last thread instead of before thread 1. Useful only in special cases, say, when the final thread or epilogue material is hosted externally.

If you really need them, there are dis and spec thread versions of the previous three commands, as well. (Namely predisthreads, disthreadNpre, postdisthreads, prespecthreads, specthreadNpre and postspecthreads). They use the same syntax and function in the same manner, just in different blocks of the infobox.

suppresscat
Set this to 1 to disable automatic categorisation. You probably don't want to use this.
suppressnum
Set this to 1 to disable automatic numbering of threads when using thread names.
suppressimg
Set this to 1 to disable automatic fallback to using the OP image of thread1. Has no effect if you manually specify an image with image or imageext.
caption
Places a caption centered beneath the infobox. Useful if you need to have a footnote, for some reason.

Example

A quick reminder of MediaWiki template syntax; whitespace is reasonably flexible either side of the pipes, so do whatever is most readable:

{{Infobox
|author=TestPattern
|image=tozol_title.png
|thread1=79880
|thread2=94645
|disthread1=316424
|specthread1=156238|specthread1name=April Fool's Edition
}}

There are some more abstract examples on the development testing page, and you can find pages using this template.

Maintenance notes

  • Depends on the automatic redirect from /quest/ to /questarch/ (or /graveyard/) for archived threads (semantically, the /quest/ version is considered its canonical URI). This allows the "current thread" to work without having to be flagged as special in any way.
  • Automatic image fallback depends on the same redirects as Template:Fanart.
  • Depends on the ParserFunctions extension to support optional parameters gracefully. This makes the code pretty hairy, so take care editing.
  • The maximum number of threads is limited by the implementation repeating the definition for each number. Unfortunately this is a common MediaWiki paradigm as it has no set handling in templates.
  • The width is set as a battle between a desired table width of 250px, which sets a softer maximum than a max-width, and a div strut in the title which may be matched by a 250px image, which acts as a min-width for the inner (content) boundary of the table.