Module talk:InfoboxImage: Difference between revisions
→Make the module working with all Wikipedias: he change seems reasonable. |
|||
| Line 92: | Line 92: | ||
I don't understand the sentence "Wouldn't it be the simplest to just replace all of the words with <code><nowiki>{{ns:6}}</nowiki></code>?" because I can't even see this process in the original code. The process of the sandbox version is exactly the same as that of the original code. For the original code, the process is to cut the "file:" or "image:", and then add <nowiki>[[file:</nowiki>. For the sandbox version, the process is to cut whatever prefix, including "file:" and "image:", and then add "<nowiki>[[file:</nowiki>". --[[User:Nullzero|Nullzero]] ([[User talk:Nullzero|talk]]) 01:34, 13 January 2014 (UTC) | I don't understand the sentence "Wouldn't it be the simplest to just replace all of the words with <code><nowiki>{{ns:6}}</nowiki></code>?" because I can't even see this process in the original code. The process of the sandbox version is exactly the same as that of the original code. For the original code, the process is to cut the "file:" or "image:", and then add <nowiki>[[file:</nowiki>. For the sandbox version, the process is to cut whatever prefix, including "file:" and "image:", and then add "<nowiki>[[file:</nowiki>". --[[User:Nullzero|Nullzero]] ([[User talk:Nullzero|talk]]) 01:34, 13 January 2014 (UTC) | ||
:The change seems reasonable. I can't do it myself at this exact moment, but if no-one else does it soon, I'll be back later to do it. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 07:20, 14 January 2014 (UTC) | |||
Revision as of 07:20, 14 January 2014
Error handling
I've listed some common infobox errors at User:John of Reading/Image errors. Anyone interested in this LUA module might like to take a look. -- John of Reading (talk) 10:02, 26 March 2013 (UTC)
- I've done some work on this. Have done the following:
- images beginning with http: (either linked or unlinked) are now suppressed.
- gallery tags now pass through without further processing
- thumbnail images now are added to Category:Pages using infoboxes with thumbnail images (for article namespace only)
- Any other suggestions would be welcome. There is also the task to roll it out to more infoboxes since I only did it to most of those that were using the {{Hide if placeholder image}} template. -- WOSlinker (talk) 21:55, 26 March 2013 (UTC)
- This looks good! I've updated the descriptions at User:John of Reading/Image errors. -- John of Reading (talk) 22:15, 26 March 2013 (UTC)
Suggestion: maximum size
I have a suggestion: some infoboxes (e.g., Infobox mountain) have a maximum size parameter for their image. Can someone add this feature to this module? I could try to figure out Lua syntax, but it may be faster for someone who knows what they are doing. —hike395 (talk) 12:05, 29 March 2013 (UTC)
- Yes, will have a look. Was already thinking about adding it. -- WOSlinker (talk) 13:12, 29 March 2013 (UTC)
Improve description
The description say "Inputs: image - Can either be a bare filename or a fully formatted image link" but the examples show three versions that work: fully formatted, "File:xxxxx.xxx" and "xxxx.xxx" Is there a simple way to expand the description to include the third case? Rmhermen (talk) 17:27, 29 March 2013 (UTC)
- I've updated it a bit. There also the doc page at Module:InfoboxImage/doc which could do with some further expansion. Contributions are very welcome. -- WOSlinker (talk) 18:20, 29 March 2013 (UTC)
http/https
The tests for image names beginning "http:" should also catch "https:", shouldn't they? -- John of Reading (talk) 16:50, 4 April 2013 (UTC)
Code optimization
image = mw.ustring.sub(image,6,mw.ustring.len(image)); can be shorten to image = mw.ustring.sub(image,6);. The third argument for ustring.sub can be omitted. mw:Extension:Scribunto/Lua reference manual#string.sub -- ChongDae (talk) 03:12, 8 April 2013 (UTC)
Documentation for module
Why doint we create a seprate documentation for module for example templates use template:documentation why doint we create module:documentation so that it support stuff for module which the template doesent instead of liking to start for documentation and then linking box for end box 86.139.246.76 (talk) 15:13, 20 April 2013 (UTC)
Error in the code
Hello. I just saw, that in the example
| {{#invoke:InfoboxImage|InfoboxImage|image=Abbey Rd Studios.jpg|sizedefault=250px|alt=The front stairs and door of Abbey Road Studios}} | The front stairs and door of Abbey Road Studios |
the text from the alt-attribute doesn't appear in Firefox 21 like a tooltip. Why? I think, that the code has to be changed. The resulting Wiki code now is:
[[File:Abbey Rd Studios.jpg|250px|alt=The front stairs and door of Abbey Road Studios]]
But it has to be a little bit other:
[[File:Abbey Rd Studios.jpg|250px|The front stairs and door of Abbey Road Studios]]
I think, that you mixed the alt parameter of the module with the Wiki image coding. I created a working version on the page eo:Modulo:InfoboxImage. I also added a new parameter center there. It works very fine on the page eo:Vikipedio:Lua/Moduloj/InfoboxImage/en. But the linked version is a little bit localized for the language Esperanto. The code lines with dosiero: has not to be copied. Greetings --Tlustulimu (talk) 11:12, 22 June 2013 (UTC)
- I just created a sandbox version of this module. It works now:
| {{#invoke:InfoboxImage/sandbox|InfoboxImage|image=Abbey Rd Studios.jpg|sizedefault=250px|alt=The front stairs and door of Abbey Road Studios}} | Script error: No such module "InfoboxImage/sandbox". |
| {{#invoke:InfoboxImage/sandbox|InfoboxImage|image=Abbey Rd Studios.jpg|sizedefault=250px|alt=The front stairs and door of Abbey Road Studios|center=yes}} | Script error: No such module "InfoboxImage/sandbox". |
- The second example uses the new parameter center now. I works very fine. Greetings --Tlustulimu (talk) 11:32, 22 June 2013 (UTC)
Hi, Wikipedia has both alt and title params for images. I've listed the options below. I'll add the center param and for the alt, what I'll do is add a title param and do the code so that if the title param is blank, the alt value will be used instead. -- WOSlinker (talk) 11:45, 22 June 2013 (UTC)
| [[File:Abbey Rd Studios.jpg|250px|alt=alt|title]] | alt |
|---|---|
| [[File:Abbey Rd Studios.jpg|250px|alt=alt]] | alt |
| [[File:Abbey Rd Studios.jpg|250px|title]] | title |
The parameter center doesn't work. Why? --Tlustulimu (talk) 11:59, 22 June 2013 (UTC)
Make the module working with all Wikipedias
Template:Edit template-protected This original module handles the prefixes of namespace 6 by hardcoding ("file:" and "image:"). However, there might be more alias names of namespace 6 in some Wikipedias. The sandbox version fetches alias names via the library directly; hence, it solves this problem. --Nullzero (talk) 04:18, 12 January 2014 (UTC)
- Template:ETp Wouldn't it be the simplest to just replace all of the words with
{{ns:6}}? Note that since this module is only used on enwp (if you import move it to another wiki, feel free to change the code as needed there), so I'm not sure what you want changed here. Can you be more specific please? Technical 13 (talk) 05:05, 12 January 2014 (UTC)
- Feel free to reactivate when you answer the question. Happy editing! Technical 13 (talk) 08:12, 12 January 2014 (UTC)
@Template:User link Sorry that I didn't make it clear. So, yes, the original code is perfect enough for enwp and for now. I just saw that there are hard codings in this module, which annoy me because I believe that if it is possible, there should be no hardcoding. If this module is changed in the way that it retrieves information from the library directly, there will be two advantages. First, suppose in the future enwp adds more alias names of ns6, you don't have to fix the module, as the module fetches the new config automatically. Second, it's easy for another wikis to import this module. thwp, for example, has these names as the alias names of ns6: "file", "image", "ไฟล์", "ภาพ". If I want to import this module, for original code, I have to add this additional code:
if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "ไฟล์:" then
image = mw.ustring.sub(image,6);
end
if mw.ustring.lower(mw.ustring.sub(image,1,4)) == "ภาพ:" then
image = mw.ustring.sub(image,5);
end
However, the sandbox version works well without having to add anything!
I don't understand the sentence "Wouldn't it be the simplest to just replace all of the words with {{ns:6}}?" because I can't even see this process in the original code. The process of the sandbox version is exactly the same as that of the original code. For the original code, the process is to cut the "file:" or "image:", and then add [[file:. For the sandbox version, the process is to cut whatever prefix, including "file:" and "image:", and then add "[[file:". --Nullzero (talk) 01:34, 13 January 2014 (UTC)