Jump to content

Module talk:ResolveEntityId

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ahecht (talk | contribs) at 05:28, 26 February 2022 (Redirects: Reply). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Redirects

@Ahecht: a really useful module. Would it possible to follow redirects and give the ID of their target? — Martin (MSGJ · talk) 17:07, 22 June 2021 (UTC)[reply]

@MSGJ: It already follows Wikidata redirects. For example {{#invoke:ResolveEntityId|entityid|Q404}} returns Q404. Are you talking about following Wikipedia redirects as well? --Ahecht (TALK
PAGE
) 20:00, 24 June 2021 (UTC)[reply]
Yes that's what I meant, sorry if I was unclear. It would be great if
  • {{#invoke:ResolveEntityId|entityid|Isla de Útila}} ⇒ Q1572113
Currently:
  • {{#invoke:ResolveEntityId|entityid|Isla de Útila}} ⇒ Q1572113
— Martin (MSGJ · talk) 21:00, 24 June 2021 (UTC)[reply]
@Ahecht: this would still be extremely useful, if only as an opt-in. Thanks :) — Martin (MSGJ · talk) 20:54, 23 February 2022 (UTC)[reply]
@MSGJ I'll put it on my to-do list. --Ahecht (TALK
PAGE
) 05:03, 24 February 2022 (UTC)[reply]
@MSGJ Looks like I implemented it in the sandbox back in 2021 but never copied it to the main template. It's now  Done. --Ahecht (TALK
PAGE
) 22:39, 24 February 2022 (UTC)[reply]
Ahecht and MSGJ: Something, possibly this change, has resulted in script errors in as many as a few hundred articles. See Abatus koehleri and Category:Pages with script errors. – Jonesey95 (talk) 01:30, 25 February 2022 (UTC)[reply]
Reverted for now. Thanks for letting us know — Martin (MSGJ · talk) 08:28, 25 February 2022 (UTC)[reply]
If the reverted edit is restored, perhaps with changes, please consider my response at WT:Lua#Lua error with Taxonbar?. I don't know if the problem mentioned here had the same root cause as the problem I investigated. Johnuniq (talk) 08:38, 25 February 2022 (UTC)[reply]

Ahecht: while you are debugging this, can you just confirm that if the redirect does have a wikidata item then the module should return that ID. It should only follow the redirect if there is no wikidata item. I may be reading the code wrong, but it seems that line 25 of your sandbox may need changing. Thanks — Martin (MSGJ · talk) 08:48, 25 February 2022 (UTC)[reply]

@MSGJ, Jonesey95, and Johnuniq: I think I have it resolved now. There was an earlier change to the sandbox before I made my changes that caused an error if there wasn't a Wikipedia sitelink in the Wikidata item (which wasn't in my testcases). I have fixed that issue in my sandbox, and implemented it in {{taxonbar/sandbox}}. I also fixed the sandbox so that it only resolves redirects if a wikidata item doesn't exist. Please test out the new sandbox version, and I can copy it over to the main module. --Ahecht (TALK
PAGE
) 00:14, 26 February 2022 (UTC)[reply]
@Ahecht: Please review the history at Module:ResolveEntityId/sandbox and check the edits I have made. Re Module:ResolveEntityId/doc, you might consider rewriting the examples like the following.
local resolveId = require('Module:ResolveEntityId')._id
id = resolveId('Q42')
Johnuniq (talk) 03:58, 26 February 2022 (UTC)[reply]
@Johnuniq Looks good. I simplified the code a little further, and will run some more tests before taking it live. --Ahecht (TALK
PAGE
) 05:28, 26 February 2022 (UTC)[reply]