Jump to content

Module talk:GetShortDescription

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Olivaw-Daneel (talk | contribs) at 04:29, 24 January 2023 (subst: Reply). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

subst

Hi there, just noticed a bit of oddness when using subst:

  • {{#invoke:GetShortDescription|main |name=Brazil |only=explicit}} → table
  • {{#invoke:GetShortDescription|main |name=Brazil}} → table
  • {{subst:#invoke:GetShortDescription|main |name=Brazil |only=explicit}}
  • {{subst:#invoke:GetShortDescription|main |name=Brazil}} → country in South America

Olivaw-Daneel (talk) 10:19, 23 January 2023 (UTC)[reply]

Huh. Looks like the last one is getting the wikidata, which means the penultimate, requesting only the explicit, is not getting the wikidata as a fallback and is thus empty. Sorry this came up now; I'm genuinely on my last legs for the day. I will attack it after some sleep. The explicit request requires preprocessing to handle weirdly configured (gotta account for weird stuff or it falls apart when it meets it) short desc templates, because lua's pattern matching is no match for grown-up regex. My guess is that the preprocessing is being bullied during the substitution. Possibly a frame problem; frames are weird. I'll figure it out ASAP. Fred Gandt · talk · contribs 10:57, 23 January 2023 (UTC)[reply]
Yeah; almost certainly a frame issue; via template it's fine:
  • {{subst:User:Fred Gandt/sandbox/Get short description |name=Brazil |only=explicit }} → table

Fred Gandt · talk · contribs 11:06, 23 January 2023 (UTC)[reply]

oh I derp; of course it just dumped the invoke on the page and left; I really need to sleep Fred Gandt · talk · contribs 11:09, 23 January 2023 (UTC)[reply]
The substitution happens before the preprocessing, so the preprocessing never happens. This leaves the found short desc template in its raw state and the pattern matching for the content fails, so we get the empty string for explicit, and the wikidata fallback otherwise. I will have to manually process the short desc template. This isn't so bad. But to put into perspective why I am not doing it right now; I just past 25 hours awake and it really feels like it. See ya tomorrow 😜 Fred Gandt · talk · contribs 13:04, 23 January 2023 (UTC)[reply]
Thanks, no hurry! Olivaw-Daneel (talk) 17:07, 23 January 2023 (UTC)[reply]
Btw, there's really no rush wrt to the GAN usage; don't want to hurry your development time. For {{GAN}} I was thinking of starting with the code used in {{Annotated link}}, as I've already gotten that to work, and it seems good enough to start with. We can later switch to your module version when it's ready; perhaps in sync with when Template_talk:Annotated_link#Module concludes. How does that sound to you? Olivaw-Daneel (talk) 04:29, 24 January 2023 (UTC)[reply]