Module:Character Appearances: Difference between revisions

From fractalthorns wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
VERCE = {  
VERCE = {  
"the dark",
"the dark",
"endless night",
"open arms for the endless night",
"music and meter and rhyme",
"music and meter and rhyme",
"verses",
"verses",
Line 16: Line 16:
local result = {}
local result = {}
result[#result + 1] = '{| class = "wikitable'
result[#result + 1] = '<table class = "wikitable">'
result[#result + 1] = '! [[' .. character .. ']]'
result[#result + 1] = '<tr><th>[[' .. character .. ']]</th></tr>'
for _, record in pairs(appearances[character]) do
for _, record in pairs(appearances[character]) do
local record_link = 'https://doughbyte.com/art/?show=' .. string.gsub(record, ' ', '_')
local record_link = 'https://doughbyte.com/art/?show=' .. string.gsub(record, ' ', '_')
result[#result + 1] = '|-'
result[#result + 1] = '<tr><td>[' .. record_link .. ' ' .. record .. ']</tr></td>'
result[#result + 1] = '| [' .. record_link .. ' ' .. record .. ']'
end
end
result[#result + 1] = "|}"
result[#result + 1] = "</table>"
     return table.concat(result, '\n')
     return table.concat(result, '\n')
end
end


return package
return package

Revision as of 23:34, 13 December 2023

Documentation for this module may be created at Module:Character Appearances/doc

local package = {}

local appearances = {
	VERCE = { 
		"the dark",
		"open arms for the endless night",
		"music and meter and rhyme",
		"verses",
		"though strangers",
		"somehow i knew"
	}
}

function package.get_table_for_character(frame)
	local character = frame.args[1]
	local result = {}
	
	result[#result + 1] = '<table class = "wikitable">'
	result[#result + 1] = '<tr><th>[[' .. character .. ']]</th></tr>'
	
	for _, record in pairs(appearances[character]) do
		local record_link = 'https://doughbyte.com/art/?show=' .. string.gsub(record, ' ', '_')
		result[#result + 1] = '<tr><td>[' .. record_link .. ' ' .. record .. ']</tr></td>'
	end
	
	result[#result + 1] = "</table>"
    return table.concat(result, '\n')
end

return package