Page MenuHomePhabricator

Implement "{{#redirect:}}" parser function as alias for bare "#REDIRECT"
Open, MediumPublic

Description

Author: kebap_spam

Description:
I just keep forgetting the correct syntax for a redirect, namely this:

#REDIRECT [[link]]

Now I wanted to find out more about this class of commands with this syntax starting with a # - but there are none except this? I was told, it is like this because Redirect preceded parser functions. If it was implemented now, it would probably be as a parser function, but out of tradition, mediawiki uses the above syntax.

I would now propose to also include a consistent syntax like this:

{{REDIRECT:link}} or {{REDIRECT:[[link]]} if needed

The old syntax is probably well-known and certainly widely spread, so it should also continue to work. However, it might be marked as deprecated, and the user documentation should maybe promote the more consistent syntax over the traditional one.

Otherwise I hope at least I wont forget the traditional syntax anymore after all this hustle.


See Also:
T52878: VisualEditor: Remove the disablement of VisualEditor for redirect pages
https://bugzilla.wikimedia.org/show_bug.cgi?id=50878

Details

Reference
bz25470

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:15 PM
bzimport set Reference to bz25470.
bzimport added a subscriber: Unknown Object (MLST).

You know that you can add it as a button in your toolbar, right?

(some wikis already have it there by default)

Any particualr reason this is needed? Consistency is good, but since we're not going to drop the back-compatible syntax, we'll be stuck with two alternative syntaxes forever. This is misleading.

(In reply to comment #2)

Any particualr reason this is needed? Consistency is good, but since we're not
going to drop the back-compatible syntax, we'll be stuck with two alternative
syntaxes forever. This is misleading.

I don't have any objection to the idea in principle. The idea that a "#" followed by a magic word at the beginning of a page will produce a magic result is pretty arcane and senseless. Changing the syntax to something like {{#redirect:}} has plenty of merit in my mind.

Broadly, I think it would make sense to take a holistic approach rather than an incremental approach here, however. That is, if there are going to be (somewhat major) changes to syntax, they should be planned so that they can be consistent and sensible. For example, changing all magic words to be able to start with "#" (the subject of another bug). And it would be wise to look at other parts of wiki-syntax that could use improvement.

On the whole, I'd say this bug is worthy of further consideration.

Likewise I think this has merit. Backwards compatibility is easy to achieve, and can be turned off by default for new wikis, or wikis which have finished migrating to the new syntax. The syntax then becomes more consistent, and thus easier to document and learn, and build external parsers and editing tools. There has been some large changes to the redirect functionality for 1.23 - maybe now is a good time to introduce this enhancement also.

https://gerrit.wikimedia.org/r/#/c/105829/

(Adding hash for all magic words would also be great)

There is also the fact that '#' is the syntax for lists, so the following becomes a list item instead of a redirect:
'<!-- Blah -->#REDIRECT [[Blah]]'

There are a lot of relevant comments on bug 14323. To summarise, some are concerned that the syntax for redirect targets will become dynamic. I'm not sure why that is inherently bad thing, but I recall that some magic words like {{CURRENTYEAR}} dont force updates to ripple through templates, and likely the same problem will exist in redirects if the redirect target could contain variables. If redirects were a parser function, it can specify what is valid inside that function, and exclude expressions which would be valid within [[ ]].

If a redirect can be wrapped in a template (e.g. via a parser function), then bug 50878 is fixed. New redirects could then be created by a VisualEditor transclusion of {{redirect to|<target>}} (deleted, but never worked afaik); existing redirects could be transformed to the new syntax before being presented to VisualEditor.

What would it take to run a bot through the database to change all redirect pages from one syntax to the other, surely not a whole lot. So, if the new formatting was added (and all the documentation properly updated to only show the new syntax) in one update, a bot runs through and converts all old usages to new, and in a subsequent update the old syntax is removed (people would catch on quick). Then there would be no need to support multiple inconsistent ways... Just a thought.

(In reply to Technical 13 from comment #5)

What would it take to run a bot through the database to change all redirect
pages from one syntax to the other ..
.. Then there would be no need to support multiple
inconsistent ways... Just a thought.

Old revisions would still need to be displayed correctly, which means the old syntax would need to be understood by the page rendering logic.

Krinkle renamed this task from add {{#redirect}} parser function to Implement "{{#redirect:}}" parser function as alias for bare "#REDIRECT".Jul 31 2017, 9:23 PM
Krinkle moved this task from General to General on the MediaWiki-Redirects board.
Krinkle edited projects, added MediaWiki-Parser; removed MediaWiki-Redirects.
Krinkle updated the task description. (Show Details)
Krinkle removed a subscriber: wikibugs-l-list.