Jump to content

Module:Story

From Namtars

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

local utils = require( 'Module:Utils' )

local p = {}

local function propertiesPlan()
	return {
		['Cover image']         = {'Has cover image', 'file'},
		['Cover image caption'] = {'Has caption'},
		['Storyteller']         = {'Storyteller'},
		['Story epoch']         = {'Story epoch'},
		['Description']         = {'Description text'},
		['Main quote']          = {'Has main quote'},
		['Main quote source']   = {'Main quote source'},
		['Recording place']     = {'Recording place'},
		['Recorded by']         = {'Recorded by', ','},
		['People']              = {'Mentioned person', ','},
		['Deities']             = {'Mentioned deity', ','},
		['Practice texts']      = {'Mentioned practice text', ','},
		['Places']              = {'Mentioned place', ','},	
		['Has related map']     = {'Has related map', 'GeoJSON'}
	}
end

local function infoboxSectionPlan()
	local sectionMap = {
		['Cover'] = {
			heading = '',
			template = 'Infobox/Cover',
			subobject = 'false',
			order = '1',
			rows = {
				'Tibetan name',
				'Cover image',
				'Cover image caption',
				'Description',
				'Main quote',
				'Main quote source'
			}
		},
		['Story'] = {
			heading = 'Story elements',
			template = 'Infobox/Story',
			subobject = 'false',
			order = '2',
			rows = {
				'Story epoch',
				'People',
				'Deities',
				'Practice texts',
				'Places'
			}
		},
		['Recording'] = {
			heading = 'Recording',
			template = 'Infobox/Recording',
			subobject = 'false',
			order = '3',
			rows = {
				'Storyteller',
				'Recording place',
				'Date',
				'Recorded by'
			}
		},
		['Media'] = {
			heading = 'Media',
			template = 'Infobox/Media',
			subobject = 'false',
			order = '4',
			rows = {
				'Media',
			}
		},
		['Names'] = {
			heading = 'Names',
			template = 'Infobox/Names',
			subobject = 'true',
			order = '5',
			rows = {
				'Tibetan name',
				'Wylie transliteration',
				'Names'
			}
		},
		['Custom Map'] = {
			heading = '',
			template = 'Infobox/Custom map',
			subobject = 'false',
			order = '6',
			rows = {
				'Include custom map',
				'Has related map'
			}
		},
		['Quotes'] = {
			heading = 'Quotes',
			template = 'Infobox/Quotes',
			subobject = 'true',
			order = '7',
			rows = {
				'Quotes'
			}
		}
	}
	return sectionMap
end

function p.infobox(frame)
	local cat        = 'Stories'
	local properties = propertiesPlan()
	local sections   = infoboxSectionPlan()
	local infobox    = utils.createInfobox(frame, cat, properties, sections)
	return infobox
end

return p