Difference between revisions of "Dungeons and Dragons Wiki:Ask Syntax"

From Dungeons and Dragons Wiki
Jump to: navigation, search
m (making whole page not small)
m (Undo revision 161203 by 83.110.233.86 (talk))
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<small>Main documentation for Semantic Mediawiki can be found at [http://semantic-mediawiki.org/wiki/Semantic_MediaWiki]</small>
+
<small>Main documentation for Semantic Mediawiki can be found at [http://semantic-mediawiki.org/wiki/Semantic_MediaWiki the Semantic Mediawiki Wiki]</small>
  
 
== Setting Properties ==
 
== Setting Properties ==
Line 21: Line 21:
 
=== Query ===
 
=== Query ===
  
The query should be the first value you sendIt can either be <nowiki>[[Category:categoryName]] or [[Property::value]]</nowiki>.  For example, to choose all user fighter feats in 3.5e, the query would be <nowiki>[[Category:3.5e]] [[Category:Feat]] [[Category:User]] [[Type::Fighter]]</nowiki>
+
The query is a set of properties and categories to filterFiltering is done via <nowiki>[[Category:categoryName]] or [[Property::value]]</nowiki>.  For example, to choose all user fighter feats in 3.5e, the query would be <nowiki>[[Category:3.5e]] [[Category:Feat]] [[Category:User]] [[Type::Fighter]]</nowiki>
  
=== Other parameters ===
+
In an <nowiki>{{ask:}}</nowiki> template, it should be the first value you send.
  
The following is a table of parameters this parser function accepts.
+
== Helper Templates ==
  
{| class="d20 zebra" style="text-align:left;"
+
Dungeons and Dragons Wiki has a set of helper templates with the name of the form "SMW ''type'' Query".  These templates take one unnamed parameter, the query.  It then outputs the results on the page for you, giving a proper default and using the pipe trick template when necessary.  Currently the entire list of helper templates is:
! Parameter
 
! Possible values
 
! Description
 
|-
 
| <tt>format</tt>
 
| a format name (see below)
 
| selected output format; some formats allow further parameters (see [[#Result formats]])
 
|-
 
| <tt>limit</tt>
 
| non-negative number
 
| maximal number of pages selected (in the case of a table: rows)
 
|-
 
| <tt>offset</tt>
 
| number
 
| where to start
 
|-
 
| <tt>sort</tt>
 
| property name or a list of property names separated by ,
 
| name of properties to use for sorting queries (see [[Help:Selecting pages]])
 
|-
 
| <tt>order</tt>
 
| <tt>ascending</tt>/<tt>asc</tt>, <tt>descending</tt>/<tt>desc</tt>/<tt>reverse</tt>,<br />or a list of those if more than one property is used for sorting
 
| defines how results should be ordered, only applicable if <tt>sort</tt> is used, <tt>ascending</tt> is the default (see [[Help:Selecting pages]])
 
|-
 
| <tt>headers</tt>
 
| <tt>show</tt>, <tt>hide</tt>
 
| shows or hides the labels/headers used in some output formats such as «table», <tt>show</tt> is default
 
|-
 
| <tt>mainlabel</tt>
 
| plain text
 
| title of the first column (the one with the page titles in it), default is no title; set to <tt>-</tt> to suppress printing the page titles
 
|-
 
| <tt>link</tt>
 
| <tt>none</tt>, <tt>subject</tt>, <tt>all</tt>
 
| defines which article names in the result are hyperlinked, <tt>all</tt> normally is the default
 
  
Note: linking can also be controlled for individual printouts using the ''plain output format'' as described in [[Help:Displaying_information#Display_format|Displaying information]].
+
;List:for paragraph format
|-
+
;UL:for a bullet list
| <tt>default</tt>
+
;Category:for display as if it was a list on a category page
| plain text
+
;Embed:for displaying full transcluded pages&mdash;use with caution.
| if, for any reason, the query returns no results, this will be printed instead
+
;Titled Embed:for displaying full transcluded pages, giving them a top-level heading that links back to the embedded article.
|-
 
| <tt>intro</tt>
 
| plain text
 
| initial text that prepends the output, if at least some results exist
 
|-
 
| <tt>outro</tt>
 
| plain text
 
| text that is appended to the output, if at least some results exist
 
|-
 
| <tt>searchlabel</tt>
 
| plain text
 
| text for continuing the search (default is «&hellip; further results»)
 
|}
 
  
For the format, use one of list, table, ul, or ol.
+
=== Example ===
  
;list:Comma separated list
+
This example shows the query for showing the 4e other pages in an unordered list:
;table:Table
+
 
;ul:Unordered list
+
<pre><nowiki>{{SMW UL Query|[[Category:4e]][[Category:User]][[Category:Other]]}}</nowiki></pre>
;ol:Ordered list
+
 
 +
This example shows the query for showing all feats created by [[User:Havvy|Havvy]] in a list format:
 +
 
 +
<pre><nowiki>{{SMW List Query|[[Category:Feat]][[Author::Havvy]]}}</nowiki></pre>

Latest revision as of 13:54, 6 July 2012

Main documentation for Semantic Mediawiki can be found at the Semantic Mediawiki Wiki

Setting Properties[edit]

To set a property without showing the text on the page, use the format {{#set:Property=Value goes here}}.

To set a property and show the text on the page, use the format [[Property::Value goes here]].

To set multiple properties (mostly used at the beginning of classes), use the following format:

{{set:Property1=Value goes here
|Property2=Value of Property 2
|...
|PropertyN=Value of last property.
}}

Ask Function[edit]

Semantic Mediawiki gives the parser function {{ask:<query>[[|param=value[...|param=value]]}}.

Query[edit]

The query is a set of properties and categories to filter. Filtering is done via [[Category:categoryName]] or [[Property::value]]. For example, to choose all user fighter feats in 3.5e, the query would be [[Category:3.5e]] [[Category:Feat]] [[Category:User]] [[Type::Fighter]]

In an {{ask:}} template, it should be the first value you send.

Helper Templates[edit]

Dungeons and Dragons Wiki has a set of helper templates with the name of the form "SMW type Query". These templates take one unnamed parameter, the query. It then outputs the results on the page for you, giving a proper default and using the pipe trick template when necessary. Currently the entire list of helper templates is:

List
for paragraph format
UL
for a bullet list
Category
for display as if it was a list on a category page
Embed
for displaying full transcluded pages—use with caution.
Titled Embed
for displaying full transcluded pages, giving them a top-level heading that links back to the embedded article.

Example[edit]

This example shows the query for showing the 4e other pages in an unordered list:

{{SMW UL Query|[[Category:4e]][[Category:User]][[Category:Other]]}}

This example shows the query for showing all feats created by Havvy in a list format:

{{SMW List Query|[[Category:Feat]][[Author::Havvy]]}}