Module talk:InfoboxImage: Difference between revisions
| Line 115: | Line 115: | ||
:: It was just done that way so that the hover over tooltip showed some information. If there are no objections in the next week then I'll remove it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:29, 27 October 2021 (UTC) | :: It was just done that way so that the hover over tooltip showed some information. If there are no objections in the next week then I'll remove it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:29, 27 October 2021 (UTC) | ||
::: I've updated it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:26, 5 November 2021 (UTC) | ::: I've updated it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 18:26, 5 November 2021 (UTC) | ||
:::: I made this corresponding doc update https://en.wikipedia.org/w/index.php?title=Module:InfoboxImage/doc&type=revision&diff=1065533441&oldid=1048551125&diffmode=source Note that lines 259-262 now seem redundant <syntaxhighlight lang="lua"> | |||
-- if alt value is a keyword then do not use as a description | |||
if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then | |||
alt = nil; | |||
end | |||
</syntaxhighlight> [[User:Arlolra|Arlolra]] ([[User talk:Arlolra|talk]]) 01:58, 14 January 2022 (UTC) | |||
Revision as of 01:58, 14 January 2022
Template:Talk header User:MiszaBot/config Template:Archives
Category:Pages using deprecated image syntax nominated for deletion
Please see this CfD discussion about Template:Cl. – Jonesey95 (talk) 01:38, 7 October 2020 (UTC)
Broken title parameter in frameless mode if it includes CSS
If the title parameter includes CSS (e.g., via the {{legend}} template), then it displays the plain-text CSS rules into the map tooltip and the image description in the image popup (i.e., the Lightbox-style image mode that pops up after clicking on the image). This is strange considering invoking the image using the [[File:]] syntax directly (in the default mode) doesn't seem to have this issue, but using it in the frameless mode does:
[[File:Individual Taxation Systems.svg|left|thumb|300px|Systems of taxation on personal income {{legend|#00FF00|No income tax on individuals}} {{legend|#0080FF|Territorial}} {{legend|#000080|Residence-based}} {{legend|#FF00FF|Citizenship-based}}]]:
[[File:Individual Taxation Systems.svg|left|frameless|thumb|300px|Systems of taxation on personal income {{legend|#00FF00|No income tax on individuals}} {{legend|#0080FF|Territorial}} {{legend|#000080|Residence-based}} {{legend|#FF00FF|Citizenship-based}}]]:
{{#invoke:InfoboxImage|InfoboxImage|image=Individual Taxation Systems.svg|size=300px|upright=1.15|alt=Text|title=Systems of taxation on personal income {{legend|#00FF00|No income tax on individuals}} {{legend|#0080FF|Territorial}} {{legend|#000080|Residence-based}} {{legend|#FF00FF|Citizenship-based}}}}:
―Getsnoopy (talk) 20:23, 26 December 2020 (UTC)
- Template:Ping
framelessdoes not have a caption. See Wikipedia:Extended image syntax#Alt text and caption. The parameter is used for the link title instead. A link title is displayed as plain text. Module:InfoboxImage could examinetitleand omit using it as link title if it doesn't look like plain text. A tracking category could be added instead. PrimeHunter (talk) 11:41, 13 March 2021 (UTC)
Template-protected edit request on 8 June 2021
Template:Edit template-protected I would like to have Judge Rose's photo on her Wikipedia profile page updated. I'm passing this request along from Judge Rose herself. I have an updated photo from her that I can send to you but wanted to confirm that I'm in the right place to request this change. 8thcirc (talk) 19:04, 8 June 2021 (UTC)
- Template:To File:Red information icon with gradient background.svg Not done: this is the talk page for discussing improvements to the page Module:InfoboxImage. If possible, please make your request at the talk page for the article concerned. If you cannot edit the article's talk page, you can instead make your request at Wikipedia:Requests for page protection#Current requests for edits to a protected page. P.I. Ellsworth ed. put'r there 22:55, 8 June 2021 (UTC)
none options for link and alt
We should probably add none options for link and alt. It would be useful in places such as {{archives}} but likely other non-infobox templates using this as well since this is the most versetile image handling template. --Trialpears (talk) 15:14, 11 August 2021 (UTC)
Module breaks when there are multiple images on Wikidata
In a recent edit the Module broke because there were three different images set on Wikidata, and the Module tried interpreting them as one, which doesn't work. Is there a way to recognize this and use them all separately? -- Asartea Talk | Contribs 15:49, 29 August 2021 (UTC)
Module update
I've done some work in the sandbox. The original intent was to add an error category for when URL links are used for images, as currently it just returns an empty string. While working on the code I've also cleaned up the code, including:
- Consistent spaces
- Consistent usage of quotation marks
- Using table.param instead of table["param"]
- Reordering the placeholder_image table alphabatically
- Removing ";" from the end of lines as Lua does not use that.
I've replaced the following block of code at Module:InfoboxImage#L-144: <syntaxhighlight lang="lua">
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then
return "";
end
if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then
return "";
end
</syntaxhighlight>
with Module:InfoboxImage/sandbox#L-137:
<syntaxhighlight lang="lua"> if string.find(image, "^%[*http") then -- Error category. return "" end </syntaxhighlight>
I've added URL testcases to Module:InfoboxImage/testcases. The new tests and all previous tests pass Module talk:InfoboxImage/testcases.
Please let me know if you have comments or questions. Gonnym (talk) 09:04, 2 October 2021 (UTC)
- There are quite a few images at commons whose names begin with the letters "http". Will this code drop them into the error category? Perhaps "^%[*https?:" would be safer, if that's the correct regex syntax for string.find -- John of Reading (talk) 09:21, 2 October 2021 (UTC)
Why is "alt" the fallback for "title"?
In this condition <syntaxhighlight lang="lua" line start="269"> if title ~= "" and title ~= nil then
result = result .. "|" .. title;
elseif alt ~= "" and alt ~= nil then
result = result .. "|" .. alt;
end
</syntaxhighlight>
|alt= is used as the fallback for an image title when |title= is not present. This appears arbitrary to me and it diverges from the usual behavior of |alt= in [[File:]] constructs. As a result, articles that use InfoboxImage and alt (but not title) for each image suddenly have a title on the infobox image, but none on all others. Is there a reason that this is the case? Can this behavior be corrected (by removing lines 271 and 272)? IceWelder [✉] 07:38, 26 October 2021 (UTC)
- Not sure whether anyone is even watching this talk page. Template:Ping You're the most active editor on the module. Would you mind sharing your insight? IceWelder [✉] 17:22, 27 October 2021 (UTC)
- It was just done that way so that the hover over tooltip showed some information. If there are no objections in the next week then I'll remove it. -- WOSlinker (talk) 18:29, 27 October 2021 (UTC)
- I've updated it. -- WOSlinker (talk) 18:26, 5 November 2021 (UTC)
- I made this corresponding doc update https://en.wikipedia.org/w/index.php?title=Module:InfoboxImage/doc&type=revision&diff=1065533441&oldid=1048551125&diffmode=source Note that lines 259-262 now seem redundant <syntaxhighlight lang="lua">
- I've updated it. -- WOSlinker (talk) 18:26, 5 November 2021 (UTC)
- It was just done that way so that the hover over tooltip showed some information. If there are no objections in the next week then I'll remove it. -- WOSlinker (talk) 18:29, 27 October 2021 (UTC)
-- if alt value is a keyword then do not use as a description
if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then
alt = nil;
end
</syntaxhighlight> Arlolra (talk) 01:58, 14 January 2022 (UTC)