Magic words & parser functions link
Line 68: | Line 68: | ||
|} | |} | ||
<br /> | <br /> | ||
+ | |||
+ | '''Examples:''' | ||
<pre class="language-wiki"> | <pre class="language-wiki"> | ||
Line 107: | Line 109: | ||
+ | <pre class="language-wiki"> | ||
+ | {{#ci_pageTitlesAttribution: {{#ask: | ||
+ | [[Category:Reading suggestions]] | ||
+ | |format=array | ||
+ | |?Page creator | ||
+ | |?Page author | ||
+ | |sep=## | ||
+ | }}|##|ul}} | ||
+ | </pre> | ||
+ | will create the following list: | ||
− | |||
− | |||
{{#ci_pageTitlesAttribution: {{#ask: | {{#ci_pageTitlesAttribution: {{#ask: | ||
[[Category:Reading suggestions]] | [[Category:Reading suggestions]] | ||
Line 119: | Line 129: | ||
}}|##|ul}} | }}|##|ul}} | ||
</pre> | </pre> | ||
+ | |||
+ | |||
</noinclude> | </noinclude> |
Revision as of 21:54, 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 |
More
function | return value | parameter |
---|---|---|
ci_HidePathFromPageList | wikicode with links, in the form [[complete path|page name]] | list, delimiter, kind of output (ul or comma separated values) |
ci_editors_realnames | comma separated real names | list |
ci_pageTitlesAttribution | wikicode with links, in the form [[complete path|page name]] followed by a string in the form "created by [editor real name] affiliated to [editor affiliation] | list, delimiter, kind of output (ul or comma separated values) |
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}}
will create the following list:
- Alì Ehsani - Stanotte guardiamo le stelle - created by , affiliated to [organization]
- Giacomo Scotti, Mario Licciardi - Non si trova cioccolata - created by , affiliated to [organization]
- Raymond Queneau - Fiori Blu - created by , affiliated to [organization]
- Viviano Domenici - A cena con i cannibali. Taccuino di un giornalista esploratore - created by , affiliated to [organization]
- Yambo (Enrico de’ Conti Novelli da Bertinoro) - L'allevatore di dinosauri ovvero L'uovo di pterodattilo - created by , affiliated to [organization]