Magic words & parser functions link
Line 7: | Line 7: | ||
|+ | |+ | ||
!function name | !function name | ||
+ | !return value | ||
!example | !example | ||
!result | !result | ||
|- | |- | ||
|ci_userAffiliatedTo | |ci_userAffiliatedTo | ||
+ | |logged in user affiliation | ||
|<nowiki>{{#ci_userAffiliatedTo:}}</nowiki> | |<nowiki>{{#ci_userAffiliatedTo:}}</nowiki> | ||
|{{#ci_userAffiliatedTo:}} | |{{#ci_userAffiliatedTo:}} | ||
|- | |- | ||
|ci_userRealName | |ci_userRealName | ||
+ | |logged in user real name | ||
|<nowiki>{{#ci_userRealName:}}</nowiki> | |<nowiki>{{#ci_userRealName:}}</nowiki> | ||
|{{#ci_userRealName:}} | |{{#ci_userRealName:}} | ||
|- | |- | ||
|ci_isSysop | |ci_isSysop | ||
+ | |whether the logged in user is an administrator or not | ||
|<nowiki>{{#ci_isSysop:}}</nowiki> | |<nowiki>{{#ci_isSysop:}}</nowiki> | ||
|{{#ci_isSysop:}} | |{{#ci_isSysop:}} | ||
|- | |- | ||
|ci_loggedIn | |ci_loggedIn | ||
+ | |whether the user is logged in or not | ||
|<nowiki>{{#ci_loggedIn:}}</nowiki> | |<nowiki>{{#ci_loggedIn:}}</nowiki> | ||
|{{#ci_loggedIn:}} | |{{#ci_loggedIn:}} | ||
|- | |- | ||
|ci_visitorIsoCode | |ci_visitorIsoCode | ||
+ | |country code of user (based on the ip) | ||
|<nowiki>{{#ci_visitorIsoCode:}}</nowiki> | |<nowiki>{{#ci_visitorIsoCode:}}</nowiki> | ||
|{{#ci_visitorIsoCode:}} | |{{#ci_visitorIsoCode:}} | ||
|- | |- | ||
|ci_visitorCountry | |ci_visitorCountry | ||
+ | |country of user (based on the ip) | ||
|<nowiki>{{#ci_visitorCountry:}}</nowiki> | |<nowiki>{{#ci_visitorCountry:}}</nowiki> | ||
|{{#ci_visitorCountry:}} | |{{#ci_visitorCountry:}} | ||
|- | |- | ||
|ci_editors_realnames | |ci_editors_realnames | ||
+ | |real names and affiliation of page editors | ||
|<nowiki>{{#ci_editors_realnames:}}</nowiki> | |<nowiki>{{#ci_editors_realnames:}}</nowiki> | ||
|{{#ci_editors_realnames:}} | |{{#ci_editors_realnames:}} |
Revision as of 21:28, 28 June 2020
Currently this platform offers the additional parser functions. They are prefixed with the prefix "ci_" to distinguish them easily from the standard mediawiki magic words and parser functions.
function name | return value | example | result |
---|---|---|---|
ci_userAffiliatedTo | logged in user affiliation | {{#ci_userAffiliatedTo:}} | |
ci_userRealName | logged in user real name | {{#ci_userRealName:}} | |
ci_isSysop | whether the logged in user is an administrator or not | {{#ci_isSysop:}} | |
ci_loggedIn | whether the user is logged in or not | {{#ci_loggedIn:}} | |
ci_visitorIsoCode | country code of user (based on the ip) | {{#ci_visitorIsoCode:}} | US |
ci_visitorCountry | country of user (based on the ip) | {{#ci_visitorCountry:}} | United States |
ci_editors_realnames | real names and affiliation of page editors | {{#ci_editors_realnames:}} |
Examples:
{{#ci_HidePathFromPageList: path/1/2/a#path/1/2/b#path/1/2/c|#|ul}}
It will create the following rendered list
(that is the path of the pages a, b and c will be removed from the list, thus preserving the link paths).
Of course the same function can be used in combination with a semantic query ("ask" function, form semantic mediawiki extension), as follows:
{{#ci_HidePathFromPageList: {{#ask: |[[~Centro italiano Barcellona*]] [[Category:Language_courses]] |format=array |sep=## }}|##|ul}}
The ask query will return a list of pages (with paths) separated by '##' and the parser function 'ci_HidePathFromPageList' will take that list, will split it using '##' as delimiter (2nd argument) and will return a 'ul' (unordered list), for instance as follows:
{{#ci_pageTitlesAttribution: {{#ask: [[Category:Reading suggestions]] |format=array |?Page creator |?Page author |sep=## }}|##|ul}}