Page MenuHomePhabricator

Allow more parameters to {{GRAMMAR}}
Open, Needs TriagePublic

Description

At the moment, {{GRAMMAR}} can be said to take two parameters: the name of the rule, and the word to transform.

The problem with this is that sometimes the string that comes in as a parameter is not exactly the same string that should be transformed. An example of this is when the string that comes in is a link, which is always in the form [[title]], and the square brackets get in the way of analyzing the first and the last characters of the title. Something like {{GRAMMAR:rule|$1|[[$1|{{GRAMMARRESULT}}]]}} could be more appropriate in such cases.

This is just a report to float the existence of the problem; as you can see, I haven't thought the whole syntax through yet ;)

Event Timeline

Amire80 raised the priority of this task from to Needs Triage.
Amire80 updated the task description. (Show Details)
Amire80 subscribed.

A related comment from T48106, copying here because it points at the same problem:

By the way, currently GRAMMAR is used for changing the case of the given word only. By means of changing the behaviour of CoreParserFunctions::grammar() and overridden Language::convertGrammar() we can make the first argument a "mode" and then the usual arguments following.

For example, {{GRAMMAR:decline|genitive|dog}} would do what it does now called {{GRAMMAR:genitive|dog}}. Then we can go further by creating a new mode: {{GRAMMAR:list|one|two|three|threepointonefour|etc}}, and it will do what it says: it makes a list. I think it's more appropriate to have list feature there (although this is syntax, not grammar :)).

Basically it's possible to do anything by editing the language specific grammar function.