Parser Functions: Difference between revisions
(6 intermediate revisions by the same user not shown) | |||
Line 526: | Line 526: | ||
=== #semorg-query === | === #semorg-query === | ||
Get query value (from URL). Use [{{fullurl:{{FULLPAGENAME}}##semorg-query}} this link] to see the effect. | Get query value (from URL). Use [{{fullurl:{{FULLPAGENAME}}##semorg-query|test=test}} this link] to see the effect. | ||
{| class="table table-bordered table-condensed" | {| class="table table-bordered table-condensed" | ||
Line 533: | Line 533: | ||
|<code><nowiki>{{#semorg-query:test}}</nowiki></code> | |<code><nowiki>{{#semorg-query:test}}</nowiki></code> | ||
|{{#semorg-query:test}} | |{{#semorg-query:test}} | ||
|} | |||
=== #semorg-phone === | |||
Render phone number in Semantic MediaWiki format. The default country code is set via [[MediaWiki:Semorg-default-country-code]]. | |||
{| class="table table-bordered table-condensed" | |||
! Markup !! Result | |||
|- | |||
|<code><nowiki>{{#semorg-phone:0699/1234567}}</nowiki></code> | |||
| {{#semorg-phone:0699/1234567}} | |||
|} | |||
=== #semorg-nocache === | |||
Can be used to disable caching on a page. | |||
=== #semorg-sum === | |||
Add amounts and return the sum by leaving out the amount parameter. | |||
{| class="table table-bordered table-condensed" | |||
! Markup !! Result | |||
|- | |||
|<code><nowiki>{{#semorg-sum:test|5}}{{#semorg-sum:test|10}}{{#semorg-sum:test}}</nowiki></code> | |||
| {{#semorg-sum:test|5}}{{#semorg-sum:test|10}}{{#semorg-sum:test}} | |||
|} | |} | ||
Latest revision as of 06:47, 14 November 2024
#semorg-person
called like this (preferably via template):
{{#semorg-person: |ref={{FULLPAGENAME}} |prefix={{{prefix|}}} |firstname={{{firstname|}}} |lastname={{{lastname|}}} |name={{{firstname|}}} {{{lastname|}}} |suffix={{{suffix|}}} |workstreet={{{workstreet|}}} |workpostalcode={{{workpostalcode|}}} |worklocality={{{worklocality|}}} |email={{{email|}}} |workphone={{{workphone|}}} |homepage={{{homepage|}}} |note={{{note|}}} |organization={{{organization|}}} |gender={{{gender|}}} }}
sets all the attributes and spits out a nicely formatted table with all the contact information and also a download link for a .vcard file
#semorg-field-rows
Returns the markup for the fields in a form.
Markup | Result |
---|---|
{{#semorg-field-rows:name |template=person }} |
only works in form definitions |
The following system messages control the appearance of the list:
Message | Function |
---|---|
semorg-field-<feature>-<field>-parameters | Any of Page Form's parameters for fields. |
semorg-field-<feature>-<field>-placeholder | |
semorg-field-<feature>-<field>-input-type | |
semorg-field-<feature>-<field>-values | |
semorg-field-<feature>-<field>-mapping-template | |
semorg-field-<feature>-<field>-class | |
semorg-field-<feature>-<field>-prefix | Content to be displayed before the field. |
semorg-field-<feature>-<field>-suffix | Content to be displayed after the field. |
The following parameters are available:
Parameter | Description |
---|---|
template | The name of the feature. |
#semorg-set
Shorthand for {{#set:}}
Markup | Result |
---|---|
{{#semorg-set:person |name={{{name|}}} }} |
{{#set: |semorg-person-name={{{name|}}} }} |
#semorg-set-list
Shorthand for {{#set:}}
for properties with multiple values.
Markup | Result |
---|---|
{{#semorg-set-list:person |name={{{name|}}} }} |
{{#set: |semorg-person-name={{{name|}}}|+sep=, }} |
#semorg-subobject
Shorthand for {{#subobject:}}
.
Markup | Result |
---|---|
{{#semorg-subobject:person |name={{{name|}}} }} |
{{#subobject: |semorg-person-name={{{name|}}}|+sep=, }} |
#semorg-table
Rendering template parameters (or other content) as a table. Field names are used for the first column.
Markup | Result |
---|---|
{{#semorg-table:person |name={{{name|Dummy Person}}} }} |
Name Dummy Person |
#semorg-toggle
Rendering template parameters (or other content) as a table. Field names are used for the first column.
Markup | Result |
---|---|
{{#semorg-toggle: |class=semorg-toggle-test |original-text=hide it |toggle-text=show it }} <div class="semorg-toggle-test"> Text to be toggled </div> |
Text to be toggled |
{{#semorg-toggle: |class=semorg-toggle-hidden-test |original-text=show it |toggle-text=hide it }} <div class="semorg-toggle-hidden-test" style="display:none"> Initially hidden </div> |
#semorg-list
This parser function is used to show lists of pages belonging to a certain category. For the details about this highly configurable parser function see Parser Function semorg-list
#semorg-overview
This parser function is used to create calls to {{#semorg-list:}}
using defaults partly defined by system messages.
As an example the call {{#semorg-list:person-contact}}
will be translated into:
{{#semorg-list:person |category=semorg-person-contact |row template=person-contact |links={{#ifexist:Template:semorg-person-contact-custom-links |{{semorg-person-contact-custom-links}} |{{#ifexist:Template:semorg-person-contact-links |{{semorg-person-contact-links}} }} }} |heading={{int:semorg-person-contact-page-name}} |formlink={{#semorg-formlink:person-contact}} }}
Behind the scenes it is using the following pre-defined system messages:
- semorg-overview-person-contact-parent-feature (“person”)
- semorg-overview-person-contact-row-template (“person-contact”)
- semorg-overview-person-contact-category (“semorg-person-contact”)
#semorg-user-create
Render a link to create a new user account if it doesn't exist already
Markup | Result |
---|---|
{{#semorg-user-create:Dummy User}} |
#semorg-formlink
This parser function is an abbreviation to call {{#formlink}}
with smart defaults.
Markup | Result |
---|---|
{{#semorg-formlink:meeting-group}}
|
Create Meeting |
The following system messages control the appearance of the list:
Message | Function |
---|---|
semorg-formlink-<feature>-link-text | The link text to be displayed. |
semorg-formlink-<feature>-link-type | Use this to set a wiki-wide default for all calls of {{#semorg-formlink:<feature>}}
|
semorg-formlink-<feature>-target | |
semorg-formlink-<feature>-tooltip | |
semorg-formlink-<feature>-popup | |
semorg-formlink-<feature>-new-window | |
semorg-formlink-<feature>-query-string | |
semorg-formlink-<feature>-returnto |
The following parameters are available:
Parameter | Description |
---|---|
link text, link type, target, tooltip, popup, new window, query string, returnto | These are the default parameters for Page Form's {{#formlink}} function
|
#semorg-forminput
This parser function is an abbreviation to call {{#forminput}}
with smart defaults.
Markup | Result |
---|---|
{{#semorg-forminput:group}}
|
The following system messages control the appearance of the list:
Message | Function |
---|---|
semorg-forminput-<feature>-button-text | The button text to be displayed. |
semorg-forminput-<feature>-size | Use this to set a wiki-wide default for all calls of {{#semorg-forminput:<feature>}}
|
semorg-forminput-<feature>-default-value | |
semorg-forminput-<feature>-query-string | |
semorg-forminput-<feature>-autocomplete-on-category | |
semorg-forminput-<feature>-autocomplete-on-namespace | |
semorg-forminput-<feature>-placeholder | |
semorg-forminput-<feature>-popup | |
semorg-forminput-<feature>-returnto |
The following parameters are available:
Parameter | Description |
---|---|
button text, size, default value, query string, autocomplete on category, autocomplete on namespace, placeholder, popup, returnto | These are the default parameters for Page Form's {{#forminput}} function
|
NB: The no autofocus
parameter is set by default.
#semorg-meetings
This is a shorthand to display
- a link to create a new meeting
- a list of scheduled meetings
- a list of recent meetings
Markup | Result | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{#semorg-meetings:group
|group=Testgroup
}}
|
Scheduled Group Meetings no meetings scheduled… no meetings scheduled… Past Group Meetings
|
The following system messages control the appearance:
Message | Function |
---|---|
semorg-list-meeting-current-heading | The heading for the list of current meetings |
semorg-list-meeting-past-heading | The heading for the list of recent meetings |
The following parameters are available:
Parameter | Description |
---|---|
group | If the group is not explicitly set it is assumed to be the title of the current page. You can set it to '+' if you want no specific group. |
#semorg-properties
Show a feature's properties/fields.
Markup | Result |
---|---|
{{#semorg-properties:group}}
|
domain, co-host, description, goals, name, host, permanent, active |
#semorg-values
Render all values for a specific property.
Markup | Result |
---|---|
{{#semorg-values:person-name}}
|
ACME Corp., Ad Min, Brad Pitt, Darth Vader, Jane Doe, John Doe, Luke Skywalker, UNO this is the result of the following code:{{#ask:[[semorg-person-name::+]] |mainlabel=- |headers=hide |limit=1000 |searchlabel= |?semorg-person-name# }} |
#semorg-tabs
Creates togglable tabs.
The following system messages control the appearance of the header:
Message | Function |
---|---|
semorg-tab-<feature>-<tab-id> | The link text for the tab. |
The following parameters are available:
Parameter | Description |
---|---|
?<tab-id>=<tab-content> | ID and content for a tab. |
#semorg-tabs-card
#semorg-user
Show the current user.
Markup | Result |
---|---|
{{#semorg-user:}}
|
User:192.168.0.1 |
#semorg-true
Test whether the first argument is one of SMW's true words.
Markup | Result |
---|---|
{{#semorg-true:yes|true|false}}
|
true |
#semorg-detail
Show header details for page. Replaces the main heading and provides a backlink to the overview page. See the documentation for Detail pages.
The following system messages control the appearance of the header:
Message | Function |
---|---|
semorg-<feature>-page-name | The title of the overview page |
semorg-<feature>-entity name | Name for the instance. Displayed over the page title. |
The following parameters are available:
Parameter | Description |
---|---|
heading | Heading to be displayed instead of the standard heading. Will also call {{DISPLAYTITLE:}} .
|
overview page | Page that should be linked to as the parent page. |
#semorg-datediff
Return the difference of two given datetimes. The function's optional third argument defines the unit and can have the values days
, hours
(the default), minutes
, or seconds
.
Markup | Result |
---|---|
{{#semorg-datediff:{{#time:c}}|{{#time:c|+1 day}}}}
|
24 |
#semorg-datediff-human
Return the difference of a given past datetime to the current time as readable for humans (“x ago“).
Markup | Result |
---|---|
{{#semorg-datediff-human:{{#time:c|+100 days}}}}
|
3 months ago |
#semorg-counter
Return an incrementing counter (can be used to create unique IDs).
Markup | Result |
---|---|
{{#semorg-counter:}}
|
1 |
#semorg-hash
Return MD5-Hash for given string.
Markup | Result |
---|---|
{{#semorg-hash:test}}
|
098f6bcd4621d373cade4e832627b4f6 |
#semorg-count
Return number of array entries (using explode). The separator is an optional second parameter.
Markup | Result |
---|---|
{{#semorg-count:entry1,entry2}}
|
2 |
{{#semorg-count:entry1;entry2, including comma|;}}
|
2 |
#semorg-query
Get query value (from URL). Use this link to see the effect.
Markup | Result |
---|---|
{{#semorg-query:test}}
|
#semorg-phone
Render phone number in Semantic MediaWiki format. The default country code is set via MediaWiki:Semorg-default-country-code.
Markup | Result |
---|---|
{{#semorg-phone:0699/1234567}}
|
+1-699-1234567 |
#semorg-nocache
Can be used to disable caching on a page.
#semorg-sum
Add amounts and return the sum by leaving out the amount parameter.
Markup | Result |
---|---|
{{#semorg-sum:test|5}}{{#semorg-sum:test|10}}{{#semorg-sum:test}}
|
15 |
Visualization
#semorg-network
tbd
#semorg-cooperation
tbd
#semorg-circles
tbd