Difference between revisions of "Parser Function semorg-list"
Line 40: | Line 40: | ||
|semorg-list-<feature>-headers | |semorg-list-<feature>-headers | ||
|Should contain a list of message keys that contain the texts for the table headers. For the example above the content of <code>semorg-list-group-headers</code> is “<code>group-name, group-description, group-host, group-members</code>“. The elements of the list should have the general form of <code><feature>-<field></code>. The list is used to reference another set of messages following the naming convention <code>semorg-field-<feature>-<field>-name</code>. So <code>semorg-field-group-name-name</code> is used to populate the heading of the first column in the example above. | |Should contain a list of message keys that contain the texts for the table headers. For the example above the content of <code>semorg-list-group-headers</code> is “<code>group-name, group-description, group-host, group-members</code>“. The elements of the list should have the general form of <code><feature>-<field></code>. The list is used to reference another set of messages following the naming convention <code>semorg-field-<feature>-<field>-name</code>. So <code>semorg-field-group-name-name</code> is used to populate the heading of the first column in the example above. | ||
+ | |- | ||
+ | |semorg-list-<feature>-row-template | ||
+ | |Specify a global row template for all calls of <code><nowiki>{{#semorg-list:<feature>}}</code> if it should be different from the default <code>Template:semorg-<feature>-row</code>. Note that you can leave out the “semorg-” and “-row“ parts of the template name. | ||
|} | |} | ||
Revision as of 20:47, 3 May 2019
This parser function is used to show lists of pages belonging to a certain category.
Markup | Result | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{#semorg-list:group}}
|
or actually: {{#ask:[[category:semorg-group]] |mainlabel=target |?semorg-group-name=name |?semorg-group-description=description |?semorg-group-type=type |?semorg-group-permanent=permanent |?semorg-group-active=active |?semorg-group-host=host |format=template |link=none |template=semorg-group-row |named args=yes |intro=<table class="table table-bordered table-sm"> <tr><th>Name</th><th>Description</th> <th>Host</th><th>Members</th></tr> |outro=</table> }} |
How it works
The parser function constructs a semantic {{#ask:}}
query using the result format template
. The template used to output the data can be customized using the row template
parameter. All the default fields for a feature will be passed to the template as named args.
Messages
The following system messages control the appearance of the list:
Message | Function |
---|---|
semorg-list-<feature>-headers | Should contain a list of message keys that contain the texts for the table headers. For the example above the content of semorg-list-group-headers is “group-name, group-description, group-host, group-members “. The elements of the list should have the general form of <feature>-<field> . The list is used to reference another set of messages following the naming convention semorg-field-<feature>-<field>-name . So semorg-field-group-name-name is used to populate the heading of the first column in the example above.
|
semorg-list-<feature>-row-template | Specify a global row template for all calls of {{#semorg-list:<feature>}}</code> if it should be different from the default <code>Template:semorg-<feature>-row</code>. Note that you can leave out the “semorg-” and “-row“ parts of the template name.
|}
=== Parameters ===
The following parameters are available:
==== {{semorg-parser-function-parameter|category}} ====
The default category is the content of <code>semorg-<feature>-category</code>. If you want to use a different category, you can overwrite the default using this parameter.
You can also unset it with “<code>-</code>“ if you don't want to or cannot use a category for querying. You need to specify a <code>query string</code> then.
==== {{semorg-parser-function-parameter|row template}} ====
The parser function constructs a query that calls a template for every row. The default value is the same as the name of the feature. The actual name of the template called should be <code>semorg-<row template>-row</code>. You'll have to provide it on your own if you want to replace the default.
==== {{semorg-parser-function-parameter|query}} ====
You can add additional query conditions using Semantic MediaWiki's syntax. For example, if you would like to list only active groups, just add <code><nowiki>query=[[semorg-group-active::true]] .
|