Topic on Help talk:Extension:ParserFunctions

Cannot subst string functions?

4
Summary by RZuo

StringFunctions is not enabled on Commons.

RZuo (talkcontribs)

{{Countries of Asia|prefix={{subst:#sub:{{subst:FULLPAGENAME}}|0|{{subst:#pos:{{subst:FULLPAGENAME}}| in }}}}}}

for example, i used this string in c:special:diff/702219712. why the substitution of string functions are not done?

Verdy p (talkcontribs)

You're just trying to use an uninstalled extension: "#sub:" and "#pos:" are part of the "string functions" extensions, which is not available on Commons (and not even needed in the page you tried to edit to use them). Commons uses basic parser functions, and some other extensions, but not this one.

Before using "subst:", first check that your edit works without it; add "subst:" only after tests.

RZuo (talkcontribs)

obviously i'm just using that page to test, not intending to use the string on that page. cant even understand that?

Verdy p (talkcontribs)

Just try in a local sandbox or in a preview: {{#sub:ABC|1}} on Commons, and you'll see that it is not recognized (and left unexpanded, so you cannot use "subst:" on such invokation if the extension is not installed and supported on the wiki).

The "string functions" (i.e. "#sub:", "#pos:", "#len:") are not par of the core parser functions (you are talking here on a page about the core ParserFunctions, which does not include these functions). Commons however allows you to use another extension, Scribunto, which supports string functions in a more advanced module.

The situation may be different depending on wikis (e.g. "string functions" are working in Translatewiki.net, which on the opposite does not support the "Scribunto" extension to call Lua modules; "String functions" are documented in another subject page but not this one).

First identify the extension defining the function, and then check if it is deployed on the target wiki (there's a summary matric in MediaWiki about deployment of extensions, but you can also look at the "Special:Version" page on the target wiki).