For the moment only rendering by the :plain() method is supported by mw.message.lua, it would be really nice to have a :text() method.
I bumped into this do to lack of {{PLURAL:…}}, and thus has to reimplement similar functionality.
For the moment only rendering by the :plain() method is supported by mw.message.lua, it would be really nice to have a :text() method.
I bumped into this do to lack of {{PLURAL:…}}, and thus has to reimplement similar functionality.
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| mw.message: Add :text() and :escaped() | mediawiki/extensions/Scribunto | master | +54 -13 |
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| Open | Feature | None | T50176 Requested Scribunto/Lua built-in methods/functions (tracking) | ||
| Open | Feature | None | T231299 Scribunto: Support :text() in mw.message |
Change #1075578 had a related patch set uploaded (by BlankEclair; author: BlankEclair):
[mediawiki/extensions/Scribunto@master] mw.message: Add :text() and :escaped()
You don’t actually need to reimplement similar functionality: {{PLURAL:…}} is just a normal parser function, so if you run the result of :plain() through frame:preprocess(), it’ll be parsed. You need a frame object for that, which makes it a bit complicated, so I’m not against its direct support in Scribunto, but it’s a probably much simpler workaround for the time being.
Originally there was message:text() but it was removed in T62758. @Jackmcbarn wrote "Message formats other than plain should have never been exposed in this way, as they allow link tables, etc. to be bypassed and serve no useful purpose. This removes them, and also removes title, as it serves no purpose without them."
Change #1075578 abandoned by BlankEclair:
[mediawiki/extensions/Scribunto@master] mw.message: Add :text() and :escaped()
Reason:
Honestly, given the issues raised versus my personal wants, I am not too motivated to solve this issue anymore :p
This seems to be possible, per Tim Starling's comment on the patch:
I think :text() could be implemented, but it would have to preprocess using the same Parser instance, not use Message::text() or an equivalent. If I understand correctly, that would address the reasons for its original removal.
...but I'm not gonna be the person doing it