{{temp|str right}}
If {{str right}}
were restored, would it be able to check the last letter of a preceding string? In particular, what I would like to do is make a declension-table template for Lower Sorbian, in which t and d sometimes turns into ś and ź respectively, except that st and zd turn into sć and zdź. So given a template input like {{dsb-decl-n-18|blabla|t}} it would generate blablaśe, but given {{dsb-decl-n-18|blablas|t}} it would see the "s" at the end of the first parameter and generate blablasće rather than *blablasśe. Is that doable?
It's theoretically doable, but there are complications. Main amongst these is the {{str len}}
function being a crawling horror.
And yet... It looks like some actual string parsing functions may now be enabled as inherent functions (which is to say, Special:Version mentions having https://www.mediawiki.org/wiki/Extension:ParserFunctions enabled, which appears to have https://www.mediawiki.org/wiki/Extension:StringFunctions mostly folded into it, which actually features useful tools.
I'll have to experiment with seeing if it actually works, and if it does, quite a lot of things will suddenly become easier, and more will become practically possible.
Give me some time to have a hack around and see what works...
I take it back. The string extensions are not enabled on Wiktionary.
From a quick look what it requires for them to be enabled is
- Add to the bottom of LocalSettings.php:
- require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
- If you want to use the integrated string function functionality, add just after that line
- $wgPFEnableStringFunctions = true;
which is something the Site admins have to do.
Once that's done, taking the final character of a string is a native expression (not a template function), and as simple as {{#pos:string|-1}}, which currently is invalid, but if/when the string extensions are enabled, will return "g". (And {{#pos:string|-2}} returns "ng", etc.
With String Extensions enabled, a lot of things which are currently difficult, impossible, or so expensive as to be dangerous, become trivial.
Why in hell do we not have this enabled???? I thought the devs were opposed to it or something, but it seems like it'd be ridiculous to keep going on without string manipulation and hoping that Scribunto will be deployed (will that even happen this year?).
Well, for now, I've made {{dsb-decl-noun-2}}
such that the user simply has to specify whether the stem ends in d/t or zd/st. Ain't nobody got time for that!