Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a258e6920a7fa140

Jump to content

Template talk:Get QID

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 4 years ago by Qwerfjkl in topic Redirect doesn't work when substituted

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