Template talk:Portal

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Image function of Module:Portal[edit]

The image function of the module is supposed to give the filename, but a piped "border" is getting in the way. For example, I would like to use the module to generate a link to the image of Portal:Terrorism (which is File:National Park Service 9-11 Statue of Liberty and WTC fire.jpg), but when I type

[[:File:{{#invoke:Portal|image|Terrorism}}]]

I get the following: border. That's because National Park Service 9-11 Statue of Liberty and WTC fire.jpg|border has the |border at the end of it, which should probably be trimmed. — Martin (MSGJ · talk) 12:27, 19 May 2015 (UTC)

@MSGJ: The /image/* subpages currently use code like
return {
	["a-league"] = "Soccer ball.svg",
	["abu dhabi"] = "Flag of Abu Dhabi.svg|border",
	...
}
so the data for each portal consists of a single string containing both the image name and optional border. To exclude the "|border" part in the image function, the image name and border must be separated in the image lists. In my Lua sandbox I've added some test functions that use a subtable for each portal:
return {
	["a-league"] = {"Soccer ball.svg"},
	["abu dhabi"] = {"Flag of Abu Dhabi.svg",border=1},
	...
}
If this is used, the filename without "|border" can be retrieved using images[portal][1], and a flag variable for the border using images[portal]["border"]. The test version of the front-end function for the image name returns [[:File:{{#invoke:Sandbox/SiBr4|portalimage|Abu Dhabi}}]]File:Flag of Abu Dhabi.svg. If this change is a good idea, I can do some tests in the main Module:Portal/sandbox tomorrow. SiBr4 (talk) 22:15, 29 May 2015 (UTC)
The main sandbox version now supports both versions (test), so the image subpages can be updated without hurry if this gets implemented. I've added a border parameter to exclude the "|border" to the image function: {{#invoke:Portal/sandbox|image|Abu Dhabi|border=0}} → Flag of Abu Dhabi.svg. It is included by default for now to keep the border in templates using the function to actually show the image. (I'd like to ask someone better with Lua than I am to review my changes beforehand if they're moved live.) SiBr4 (talk) 21:41, 1 June 2015 (UTC)
@SiBr4: This is a good idea, and actually I would take it further, as I outlined last year. I think that as well as decoupling image names from borders, we need a way to find out which image is used by which portals, and a way to find out whether images belong to a portal or to a WikiProject (via {{WikiProject box}}), or both. Perhaps something like this:
return require('Module:Portal/image').processImageData{
	["aleague"] = {
		portal = "Portal:A-League",
		image = "Soccer ball.svg"
	},
	["abudhabi"] = {
		portal = "Portal:Abu Dhabi",
		wikiproject = "Wikipedia:WikiProject Abu Dhabi",
		image = "Flag of Abu Dhabi.svg",
		border = true
	},
	...
}
The processImageData function would convert project codes to lower case and remove whitespace and punctuation, then sort the data into three separate tables for indexing by code, page, and project type. This data would then be loaded by mw.loadData so it could be cached per-page. This structure would mean that WikiProjects would be stuck with the same image as portals, though. That's probably what they want in most cases, but I'm not sure that holds for all cases. It would also mean that WikiProjects would be stuck with the same aliases as portals, which may also not be ideal. Thoughts? — Mr. Stradivarius ♪ talk ♪ 07:41, 27 June 2015 (UTC)
If I'm understanding it correctly, this processImageData will have to loop over the data on the subpages and create the three new tables one row at a time? If so, that would allow for the table keys in the data pages to correspond to the actual portal names (i.e. with normal capitalization/punctuation), since the processing function could change them to lowercased/stripped versions for the new tables.
Separate images for corresponding portals and projects should be easy by using separate table fields, e.g.
return require('Module:Portal/image').processImageData{
	["aleague"] = {
		portal = "Portal:A-League",
		image = "Soccer ball.svg" --used for both portal and project
	},
	["abudhabi"] = {
		portal = "Portal:Abu Dhabi",
		wikiproject = "Wikipedia:WikiProject Abu Dhabi",
		portalimage = "Flag of Abu Dhabi.svg", --used for portal
		wpimage = "Some other image.svg", --used for project
		border = true
	},
	...
}
and having them overwrite the generic image using data.portalimage or data.image in the implementing module. I know as little as you regarding whether or not it is needed, however. SiBr4 (talk) 20:01, 29 June 2015 (UTC)
@SiBr4: processImageData would loop over the data in a single subpage and create the three new tables one row at a time, yes. This sounds inefficient, but actually shouldn't be too bad, as internally Lua would only be creating pointers to the existing data tables rather than creating entirely new tables. About the portalimage and wpimage fields - thinking about it, it's probably not necessary. People seem to have managed just fine up to now, and I don't remember seeing any requests for it on this talk page. How about this as the data structure:
return require('Module:Portal/image').processImageData{
	["aleague"] = {
		links = {
			portal = "Portal:A-League",
		},
		image = "Soccer ball.svg",
	},
	["abudhabi"] = {
		links = {
			portal = "Portal:Abu Dhabi",
			wikiproject = "Wikipedia:WikiProject Abu Dhabi",
		},
		image = "Flag of Abu Dhabi.svg",
		border = true,
	},
	...
}
Putting the links in a separate links subtable should make it easy to add new page types if the need arises. If new link types are just added to the links table, you can use pairs(data.tags.abudhabi.links) and be sure that you are iterating over links, and not image names or other image properties that we might decide to add in the future. Also, seeing as this idea means that images no longer have to be associated with portals, how about using a new module name? I'm thinking Module:Image tags or Module:Image aliases. — Mr. Stradivarius ♪ talk ♪ 03:25, 30 June 2015 (UTC)
Was I right in thinking that the new function would allow the field names to be just "A-League" and "Abu Dhabi" on the data page, and to have the function convert the names to lowercase and remove whitespace for the new tables? That would make it possible to construct the portal and project links by prepending "Portal:" or "Wikipedia:WikiProject " to the field name, so the portal/wikiproject fields would only have to be used explicitly if the default link was incorrect. This way the nonexistence of a portal or project would need to be specified in a different way than just omitting the field, so it may not actually be better.
The current portal image data is spread over 27 subpages so changing an image would only put a fraction of all transclusions in the job queue (as explained in the leading comment at Module:Portal). Wouldn't server load be a problem if the new data woud be on a single page?
I agree with creating the modules at new titles, since the linking of images with WikiProjects means the image data are no longer specific to portals. Best may be to start working on a draft version of the new function, to have a more concrete proposal to discuss. SiBr4 (talk) 20:36, 2 July 2015 (UTC)

[edit]

The logo for the portal is the same as for the numismatics portal. I'm not sure what symbol should be put in place, perhaps something indicating profit would be adequate.Lbertolotti (talk) 17:01, 22 May 2015 (UTC)

@Lbertolotti: Would this do? Though the dollar sign is hard to see at this size. -- John of Reading (talk) 20:32, 2 June 2015 (UTC)

@John of Reading Let's give it a try, surely it is better than what we have now.Lbertolotti (talk) 00:42, 3 June 2015 (UTC)

@Lbertolotti: OK, that's done. -- John of Reading (talk) 05:52, 3 June 2015 (UTC)

Template-protected edit request on 29 May 2015[edit]

Please remove ["pensacola"] = "Flag of Pensacola.svg",

The flag depicted does not in fact exist. It was created out of the imagination of a Commons editor and his original jpg version has been deleted. The City of Pensacola does not have a city flag -- it flies the national flags of the five nations that have governed it over the years in places where most cities would fly a single city flag. . . Jim - Jameslwoodward (talk to mecontribs) 09:47, 29 May 2015 (UTC) . . Jim - Jameslwoodward (talk to mecontribs) 09:47, 29 May 2015 (UTC)

Yes check.svg Done Alakzi (talk) 11:47, 29 May 2015 (UTC)

Template-protected edit request on 19 June 2015[edit]

change A.P. charminar image to another as it doesnot belongs to A.P. ["andhra pradesh"] = "Archbridgegodavari.JPG", Starpchack (talk) 10:35, 19 June 2015 (UTC)

Yes check.svg Done Alakzi (talk) 11:40, 20 June 2015 (UTC)

Template-protected edit request on 26 June 2015[edit]

Hi. I wanted to add File:Flag of Hesse.svg for the Hesse portal, and (as all German states have a default image of their flags) change the image for Hamburg to: File:Flag of Hamburg.svg. Thank you. Oh - and Flag of Hesse would need a border, as it's half white. --AltSylt (talk) 22:48, 26 June 2015 (UTC)

yellow tickY Partly done I've added the Hesse flag but not changed the Hamburg image. There doesn't seem to be any consistency between flags and coats of arms. -- John of Reading (talk) 06:52, 27 June 2015 (UTC)

Image edit request on 28 June 2015 (1)[edit]

I would like to ask if it is possible to make Portal:Color and the redirect Portal:Colour display SubtractiveColorMixingII.png in portal bars? Thanks for your help. 83.228.174.148 (talk) 15:43, 28 June 2015 (UTC).

Image edit request on 28 June 2015 (2)[edit]

I would like to ask if it is possible to make Portal:LGBT display Gay flag.svg in portal bars? Thanks for your help. 83.228.174.148 (talk) 15:53, 28 June 2015 (UTC).

Portal:Analytical chemistry[edit]

Hi, the image File:Glass-microreactor-chip-micronit.jpg for Portal:Analytical chemistry was deleted from commons 09:04, 4 July 2015 "Copyright violation, found elsewhere on the web and unlikely to be own work".

Not sure what could replace it, no obvious images on the portal page apart from maybe Light dispersion conceptual.gif, otherwise maybe use the same as the general chemistry portal File:Nuvola apps edu science.svgKylieTastic (talk) 10:29, 4 July 2015 (UTC)

I've replaced it with the Nuvola image, since I don't know whether or not an animation is suitable as portal image. SiBr4 (talk) 10:35, 4 July 2015 (UTC)

Template-protected edit request on 22 July 2015[edit]

Add an image to the Portal of Telangana. Preferably this one.

   File:Warangal_fort.jpg 

Trmwikifa (talk) 14:03, 22 July 2015 (UTC)

Yes check.svg Done -- John of Reading (talk) 15:08, 22 July 2015 (UTC)

Image edit request on 1 August 2015[edit]

Hello, I would like to request an logo update on the Module:Portal/images/x page of File:Xbox logo 2012 cropped.svg to be updated to File:Xbox one logo.svg. As listed on Microsoft press kit The color for all the Xbox logos has been changed from lime green to dark green. Ariesk47 (talk) 04:41, 1 August 2015 (UTC)

Yes check.svg Done -- John of Reading (talk) 05:27, 1 August 2015 (UTC)