Template talk:Get QID
Appearance
(Redirected from Template talk:Get QID/sandbox)
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)
- To clarify, the substitution problem only occurs in case 4:
{{Get QID|Wikipedia}}
→ Q52{{subst:Get QID|Wikipedia}}
→ Q52{{Get QID|WikiPedia}}
→ Q52{{subst:Get QID|WikiPedia}}
→{{Get QID|Maryport New Lighthouse}}
→ Q29571349{{subst:Get QID|Maryport New Lighthouse}}
→ Q29571349{{Get QID|qid=Q52}}
→ Q52{{subst:Get QID|qid=Q52}}
→ Q52
- I'll think about it. Tomastvivlaren (talk) 22:03, 17 March 2022 (UTC)
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)
After this edit of the template it works:
{{Get QID|Wikipedia}}
→ Q52{{subst:Get QID|Wikipedia}}
→Q52{{Get QID|WikiPedia}}
→ Q52{{subst:Get QID|WikiPedia}}
→ Q52{{Get QID|Maryport New Lighthouse}}
→ Q29571349{{subst:Get QID|Maryport New Lighthouse}}
→ Q29571349{{Get QID|qid=Q52}}
→ Q52{{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)
- 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)