Parser Function semorg-list

From SemanticOrganization
Jump to: navigation, search

This parser function is used to show lists of pages belonging to a certain category.

Markup Result
Name Description Host Members
Testgroup Johnny Jane Doe
Testgroup 2 Group for testing purposes Jane Jane Doe, John Doe

or actually:

  |named args=yes
  |intro=<table class="table table-bordered table-sm">

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.


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>}} if it should be different from the default Template:semorg-<feature>-row. Note that you can leave out the “semorg-” and “-row“ parts of the template name.


The following parameters are available:


The default category is the content of semorg-<feature>-category. If you want to use a different category, you can overwrite the default using this parameter.

You can also unset it with “-“ if you don't want to or cannot use a category for querying. You need to specify a query then.

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 semorg-<row template>-row. You'll have to provide it on your own if you want to replace the default.

Note that the default message for the headers will change to semorg-list-<row template>-headers instead of semorg-list-<feature>-headers, if the message exists.


Use this parameter to overwrite the default headers. It should be a comma separated list of <feature>-<field> entries that will be expanded to semorg-field-<feature>-<field>-name message calls.


You can add additional query conditions using Semantic MediaWiki's syntax. For example, if you would like to list only active groups, just add query=[[semorg-group-active::true]].


By default, the parser function queries all fields that are defined for the feature and passes them on to the row template as named args. You can add custom lines to query for your custom fields or for chained properties. For example, if you would like to use the email address of the group's host in the row template you could add |?semorg-group-host.semorg-person-email=email.

In order for this to work, you will need to use the row template parameter to call your custom template, where you can then use {{{?email|}}} to get the value. You can customize the headers if you also create a semorg-list-<row template>-headers system message. If a message of that name doesn't exist, the default semorg-list-<feature>-headers message will be used.

sort, order, default, limit, userparam

These are the same as the standard parameters of {{#ask}} queries.


The searchlabel will be suppressed by default but can be explicitly set.


All fields specified as <feature>-<field> can be used as query strings in URLs. That means that you can build links to a filtered version of the list.


Fields specified with this parameter can not only be queried, the available values will also be shown as links for quick filtering.

You can set a default filter value using the <feature>-<field>=<default> syntax.

Markup Result
  |filter links=group-host
Host: User:Johnny ×
Name Description Host Members
Testgroup Johnny Jane Doe


This parameter creates a download link for a csv containing the fields specified (as a comma separated list of <field>.

Markup Result
Name Description Host Members
Testgroup Johnny Jane Doe
Testgroup 2 Group for testing purposes Jane Jane Doe, John Doe


Set this parameter if you don't want the pagination links to show up at the bottom of the table.

Markup Result
Name Description Host Members
Testgroup Johnny Jane Doe
Testgroup 2 Group for testing purposes Jane Jane Doe, John Doe