Editing Template:List/doc

Jump to navigation Jump to 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:
 
{{TOCright}}
 
{{TOCright}}
This template lists the contents of the category given as its first argument, e.g. to list all pages in the category [[:Category: Fabric]], use:
+
This template lists the contents of the category given as its first argument, e.g. to list all pages in the category [[:Category: Fabric Textile]], use:
  
     <nowiki>{{List|Fabric}}</nowiki>
+
     <nowiki>{{List|Fabric Textile}}</nowiki>
  
 
== Result Order and Number ==
 
== Result Order and Number ==
 
Optionally, you can limit the number of pages listed, sort the list and order it. For example, to list the two most expensive fabrics, breaking ties by ease to work with them, you could use ('''NB: Whitespace and captitalization matter'''):
 
Optionally, you can limit the number of pages listed, sort the list and order it. For example, to list the two most expensive fabrics, breaking ties by ease to work with them, you could use ('''NB: Whitespace and captitalization matter'''):
  
     <nowiki>{{List|Fabric|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc}}</nowiki>
+
     <nowiki>{{List|Fabric Textile|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc}}</nowiki>
  
 
This gives:
 
This gives:
  
 
<div style='border: 1px solid #aaa; margin: 1em 0; padding: 1em'>
 
<div style='border: 1px solid #aaa; margin: 1em 0; padding: 1em'>
{{List|Fabric|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc|item=Ask/Item Light}}
+
{{List|Fabric Textile|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc|item=Ask/Item Light}}
 
</div>
 
</div>
  
Line 22: Line 22:
 
! Parameter !! Description
 
! Parameter !! Description
 
|-
 
|-
|<nowiki>{{{Name}}}</nowiki> || Name of the page
+
|<nowiki>{{{?Name}}}</nowiki> || Name of the page
 
|-
 
|-
|<nowiki>{{{Image}}}</nowiki> || Name of the icon for the page
+
|<nowiki>{{{?Image}}}</nowiki> || Name of the icon for the page
 
|-
 
|-
|<nowiki>{{{Description}}}</nowiki> || Description of the page (from XML)
+
|<nowiki>{{{?Description}}}</nowiki> || Description of the page (from XML)
 
|-
 
|-
|<nowiki>{{{Note}}}</nowiki> || Description of the page (user-set, usually the first paragraph of the page content)
+
|<nowiki>{{{?Note}}}</nowiki> || Description of the page (user-set, usually the first paragraph of the page content)
 
|-
 
|-
|<nowiki>{{{Tags}}}</nowiki> || Name of the template that can produce the tags for the page
+
|<nowiki>{{{?Tags}}}</nowiki> || Name of the template that can produce the tags for the page
|-
 
|<nowiki>{{{userparam}}}</nowiki> || Value passed to ''param='' in the list template
 
 
|}
 
|}
  
Line 40: Line 38:
 
Let's return to above example:
 
Let's return to above example:
  
     <nowiki>{{List|Fabric|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc}}</nowiki>
+
     <nowiki>{{List|Fabric Textile|limit=2|sort=Market Value Base,Work To Make Factor|order=desc,asc}}</nowiki>
  
 
When MediaWiki expands that template, it becomes:
 
When MediaWiki expands that template, it becomes:
  
     <nowiki>{{#ask: [[Category: Fabric]]
+
     <nowiki>{{#ask: [[Category: Fabric Textile]]
 
     | ?# = Name
 
     | ?# = Name
 
     | ?Image
 
     | ?Image
Line 59: Line 57:
 
     }}</nowiki>
 
     }}</nowiki>
  
The first line tells SMW to look for all pages in the [[:Category: Fabric]] category. The new five lines start with ? and tell it which data to select from those pages (more about that below). The "?# = Name" means "take the page title and refer to it as Name". After that, the template tells SMW to called the [[Template:Ask/Item]] template for every result (format = template and template = Ask/Item), to pass along the data as named arguments, and to use only page names instead of links (e.g. "Devilstrand" instead of "<nowiki>[[Devilstrand]]</nowiki>").
+
The first line tells SMW to look for all pages in the [[:Category: Fabric Textile]] category. The new five lines start with ? and tell it which data to select from those pages (more about that below). The "?# = Name" means "take the page title and refer to it as ?Name". After that, the template tells SMW to called the [[Template:Ask/Item]] template for every result (format = template and template = Ask/Item), to pass along the data as named arguments, and to use only page names instead of links (e.g. "Devilstrand" instead of "<nowiki>[[Devilstrand]]</nowiki>").
  
 
Thus, the above template call becomes:
 
Thus, the above template call becomes:
  
     <nowiki>{{Ask/Item|Name=Hyperweave|Image=File:Hyperweave.png|Description=High-tech nano-fibers...|Note=Top-of-the-shelf, incredibly tough...|Tags=Template:Textile/Tags}}</nowiki>
+
     <nowiki>{{Ask/Item|?Name=Hyperweave|?Image=File:Hyperweave.png|?Description=High-tech nano-fibers...|?Note=Top-of-the-shelf, incredibly tough...|?Tags=Template:Textile/Tags}}</nowiki>
     <nowiki>{{Ask/Item|Name=Devilstrand|Image=File:Devilstrand.png|Description=Fabric spun...|Note=Devilstrand is obtained...|Tags=Template:Textile/Tags}}</nowiki>
+
     <nowiki>{{Ask/Item|?Name=Devilstrand|?Image=File:Devilstrand.png|?Description=Fabric spun...|?Note=Devilstrand is obtained...|?Tags=Template:Textile/Tags}}</nowiki>
  
 
These are then substituted normally again.
 
These are then substituted normally again.
  
(NB: Template:Textile/Tags does not exist yet, so the Tags parameter above is empty at the moment. This will change soon.)
+
(NB: Template:Textile/Tags does not exist yet, so the ?Tags parameter above is empty at the moment. This will change soon.)
  
 
== Where does the data come from? ==
 
== Where does the data come from? ==
Line 76: Line 74:
  
 
The <nowiki>{{#set: ... }}</nowiki> parser function is the opposite of <nowiki>{{#ask: ... }}</nowiki>, it tells SMW that the page in question has one or more properties or relations. For the full description, see again [http://semantic-mediawiki.org/wiki/Help:Properties_and_types the official documentation].
 
The <nowiki>{{#set: ... }}</nowiki> parser function is the opposite of <nowiki>{{#ask: ... }}</nowiki>, it tells SMW that the page in question has one or more properties or relations. For the full description, see again [http://semantic-mediawiki.org/wiki/Help:Properties_and_types the official documentation].
 
You can browse the data available about a page by using the "Browse Properties" link under "Tools" in the menu on the left side of the screen. You can browse all page/value pairs for a property by visiting its page in the Property: namespace, e.g. [[Property:Market_Value_Base]].
 
 
<includeonly>[[Category:SMW templates]]</includeonly>
 
<noinclude>[[Category:Template documentation]]</noinclude>
 

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, 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. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)