Module:Dharma term
Appearance
Documentation for this module may be created at Module:Dharma term/doc
local utils = require( 'Module:Utils' )
local p = {}
local function propertiesPlanMono()
return {
['Tibetan name'] = {'Tibetan name', '@bo'},
['Wylie transliteration'] = {'Wylie transliteration', '@bo-x-ewts'}
}
end
local function propertiesPlan()
local propMap = {
['Cover image'] = {'Has cover image', 'file'},
['Cover image caption'] = {'Has caption'},
['Description'] = {'Description text'},
['Main quote'] = {'Has main quote'},
['Main quote source'] = {'Main quote source'},
['Writing start year'] = {'Writing start year'},
['Writing completion year'] = {'Writing completion year'},
['Writing locations'] = {'Writing location', ','},
['Has related map'] = {'Has related map', 'GeoJSON'}
}
return propMap
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'
}
},
['Notice'] = {
heading = 'Notice',
template = 'Infobox/Practice text notice',
subobject = 'false',
order = '2',
rows = {
'Wylie transliteration',
'Writing timeline',
'Writing locations'
}
},
['Names'] = {
heading = 'Names',
template = 'Infobox/Names',
subobject = 'true',
order = '3',
rows = {
'Tibetan name',
'Wylie transliteration',
'Names'
}
},
['Custom Map'] = {
heading = '',
template = 'Infobox/Custom map',
subobject = 'false',
order = '4',
rows = {
'Include custom map',
'Has related map'
}
},
['Quotes'] = {
heading = 'Quotes',
template = 'Infobox/Quotes',
subobject = 'true',
order = '5',
rows = {
'Quotes'
}
}
}
return sectionMap
end
function p.infobox(frame)
local args = frame:getParent().args
local monoProps = utils.setPropertiesMono(propertiesPlanMono(), args) or {}
mw.smw.set(monoProps)
local cat = 'Dharma terms'
local properties = propertiesPlan()
local sections = infoboxSectionPlan()
local infobox = utils.createInfobox(frame, cat, properties, sections)
return infobox
end
return p