Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Tales from Chyria
Search
Editing
Module talk:InfoboxImage
(section)
From Tales from Chyria
Namespaces
Module
Discussion
More
More
Page actions
Read
Edit source
New topic
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 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 "[[Category:Pages using infoboxes with url links]]" 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. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 09:04, 2 October 2021 (UTC) :There are [//commons.wikimedia.org/wiki/Special:AllPages?from=http&to=&namespace=6 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 -- [[User:John of Reading|John of Reading]] ([[User talk:John of Reading|talk]]) 09:21, 2 October 2021 (UTC) ::I've added a test for an image from commons that starts with HTTP and it worked. That said I've also now updated the sandbox with your suggested code to make it more correct. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 09:35, 2 October 2021 (UTC)
Summary:
Please note that all contributions to Tales from Chyria may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Chyria Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs