From Wikipedia, the free encyclopedia


require('strict')



local p = {}

local data = mw.loadData('Module:Jcon/data')



-- Generates a list of supported regions

function p.supported(frame)

	local reverseAliases = {}

	local entries = {}

	local pre = 'Note: All inputs are converted to lowercase by the template and "Region of", "County Road", etc. are striped from the input.'

	local post = 'Table produced by [[Module:Jcon/documentation]] with data from [[Module:Jcon/data]] ('

		.. frame:expandTemplate{ title = 'edit', args = { 'Module:Jcon/data' } } .. ').'

	local tableEl = mw.html.create('table'):addClass('wikitable') -- Create output table element

	

	local headerRow = tableEl:tag('tr')

	headerRow:tag('th'):wikitext('Name')

	headerRow:tag('th'):wikitext('Aliases')

	headerRow:tag('th'):wikitext('Prefix')



	for alias, name in pairs(data.aliases) do -- Reverse the alias table to allow lookup by name

		if not reverseAliasesname then

			reverseAliasesname = {}

		end

		

		table.insert(reverseAliasesname], alias)

	end



	for name, info in pairs(data.types) do -- Create tables for each region

		local aliases = ''

		

		if reverseAliasesname then

			for _, alias in ipairs(reverseAliasesname]) do

				aliases = aliases .. '\n* ' .. alias -- Add alias to list item

			end

		end

		

		local row = tableEl:tag('tr')

		row:tag('td'):wikitext(name)

		row:tag('td'):wikitext(aliases)

		row:tag('td'):wikitext(info.prefix .. ' ' .. info.type)

	end

		

	for sign, fileName in pairs(data.signs) do

		local aliases = ''

		

		if reverseAliasessign then

			for _, alias in ipairs(reverseAliasessign]) do

				aliases = aliases .. '\n* ' .. alias -- Add alias to list item

			end

		end

		

		local row = tableEl:tag('tr')

		row:tag('td'):wikitext(sign)

		row:tag('td'):wikitext(aliases)

		row:tag('td'):wikitext('[[File:' .. fileName .. '|20px]]')

	end



	return pre .. tostring(tableEl) .. post

end



return p
From Wikipedia, the free encyclopedia


require('strict')



local p = {}

local data = mw.loadData('Module:Jcon/data')



-- Generates a list of supported regions

function p.supported(frame)

	local reverseAliases = {}

	local entries = {}

	local pre = 'Note: All inputs are converted to lowercase by the template and "Region of", "County Road", etc. are striped from the input.'

	local post = 'Table produced by [[Module:Jcon/documentation]] with data from [[Module:Jcon/data]] ('

		.. frame:expandTemplate{ title = 'edit', args = { 'Module:Jcon/data' } } .. ').'

	local tableEl = mw.html.create('table'):addClass('wikitable') -- Create output table element

	

	local headerRow = tableEl:tag('tr')

	headerRow:tag('th'):wikitext('Name')

	headerRow:tag('th'):wikitext('Aliases')

	headerRow:tag('th'):wikitext('Prefix')



	for alias, name in pairs(data.aliases) do -- Reverse the alias table to allow lookup by name

		if not reverseAliasesname then

			reverseAliasesname = {}

		end

		

		table.insert(reverseAliasesname], alias)

	end



	for name, info in pairs(data.types) do -- Create tables for each region

		local aliases = ''

		

		if reverseAliasesname then

			for _, alias in ipairs(reverseAliasesname]) do

				aliases = aliases .. '\n* ' .. alias -- Add alias to list item

			end

		end

		

		local row = tableEl:tag('tr')

		row:tag('td'):wikitext(name)

		row:tag('td'):wikitext(aliases)

		row:tag('td'):wikitext(info.prefix .. ' ' .. info.type)

	end

		

	for sign, fileName in pairs(data.signs) do

		local aliases = ''

		

		if reverseAliasessign then

			for _, alias in ipairs(reverseAliasessign]) do

				aliases = aliases .. '\n* ' .. alias -- Add alias to list item

			end

		end

		

		local row = tableEl:tag('tr')

		row:tag('td'):wikitext(sign)

		row:tag('td'):wikitext(aliases)

		row:tag('td'):wikitext('[[File:' .. fileName .. '|20px]]')

	end



	return pre .. tostring(tableEl) .. post

end



return p

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook