Module talk:Is infobox in lead
Making the module accessible from another module
edit@Galobtter: could you change the main function so it can be accessed from another module without the need of a frame? Seeing as how the frame is only used to get the argument, it doesn't seem to be an issue. --Gonnym (talk) 10:59, 2 February 2019 (UTC)
- Done Galobtter (pingó mió) 11:04, 2 February 2019 (UTC)
- Thanks! --Gonnym (talk) 11:24, 2 February 2019 (UTC)
Exclude {{infobox mapframe}} from other infoboxes in lead check
editGalobtter I've made a change to the module sandbox to exclude infobox mapframe from the other-infoboxes in-lead-check. This is done because it's not actually an infobox and quite common causing quite a lot of false positives. This was promted by a report on my talkpage. I think it should work and have done some testing in my sandbox, but would like a second pair of eyes on it since it's my first module edit. --Trialpears (talk) 22:06, 2 October 2019 (UTC)
- I have now also removed embeded templates from the check since they are part of the main infobox. --Trialpears (talk) 22:38, 2 October 2019 (UTC)
- Trialpears, seems sensible. Bit busy but should be able to take a look at this by the end of the week. Also good work on getting short descriptions for school articles! Galobtter (pingó mió) 01:38, 3 October 2019 (UTC)
- Trialpears, Done Galobtter (pingó mió) 04:38, 7 October 2019 (UTC)
When multiple infoboxes are present, the one in the lead does not appear to generate a short description
editTogether Again (Buck Owens song) contains multiple instances of {{Infobox song}}. All three of them are in the lead, but none of them appear to generate a short description. It seems like one or all of them should do so.
Grande amore has an infobox in the lead, but it does not generate a short description. I can't explain this one, but it might help with debugging.
We Had It All (song) has one infobox in the lead and one in another section, but neither appears to generate a short description. It seems like the first one should do so. – Jonesey95 (talk) 19:47, 5 March 2024 (UTC)
- @Jonesey95: See the first line of this module's documentation, which notes that there must not be multiple infoboxes in the lead or multiple of the same infobox anywhere.
And Grande amore actually does have a second infobox; it's nested inside the first one.SilverLocust 💬 05:47, 6 March 2024 (UTC)- Actually, nested infoboxes (with
embed = yes
orchild = yes
) don't count for a second infobox in the lead. The issue with Grande amore is not something noted in the documentation. The module is matching "Infobox song contest entry" (the nested infobox) as being a second instance of infobox song. SilverLocust 💬 07:01, 6 March 2024 (UTC)- Thanks for the pointer. Ideally, the module should differentiate between an infobox in the lead and one in other sections, even if they are the same infobox. Is there a functional reason why it ignores pages with multiple infoboxes of the same type? – Jonesey95 (talk) 13:35, 6 March 2024 (UTC)
- I think it's possible to do that with significant changes to the module. The only information the module currently uses about the template where it was called is what template name it is told to check (as a Lua gsub string similar to regex). For example, {{Infobox song}} only passes
{{#invoke:Is infobox in lead|main|[Ii]nfobox [Ss]ong}}
. The module would need to check more than that to make the distinction you want. - I suppose the module could be changed to use
frame:getParent().args
to get the infobox's parameters/arguments and check those against the ones in the first infobox — though I'm not sure how you would take into account arguments that had transclusions like| date = 1{{nbsp}}January 2000
, since I believe the transclusion will have already been expanded when the module gets the args from the parent. - Alternatively, to only check specific parameters like artist, it could have an option to do something like
{{#invoke:Is infobox in lead|main|[Ii]nfobox [Ss]ong|artist|[[Buck Owens]]}}
and then instead check for the Lua gsub%|%s-artist%s-=%s*%[%[Buck%sOwens%]%]
(meaning, in plain language,|[space?]artist[space?]=[spaces?][[Buck[space]Owens]]
), provided the argument contains no transclusions (or if transclusions are taken into account in some way, as noted above). SilverLocust 💬 04:03, 7 March 2024 (UTC)- As for the reason why you would want to prevent a later infobox of the same name from creating a short description, it's in case the first one doesn't have enough information in the infobox to create a short description (for infobox song, that's mainly date and artist) but a later one does have enough info, but it is not info relevant to the entire article, such as with an infobox for a cover song (which would have a different artist/year). SilverLocust 💬 04:19, 7 March 2024 (UTC)
- I don't really understand any of that explanation with regard to multiple instances of the same infobox in an article. My naive thinking is that if there are two instances of {{Infobox song}} in an article and only one is in the lead, the one in the lead would be checked by this module, which would result in "yes, this infobox is in the lead" and so a short description would be generated. The second infobox, not in the lead, would be checked by this module, which would result in "no, this infobox is not in the lead" and so that second infobox would be ignored. Based on the actual behavior of the module, it appears that my naive thinking is wrong. – Jonesey95 (talk) 15:35, 7 March 2024 (UTC)
- As for the reason why you would want to prevent a later infobox of the same name from creating a short description, it's in case the first one doesn't have enough information in the infobox to create a short description (for infobox song, that's mainly date and artist) but a later one does have enough info, but it is not info relevant to the entire article, such as with an infobox for a cover song (which would have a different artist/year). SilverLocust 💬 04:19, 7 March 2024 (UTC)
- I think it's possible to do that with significant changes to the module. The only information the module currently uses about the template where it was called is what template name it is told to check (as a Lua gsub string similar to regex). For example, {{Infobox song}} only passes
- Thanks for the pointer. Ideally, the module should differentiate between an infobox in the lead and one in other sections, even if they are the same infobox. Is there a functional reason why it ignores pages with multiple infoboxes of the same type? – Jonesey95 (talk) 13:35, 6 March 2024 (UTC)
- Actually, nested infoboxes (with
- I'm not sure it's a great idea to have info-boxes auto generating anything. It's the sort of Easter egg behaviour we generally try to avoid, for example with categories being autogenerated by info boxes. All the best: Rich Farmbrough 17:00, 28 March 2024 (UTC).