Magic words & parser functions

From Redazione
Jump to navigation Jump to search
Line 4: Line 4:
  
  
* ci_userAffiliatedTo (parameters: none)
+
{| class="wikitable"
* ci_userRealName (parameters: none)
+
|+
* ci_isSysop (parameters: none)
+
!function name
* ci_loggedIn (parameters: none)
+
!example
* ci_HidePathFromPageList (parameters: list, delimiter, kind of output (ul or comma separated values))
+
!result
* ci_visitorIsoCode (parameters: none)
+
|-
* ci_visitorCountry (parameters: none)
+
|ci_userAffiliatedTo
* ci_editors_realnames (parameters: none)
+
|{#ci_userAffiliatedTo}
* ci_pageTitlesAttribution (parameters: list, delimiter, kind of output (ul or comma separated values))
+
|Istituto cultura italiana (NGO)
 +
|-
 +
|ci_userRealName
 +
|{#ci_userRealName}
 +
|Redazione
 +
|-
 +
|ci_isSysop
 +
|{#ci_isSysop}
 +
|0
 +
|-
 +
|ci_loggedIn
 +
|{#ci_loggedIn}
 +
|1
 +
|-
 +
|ci_HidePathFromPageList
 +
|{{#ci_HidePathFromPageList: path/1/2/a#path/1/2/b#path/1/2/c|#|ul}}
 +
|{{#ci_HidePathFromPageList: path/1/2/a#path/1/2/b#path/1/2/c|#|ul}}
 +
|-
 +
|ci_visitorIsoCode
 +
|
 +
|
 +
|-
 +
|ci_visitorCountry
 +
|
 +
|
 +
|-
 +
|ci_editors_realnames
 +
|
 +
|
 +
|-
 +
|ci_pageTitlesAttribution
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|
 +
|}
 +
 
 +
*ci_userAffiliatedTo (parameters: none)
 +
*ci_userRealName (parameters: none)
 +
*ci_isSysop (parameters: none)
 +
*ci_loggedIn (parameters: none)
 +
*ci_HidePathFromPageList (parameters: list, delimiter, kind of output (ul or comma separated values))
 +
*ci_visitorIsoCode (parameters: none)
 +
*ci_visitorCountry (parameters: none)
 +
*ci_editors_realnames (parameters: none)
 +
*ci_pageTitlesAttribution (parameters: list, delimiter, kind of output (ul or comma separated values))
  
  
Line 25: Line 72:
 
It will create the following rendered list
 
It will create the following rendered list
  
* [[path/1/2/a|a]]
+
*[[path/1/2/a|a]]
* [[path/1/2/b|b]]
+
*[[path/1/2/b|b]]
* [[path/1/2/b|c]]
+
*[[path/1/2/b|c]]
  
 
(that is the path of the pages a, b and c will be removed from the list, thus
 
(that is the path of the pages a, b and c will be removed from the list, thus
Line 51: Line 98:
 
instance as follows:
 
instance as follows:
  
* [[Centro italiano Barcellona/Courses/Hablamos italiano a.a. 2018-2019|Hablamos italiano a.a. 2018-2019]]
+
*[[Centro italiano Barcellona/Courses/Hablamos italiano a.a. 2018-2019|Hablamos italiano a.a. 2018-2019]]
* [[Centro italiano Barcellona/Courses/Hablamos italiano a.a. 2019-2020|Hablamos italiano a.a. 2019-2020]]
+
*[[Centro italiano Barcellona/Courses/Hablamos italiano a.a. 2019-2020|Hablamos italiano a.a. 2019-2020]]
* [[Centro italiano Barcellona/Courses/Hablamos italiano a.a. 2020-2021|Hablamos italiano a.a. 2020-2021]]
+
*[[Centro italiano Barcellona/Courses/Hablamos italiano a.a. 2020-2021|Hablamos italiano a.a. 2020-2021]]
  
  

Revision as of 21:09, 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 example result
ci_userAffiliatedTo {#ci_userAffiliatedTo} Istituto cultura italiana (NGO)
ci_userRealName {#ci_userRealName} Redazione
ci_isSysop {#ci_isSysop} 0
ci_loggedIn {#ci_loggedIn} 1
ci_HidePathFromPageList
ci_visitorIsoCode
ci_visitorCountry
ci_editors_realnames
ci_pageTitlesAttribution
  • ci_userAffiliatedTo (parameters: none)
  • ci_userRealName (parameters: none)
  • ci_isSysop (parameters: none)
  • ci_loggedIn (parameters: none)
  • ci_HidePathFromPageList (parameters: list, delimiter, kind of output (ul or comma separated values))
  • ci_visitorIsoCode (parameters: none)
  • ci_visitorCountry (parameters: none)
  • ci_editors_realnames (parameters: none)
  • ci_pageTitlesAttribution (parameters: 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}}