Last modified: 2014-11-17 09:21:31 UTC
Hi! I would like to have available (mainly for wiktionaries) function {{#reverse:SOME_TEXT}} which returns given text in reversed order of characters: Examples: {{#reverse:SOME_TEXT}} -> TXET_EMOS {{#reverse:bugfix}} -> xifgub {{#reverse:black dog}} -> god kcalb Purpose: I want to have indexes (categories) sorted according to characters placed at the end of page name (or at the end of any given text). I want to write [[Category:English words|{{PAGENAME}}]] for normal category as usually and [[Category:English words (a tergo)|{{#reverse:{{PAGENAME}}}}]]. Rationale: Classic dictionaries have extra bonus called "index a tergo". That's index where terms are places according to the end of term. Words like "comeback", "hatchback", "playback" are next to each other. In such index North America, South America and Central America and all cities of the world named America are together. This is handy for ethymologists when they look for words with same postfix but also for users who do not remember begining of the term. ABX
Would it be really useful? I would rather think of writing something like [[Special:SuffixIndex]], working like [[Special:PrefixIndex]].
[[Special:PrefixIndex]] AFAIK doesn't allow browsing categories and browsing categories (ie. only one language) according to postfix is what makes value of such index for single language specialists. There is already field for postfix in [[Special:AllPages]] hovewer this also doesn't allow selection of single category.
(In reply to comment #1) > Would it be really useful? I would rather think of writing something like > [[Special:SuffixIndex]], working like [[Special:PrefixIndex]]. > That couldn't be done for performance reasons.
Created attachment 5998 [details] Parser function to implement string reversal
Comment on attachment 5998 [details] Parser function to implement string reversal stupid eclipse... wtf is with the character encoding nonsense and .buildpath
Created attachment 5999 [details] Cleaner patch to implement string reversal parser function This one will probably still contain character encoding nonsense but is missing the stupid eclipse .buildpath file
Created attachment 6000 [details] Clean patch Another thing to note is that strrev clobbers multibyte characters. Hopefully this fixes both issues.
It should be noted that due to the potential for abuse, we're at least wary of (possibly flat-out opposed to) new parser functions with the intention of providing string manipulation abilities in wikitext. I should warn you that it is possible (even likely) that this patch will sit waiting for review for another few years, until we figure out which direction we are going with respect to string manipulation in wikitext.
It's very easy to implementation. <bdo dir="rtl">SOME_TEXT</bdo> view: TXET_EMOS. Unfortunately, now tag <bdo> is blocked.
Between adding a suffix index (which may or may not ever be feasible, but is certainly covered by other bugs), adding <bdo> (which might be covered under the expand allowed HTML list bug), I can't see a huge use case here. Partially because of the reasons I mentioned, and partially because of comment #8, I'm going ahead and being bold with a WONTFIX.