Magic words & parser functions

From Redazione
Jump to navigation Jump to search
Line 37: Line 37:
  
 
<code>
 
<code>
 +
<nowiki>
 
{{#ci_HidePathFromPageList: {{#ask:
 
{{#ci_HidePathFromPageList: {{#ask:
 
[[Category:Language_course_students]]
 
[[Category:Language_course_students]]
Line 42: Line 43:
 
|sep=##
 
|sep=##
 
}}|##|ul}}
 
}}|##|ul}}
 +
</nowiki>
 
</code>
 
</code>
  
Line 51: Line 53:
  
 
<code>
 
<code>
 
+
<nowiki>
 
{{#ci_pageTitlesAttribution: {{#ask:
 
{{#ci_pageTitlesAttribution: {{#ask:
 
[[Category:Reading suggestions]]
 
[[Category:Reading suggestions]]
Line 59: Line 61:
 
|sep=##
 
|sep=##
 
}}|##|ul}}
 
}}|##|ul}}
 
+
</nowiki>
 
 
 
</code>
 
</code>

Revision as of 13:25, 21 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.


  • ci_userAffiliatedTo (parameters: none)
  • ci_userRealName (parameters: none)
  • ci_isSysop (parameters: none)
  • ci_loggedIn (parameters: none)
  • ci_HidePathFromPageList (parameters: list, divisor, kind of output)
  • ci_visitorIsoCode (parameters: none)
  • ci_visitorCountry (parameters: none)
  • ci_editors_realnames (parameters: none)
  • ci_pageTitlesAttribution (parameters: list, divisor, kind of output)


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: [[Category:Language_course_students]] |format=array |sep=## }}|##|ul}}

The ask query will return a list of pages (with paths) divided by '##' and the parser function 'ci_HidePathFromPageList' will take that list, will split it using '##' as separator (2nd argument) and will return a 'ul' (unordered list).


{{#ci_pageTitlesAttribution: {{#ask: [[Category:Reading suggestions]] |format=array |?Page creator |?Page author |sep=## }}|##|ul}}