Jump to content
Wikimedia Meta-Wiki

Module:WikimediaCEETable: Difference between revisions

From Meta, a Wikimedia project coordination wiki
Content deleted Content added
Line 40: Line 40:
result1 = result1 .. Label
result1 = result1 .. Label
end
end
local sex = entity:formatPropertyValues( 'P21' )
if sex then
if sex == 'Q6581072' then
result1 = result1 .. ' [[File:Female Icon.svg|20px]]'
end
end
index = index + 1
index = index + 1
resultTable = resultTable .. result1 .. result2 .. '\n| style="background:#cfc;"|[[d:' .. Id .. '|' .. Id .. ']]\n'
resultTable = resultTable .. result1 .. result2 .. '\n| style="background:#cfc;"|[[d:' .. Id .. '|' .. Id .. ']]\n'

Revision as of 20:33, 5 March 2016

Module documentation
The above documentation is transcluded from Module:WikimediaCEETable/doc. (edit | history)
Editors can experiment in this module’s sandbox (edit | diff) and testcases (create) pages.
Please add categories to the /doc subpage. Subpages of this module.

 local langTable = { 'az','be','bs','bg','cs','de','el','et','hr','hu','hy','ka','kk','lt','lv','mk','pl','ro','ru','sh','sk','sl','sq','sr','tr','uk',}

 local p = {}

 function p.table(frame)
	resultTable = '{| class="wikitable" width=100%\n|-\n! No !! style="width:18%"|Article !! [[File:Azerbaijan-orb.png|15px]] az !! [[File:Belarus-orb.png|15px]] be !! [[File:Bosnia-and-Herzegovina-orb.png|15px]] bs !! [[File:Bulgaria-orb.png|15px]] bg !! [[File:Czech-Republic-orb.png|15px]] cs !! [[File:Germany-orb.png|15px]] de !! [[File:Greece-orb.png|15px]] el !! [[File:Estonia-orb.png|15px]] et !! [[File:Croatia-orb.png|15px]] hr !! [[File:Hungary-orb.png|15px]] hu !! [[File:Armenia-orb.png|15px]] hy !! [[File:Georgia-orb.png|15px]] ka !! [[File:Kazakhstan-orb.png|15px]] kk !! [[File:Lithuania-orb.png|15px]] lt !! [[File:Latvia-orb.png|15px]] lv !! [[File:Macedonia-orb.png|15px]] mk !! [[File:Poland-orb.png|15px]] pl !! [[File:Romania-orb.png|15px]] ro !! [[File:Russia-orb.png|15px]] ru !! sh !! [[File:Slovakia-orb.png|15px]] sk !![[File:slovenia-orb.png|15px]] sl !! [[File:Albania-orb.png|15px]] sq !! [[File:Serbia-and-Montenegro-orb.png|15px]] sr !! [[File:Turkey-orb.png|15px]] tr !! [[File:Ukraine-orb.png|15px]] uk !! wikidata\n|-'
	index = 1
	while frame.args[index] do
		Id = frame.args[index]
		local entity = mw.wikibase.getEntityObject(Id)
		if not entity or not entity.sitelinks then
			return ''
		end
		Label = entity:getLabel( 'en' )
		if not Label then
			Label = ''
		end
 		local ensitelink = entity:getSitelink( 'enwiki' )
		if ensitelink then
			if Label == '' then
				Label = ensitelink
			end
		end
 	result2 = ''
 	for langCount = 1, 26 do
	 		local sitelink = entity:getSitelink( langTable[langCount] .. 'wiki' )
			if sitelink then
				result2 = result2 .. '\n| style="background:#cfc;"|' .. '[[:w' .. ':' .. langTable[langCount] .. ':' .. sitelink .. '| +]]'
				if Label == '' then
					Label = sitelink
				end
			else
				result2 = result2 .. '\n| -'
			end
		end
 	result1 = '|-\n|' .. index .. '\n|'
 	if ensitelink then
 		result1 = result1 .. '[[:w:en:' .. ensitelink .. '|' .. Label ..']]'
 	else
 		result1 = result1 .. Label
 	end
		local sex = entity:formatPropertyValues( 'P21' )
		if sex then
			if sex == 'Q6581072' then
				result1 = result1 .. ' [[File:Female Icon.svg|20px]]'
			end
		end
		index = index + 1
		resultTable = resultTable .. result1 .. result2 .. '\n| style="background:#cfc;"|[[d:' .. Id .. '|' .. Id .. ']]\n'
	end
	resultTable = resultTable .. '\n|}\n'
	return resultTable
 end

 return p

AltStyle によって変換されたページ (->オリジナル) /