Page MenuHomePhabricator

Link should recognise {{ns:Project}} in text
Open, MediumPublic

Description

{{ns:Project}} is a common, simple and effective way to refer to a namespace name using wikitext. It is parsable, and there can be no doubt which namespace the page is expected to be in.

Event Timeline

jayvdb raised the priority of this task from to Medium.
jayvdb updated the task description. (Show Details)
jayvdb updated the task description. (Show Details)
jayvdb set Security to None.

Hmm does something like this work:

{{ns:Project}}{{ns:Project}}Bar

In that case it could be a little more complicated and do we only want to support “ns”?

{{ns:Project}}{{ns:Project}}Bar does work, and we could support that, but the far more common case is {{ns:Project}}:Bar

IMO it would be sufficient, and helpful, to only recognise it at the beginning of the title, and followed by ':'. If it is at the beginning of a page title, the most reasonable assumption is that it is the namespace. I think this is a risk-free way of introducing a new and non-fuzzy way of passing a page namespace from command line to the inside of a Link.

The same should also be said for a leading ':', but it isnt true

>>> pywikibot.Link(':Wiktionary:Foo', pywikibot.Site('en', 'wiktionary') )
pywikibot.page.Link(u'Foo', Site("en", "wiktionary"))

Change 395154 had a related patch set uploaded (by Dvorapa; owner: Dvorapa):
[pywikibot/core@master] [WIP][bugfix] Don't handle category prefixes as iw shortcuts

https://gerrit.wikimedia.org/r/395154

Dvorapa moved this task from Backlog to Doing on the good first task board.
Dvorapa added a subscriber: Dvorapa.

Not actively working on it