Difference between revisions of "Parser Functions"

From SemanticOrganization
Jump to: navigation, search
(Marked this version for translation)
 
(50 intermediate revisions by the same user not shown)
Line 23: Line 23:
 
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
 
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-person-ref ===
+
=== #semorg-field-rows ===
  
=== #semorg-form ===
+
Returns the markup for the fields in a form.
  
=== #semorg-field ===
+
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-field-rows:name
 +
  |template=person
 +
}}</nowiki></pre>
 +
|''only works in form definitions''
 +
|}
  
=== #semorg-fields ===
+
The following system messages control the appearance of the list:
  
=== #semorg-field-rows ===
+
{| class="table table-bordered table-condensed"
 +
! 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:
 +
 
 +
{| class="table table-bordered table-condensed"
 +
! Parameter !! Description
 +
|-
 +
|template
 +
|The name of the feature.
 +
|}
  
 
=== #semorg-set ===
 
=== #semorg-set ===
 +
 +
Shorthand for <code><nowiki>{{#set:}}</nowiki></code>
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-set:person
 +
  |name={{{name|}}}
 +
}}</nowiki></pre>
 +
|<pre><nowiki>{{#set:
 +
  |semorg-person-name={{{name|}}}
 +
}}</nowiki></pre>
 +
|}
  
 
=== #semorg-set-list ===
 
=== #semorg-set-list ===
  
=== #semorg-table ===
+
Shorthand for <code><nowiki>{{#set:}}</nowiki></code> for properties with multiple values.
 +
 
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-set-list:person
 +
  |name={{{name|}}}
 +
}}</nowiki></pre>
 +
|<pre><nowiki>{{#set:
 +
  |semorg-person-name={{{name|}}}|+sep=,
 +
}}</nowiki></pre>
 +
|}
  
 
=== #semorg-subobject ===
 
=== #semorg-subobject ===
  
=== #semorg-network ===
+
Shorthand for <code><nowiki>{{#subobject:}}</nowiki></code>.
 +
 
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-subobject:person
 +
  |name={{{name|}}}
 +
}}</nowiki></pre>
 +
|<pre><nowiki>{{#subobject:
 +
  |semorg-person-name={{{name|}}}|+sep=,
 +
}}</nowiki></pre>
 +
|}
 +
 
 +
=== #semorg-table ===
  
=== #semorg-cooperation ===
+
Rendering template parameters (or other content) as a table. Field names are used for the first column.
  
=== #semorg-circles ===
+
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-table:person
 +
  |name={{{name|Dummy Person}}}
 +
}}</nowiki></pre>
 +
|{{#semorg-table:person
 +
  |name={{{name|Dummy Person}}}
 +
}}
 +
|}
  
 
=== #semorg-toggle ===
 
=== #semorg-toggle ===
 +
 +
Rendering template parameters (or other content) as a table. Field names are used for the first column.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-toggle:
 +
  |class=semorg-toggle-test
 +
  |original-text=hide it
 +
  |toggle-text=show it
 +
}}
 +
<div class="semorg-toggle-test">
 +
Text to be toggled
 +
</div></nowiki></pre>
 +
|{{#semorg-toggle:
 +
  |class=semorg-toggle-test
 +
  |original-text=hide it
 +
  |toggle-text=show it
 +
}}<div class="semorg-toggle-test">
 +
Text to be toggled
 +
</div>
 +
|-
 +
