Page MenuHomePhabricator

solve_disamiguation doesn't care about 'r' command
Open, MediumPublic

Description

As stated in the doc it is possible to choose to replace only the link (just type the number) or replace both link and link-text (type 'r' followed by the number) but the 'r' command does not work as expected.
See this difflink where [[7 World Trade Center (alt)|7 World Trade Center]] was changed to [[World Trade Center 7|7 World Trade Center]] but the 'r' command was specified and [[World Trade Center 7]] was expected.

Event Timeline

Xqt triaged this task as Medium priority.Feb 20 2019, 8:11 AM

The 'r' does not work if the visual content differs from the link i.e. the link is labeled. One idea to solve it is replacing

# we want to throw away the original link text
replaceit = link_text == page_title

with

# we want to throw away the original link text
bracketless_link = pywikibot.Page(self.current_page.site,
                                  link_text)
replaceit = bracketless_link.title(
    without_brackets=True) == page_title

to remove the bracket extenson of the title.

Another way would be a force option to take the new link for the visual content.

Change 491714 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [IMPR] Add [f]orce option to force link as visual content

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

It seems like another solution for T124016, but good work at a first glance

Change 491714 had a related patch set uploaded (by Xqt; owner: Xqt):
[pywikibot/core@master] [IMPR] Add [f]orce option to force link as visual content

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

Pppery subscribed.
This comment was removed by Pppery.