Commons:Bots/Requests/Revibot (4)
< Commons:Bots | Requests
Operator: -revi (talk · contributions · Statistics · Recent activity · block log · User rights log · uploads · Global account information)
Bot's tasks for which permission is being sought: Fix Category:Pages using ISBN magic links.
Automatic or manually assisted: Automatic, unsupervised
Edit type (e.g. Continuous, daily, one time run): one time run, then probably once in a month
Maximum edit rate (e.g. edits per minute): 6 epm
Bot flag requested: (Y/N): N
Programming language(s): mw:Manual:Pywikibot/replace.py
- This task will fix
ISBN 9788937473135
(ISBN 9788937473135
) to{{ISBN|9788937473XXX}}
(ISBN 9788937473135
). Former ISBN XXXX format is being deprecated, see mw:Requests for comment/Future of magic links.
- Regex for replace.py will be
-regex "ISBN\s+((97(8|9))?\s?-?([0-9]\s?-?){9}([0-9Xx]))([\D$])" "{{ISBN|\1}}\6"
I didn't run a test, yet. — regards, Revi 11:55, 18 May 2018 (UTC)
Discussion
- Some suggestions to the regex:
- You may want to built in a capitalization of the "x", for example, by using two regex (incl. some other changes):
-regex "[iI][sS][bB][nN]\s*((97(8|9))?\s?-?\s?([0-9]\s?-?\s?){9}([0-9X]))([\s\D])" "{{ISBN|\1}}\6"
-regex "[iI][sS][bB][nN]\s*((97(8|9))?\s?-?\s?([0-9]\s?-?\s?){9})x([\s\D])" "{{ISBN|\1X}}\5"
- Currently, your regex will keep spaces and dashs. Do we want to remove them? --Schlurcher (talk) 23:22, 21 May 2018 (UTC)
- I don't want to make any user-visible changes. This is supposed to replace the function that will die soon to the working template, so nothing should change after the bot run (when someone sees the page). Dash or space or without it - which one to unify - that's not a decision to be made here, IMO. — regards, Revi 11:43, 22 May 2018 (UTC)
- Also AFAIK ISBN magic links only works when
ISBN
is in uppercase.isbn 9788937473135
don't work. (PS:ISBN9788937473135
also don't work.) — regards, Revi 11:49, 22 May 2018 (UTC) - Please refer mw:Markup spec/BNF/Magic links for how MediaWiki finds ISBN to enbale Magic links. We do not have to care space and dash used at the same time for one separation("123 - 456", "123- 456" etc.), leading "ISBN" in lower case, and "ISBN" followed by number without space. Because they are not handled as ISBN Magic link by software, the pages which use them are not categorised in Category:Pages using ISBN magic links — which means that we can't tell where they are easily. If we want to change number fotmat, I think it is more then technical issue, and would need community consensus to do it.
P.S. If you want to handle both upper and lower cases, just simple-nocase
flag would be helpful. --IRTC1015 12:24, 22 May 2018 (UTC)
- If anyone is curious, that regex code is a slightly altered version of one I used in kowiki to do the same job there. --IRTC1015 12:46, 22 May 2018 (UTC)
- @-revi: It's better to use
([\D$])
instead of([\s\D])
, as former one doesn't work when ISBN is at the end of line.\s
is useless because\D
matches with space characters too :D --IRTC1015 06:01, 25 May 2018 (UTC)- Thanks. — regards, Revi 19:47, 26 May 2018 (UTC)
- If no bureaucrat cares, I'll run 5 to 10 test run by Monday 15:00 UTC, just to ensure the stuff won't break. — regards, Revi 19:47, 26 May 2018 (UTC)
- To be honest, I don't fully understand this request, but as you know what you're doing, please continue. I think this can be approved if the test cycle is successful. --Krd 05:35, 27 May 2018 (UTC)
- 1, 2, 3, 4, 5. No errors. — regards, Revi 22:41, 27 May 2018 (UTC)
- Looks good. I would still prefer a search that also coveres ISBN numbers that are not recognized by the magic links. I understand this is apparently not in scope of this request. --Schlurcher (talk) 16:18, 29 May 2018 (UTC)
- I agree - that's a good idea, but I think that'd be Commons:Bots/Requests/Revibot (5) task (or your task if you prefer to do it), because this task is purely for fixing deprecated methods. Another 5 test run: 6, 7, 8, 9, 10. — regards, Revi 16:56, 29 May 2018 (UTC)
- Should be fairly easy to add this to my General fixes routine. In any case, we should wait until this task is done so there is no unnecessary overlap. --Schlurcher (talk) 20:11, 29 May 2018 (UTC)
- I agree - that's a good idea, but I think that'd be Commons:Bots/Requests/Revibot (5) task (or your task if you prefer to do it), because this task is purely for fixing deprecated methods. Another 5 test run: 6, 7, 8, 9, 10. — regards, Revi 16:56, 29 May 2018 (UTC)
- Looks good. I would still prefer a search that also coveres ISBN numbers that are not recognized by the magic links. I understand this is apparently not in scope of this request. --Schlurcher (talk) 16:18, 29 May 2018 (UTC)
- And I think Krd deserves an explanation what this task is: MediaWiki developers plan to remove the feature which makes
ISBN 9788937473135
(result isISBN 9788937473135
) automatically linked to Special:BookSources. They couldn't do it as planned because Wikipedia, Commons, other big wikis did not removed such links. However at some point they would do it regardless, so we should replace the stuff sooner rather than later. This task will do just this, and nothing else. — regards, Revi 17:01, 29 May 2018 (UTC)
- 1, 2, 3, 4, 5. No errors. — regards, Revi 22:41, 27 May 2018 (UTC)
- To be honest, I don't fully understand this request, but as you know what you're doing, please continue. I think this can be approved if the test cycle is successful. --Krd 05:35, 27 May 2018 (UTC)
There are no objections and the task appears reasonable. Approved. --Krd 04:51, 30 May 2018 (UTC)