Module:Header/attribution data
Appearance
Documentation for this module may be created at Module:Header/attribution data/doc
local function anon(text)
text = text or 'Anonymous'
local cat = ''
if mw.title.getCurrentTitle():inNamespaces(0, 114) then
cat = '[[Category:' .. 'Works by unknown authors' .. ']]'
end
return '[[Portal:Anonymous texts|' .. text .. ']]' .. cat
end
local function anon_nocat(text)
return '[[Portal:Anonymous texts|' .. (text or 'Anonymous') .. ']]'
end
local contrib_types = {
{noun = 'author', prefix = 'by'},
{noun = 'attributed to', prefix = 'attributed to', special_cases = {}},
{noun = 'adapter', prefix = 'adapted by'},
{noun = 'abridger', prefix = 'abridged by'},
{noun = 'illustrator', prefix = 'illustrated by'},
{noun = 'director', prefix = 'directed by'},
{noun = 'lyricist', prefix = 'lyrics by'},
{noun = 'librettist', prefix = 'libretto by'},
{
noun = 'book by',
prefix = 'book by',
special_cases = {
['?'] = 'unknown author',
['unknown'] = 'unknown author',
['not mentioned'] = 'unknown author',
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various authors'
}
},
{noun = 'composer', prefix = 'composed by'},
{noun = 'arranger', prefix = 'arranged by'},
{
noun = 'translator',
prefix = 'translated by',
special_cases = {
['?'] = 'unknown translator',
['unknown'] = 'unknown translator',
['not mentioned'] = 'unknown translator',
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various translators',
['wikisource'] = '[[Wikisource:Translations|Wikisource]]'
}
},
{
noun = 'editor',
prefix = 'edited by',
special_cases = {
['?'] = 'unknown editor',
['unknown'] = 'unknown editor',
['not mentioned'] = 'unknown editor',
['anon'] = anon_nocat,
['anonymous'] = anon_nocat,
['various'] = 'various editors'
}
},
{noun = 'compiler', prefix = 'compiled by'}
}
for i = 1, #contrib_types do
local noun = contrib_types[i]['noun']
contrib_types[i]['param_name'] = contrib_types[i]['param_name'] or string.gsub(noun, ' ', '-')
contrib_types[i]['special_cases'] = contrib_types[i]['special_cases'] or {
['?'] = 'unknown ' .. noun,
['unknown'] = 'unknown ' .. noun,
['not mentioned'] = 'unknown ' .. noun,
['anon'] = anon,
['anonymous'] = anon,
['various'] = 'various ' .. noun .. 's'
}
contrib_types[i]['index'] = i
end
return contrib_types