|<pre><nowiki>{{#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></nowiki></pre>
 +
|{{#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 ===
 
=== #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-user-create ===
 
=== #semorg-user-create ===
 +
 +
Render a link to create a new user account if it doesn't exist already
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<pre><nowiki>{{#semorg-user-create:Dummy User}}
 +
<div class="semorg-toggle-test">Text to be toggled</div></nowiki></pre>
 +
|{{#semorg-user-create:Dummy User}}
 +
|}
  
 
=== #semorg-formlink ===
 
=== #semorg-formlink ===
 +
 +
This parser function is an abbreviation to call <code><nowiki>{{#formlink}}</nowiki></code> with smart defaults.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-formlink:meeting-group}}</nowiki></code>
 +
|{{#semorg-formlink:meeting-group}}
 +
|}
 +
 +
The following system messages control the appearance of the list:
 +
 +
{| class="table table-bordered table-condensed"
 +
! 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 <code><nowiki>{{#semorg-formlink:<feature>}}</nowiki></code>
 +
|-
 +
|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:
 +
 +
{| class="table table-bordered table-condensed"
 +
! Parameter !! Description
 +
|-
 +
|link text, link type, target, tooltip, popup, new window, query string, returnto
 +
|These are the default parameters for Page Form's <code><nowiki>{{#formlink}}</nowiki></code> function
 +
|}
  
 
=== #semorg-forminput ===
 
=== #semorg-forminput ===
 +
 +
This parser function is an abbreviation to call <code><nowiki>{{#forminput}}</nowiki></code> with smart defaults.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-forminput:group}}</nowiki></code>
 +
|{{#semorg-forminput:group}}
 +
|}
 +
 +
The following system messages control the appearance of the list:
 +
 +
{| class="table table-bordered table-condensed"
 +
! 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 <code><nowiki>{{#semorg-forminput:<feature>}}</nowiki></code>
 +
|-
 +
|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:
 +
 +
{| class="table table-bordered table-condensed"
 +
! 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 <code><nowiki>{{#forminput}}</nowiki></code> function
 +
|}
 +
 +
NB: The <code>no autofocus</code> parameter is set by default.
  
 
=== #semorg-meetings ===
 
=== #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
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-meetings:group
 +
  |group=Testgroup
 +
}}</nowiki></code>
 +
|{{#semorg-meetings:group|group=Testgroup}}
 +
|}
 +
 +
The following system messages control the appearance:
 +
 +
{| class="table table-bordered table-condensed"
 +
! 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:
 +
 +
{| class="table table-bordered table-condensed"
 +
! 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.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-properties:group}}</nowiki></code>
 +
|{{#semorg-properties:group}}
 +
|}
 +
 +
=== #semorg-values ===
 +
 +
Render all values for a specific property.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-values:person-name}}</nowiki></code>
 +
|
 +
{{#semorg-values:person-name}}
 +
 +
<small>this is the result of the following code: <pre><nowiki>
 +
{{#ask:[[semorg-person-name::+]]
 +
  |mainlabel=-
 +
  |headers=hide
 +
  |limit=1000
 +
  |searchlabel=
 +
  |?semorg-person-name#
 +
}}</nowiki></pre></small>
 +
|}
 +
 +
=== #semorg-tabs ===
 +
 +
Creates togglable tabs.
 +
 +
The following system messages control the appearance of the header:
 +
 +
{| class="table table-bordered table-condensed"
 +
! Message !! Function
 +
|-
 +
|semorg-tab-<feature>-<tab-id>
 +
|The link text for the tab.
 +
|}
 +
 +
The following parameters are available:
 +
 +
{| class="table table-bordered table-condensed"
 +
! Parameter !! Description
 +
|-
 +
|?<tab-id>=<tab-content>
 +
|ID and content for a tab.
 +
|}
 +
 +
=== #semorg-tabs-card ===
 +
 +
=== #semorg-user ===
 +
 +
Show the current user.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-user:}}</nowiki></code>
 +
|
 +
{{#semorg-user:}}
 +
|}
 +
 +
=== #semorg-true ===
 +
 +
Test whether the first argument is on of SMW's true words.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-true:yes|true|false}}</nowiki></code><br>
 +
<code><nowiki>{{#semorg-true:nope|true|false}}</nowiki></code>
 +
|
 +
{{#semorg-true:yes|true|false}}<br>
 +
{{#semorg-true:nope|true|false}}
 +
|}
 +
 +
=== #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:
 +
 +
{| class="table table-bordered table-condensed"
 +
! 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:
 +
 +
{| class="table table-bordered table-condensed"
 +
! Parameter !! Description
 +
|-
 +
|heading
 +
|Heading to be displayed instead of the standard heading. Will also call <code><nowiki>{{DISPLAYTITLE:}}</nowiki></code>.
 +
|-
 +
|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 <code>days</code>, <code>hours</code> (the default), <code>minutes</code>, or <code>seconds</code>.
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-datediff:{{#time:c}}|{{#time:c|+1 day}}}}</nowiki></code>
 +
|{{#semorg-datediff:{{#time:c}}|{{#time:c|+1 day}}}}
 +
|}
 +
 +
=== #semorg-datediff-human ===
 +
 +
Return the difference of a given past datetime to the current time as readable for humans (“x ago“).
 +
 +
{| class="table table-bordered table-condensed"
 +
! Markup !! Result
 +
|-
 +
|<code><nowiki>{{#semorg-datediff-human:{{#time:c|+100 days}}}}</nowiki></code>
 +
|{{#semorg-datediff-human:{{#time:c|-100 days}}}}
 +
|}
 +
 +
== Visualization ==
 +
 +
=== #semorg-network ===
 +
 +
''tbd''
 +
 +
=== #semorg-cooperation ===
 +
 +
''tbd''
 +
 +
=== #semorg-circles ===
 +
 +
''tbd''

Latest revision as of 13:59, 13 October 2020

#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-user-create

Render a link to create a new user account if it doesn't exist already

Markup Result
{{#semorg-user-create:Dummy User}}
<div class="semorg-toggle-test">Text to be toggled</div>

#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
GroupDateLocationModeratorSecretaryParticipants
Testgroup
testing
22/07/18
Admin Admin
Testgroup
20/07/21
Testgroup
This is just a test meeting.
19/10/30
14:00
Someplace Admin Jane Jane, Admin

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}} name, description, permanent, active, host, co-host

#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:172.25.0.1

#semorg-true

Test whether the first argument is on of SMW's true words.

Markup Result
{{#semorg-true:yes|true|false}}

{{#semorg-true:nope|true|false}}

true
false

#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

Visualization

#semorg-network

tbd

#semorg-cooperation

tbd

#semorg-circles

tbd