Jump to content

Template talk:Get QID

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Template talk:Get QID/doc)

Redirect doesn't work when substituted

[edit]

I recently edited the template to allow substituting, but substituting doesn't seem to work on redirects e.g.
{{Get QID|Wikipedia}} → Q52
and
{{Get QID|WikiPedia}}
This doesn't seem to affect transclusion. Any idea why this happens?
@Tomastvivlaren ― Qwerfjkltalk 21:11, 13 March 2022 (UTC)[reply]

To clarify, the substitution problem only occurs in case 4:
  1. {{Get QID|Wikipedia}} → Q52
  2. {{subst:Get QID|Wikipedia}} → Q52
  3. {{Get QID|WikiPedia}} → Q52
  4. {{subst:Get QID|WikiPedia}}
  5. {{Get QID|Maryport New Lighthouse}} → Q29571349
  6. {{subst:Get QID|Maryport New Lighthouse}} → Q29571349
  7. {{Get QID|qid=Q52}} → Q52
  8. {{subst:Get QID|qid=Q52}} → Q52
I'll think about it. Tomastvivlaren (talk) 22:03, 17 March 2022 (UTC)[reply]
I guess the nice beta Module:Redirect causes the problem, allthoguh it can be substituted:
  • {{#invoke:Redirect|main|Universes}} → Universe
  • {{subst:#invoke:Redirect|main|Universes}} → Universe
I can not explain this issue. Tomastvivlaren (talk) 08:58, 18 March 2022 (UTC)[reply]

After this edit of the template it works:

  1. {{Get QID|Wikipedia}} → Q52
  2. {{subst:Get QID|Wikipedia}} →Q52
  3. {{Get QID|WikiPedia}} → Q52
  4. {{subst:Get QID|WikiPedia}} → Q52
  5. {{Get QID|Maryport New Lighthouse}} → Q29571349
  6. {{subst:Get QID|Maryport New Lighthouse}} → Q29571349
  7. {{Get QID|qid=Q52}} → Q52
  8. {{subst:Get QID|qid=Q52}} → Q52

[ I can not explain why. I used the {{if empty|a|b}} instead of {{#if|a|a|b}} to avoid calculating the "a" twice. When combined with safesubst, the substition all of a sudden works. @Qwerfjkl: Tomastvivlaren (talk) 22:53, 18 March 2022 (UTC)[reply]

It may be due to whitespace, then. Templates retain whitespace passed as a parameter, but parser functions don't. ― Qwerfjkltalk 07:05, 19 March 2022 (UTC)[reply]