Module:Book
Appearance
Documentation for this module may be created at Module:Book/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()
return {
['Cover image'] = {'Has cover image', 'file'},
['Cover image caption'] = {'Has caption'},
['Book type'] = {'Book type', ','},
['Description'] = {'Description text'},
['Main quote'] = {'Has main quote'},
['Main quote source'] = {'Main quote source'},
['Practice cycles'] = {'Practice cycle', ','},
['Khajangs'] = {'Khajang', ','},
['Authored by'] = {'Authored by', ','},
['Requested by'] = {'Requested by', ','},
['Scribed by'] = {'Scribed by', ','},
['Language of original'] = {'Language of original', ','},
['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'
}
},
['Book'] = {
heading = 'Notice',
template = 'Infobox/Book',
subobject = 'false',
order = '2',
rows = {
'Wylie transliteration',
'Authored by',
'Requested by',
'Scribed by',
'Language of original'
}
},
['Details'] = {
heading = 'Details',
template = 'Infobox/Practice text details',
subobject = 'false',
order = '3',
rows = {
'Book type',
'Practice cycles',
'Khajangs',
}
},
['Publication'] = {
heading = 'Publications',
template = 'Infobox/Publications',
subobject = 'false',
order = '4',
rows = {
'Publication'
}
},
['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 args = frame:getParent().args
local monoProps = utils.setPropertiesMono(propertiesPlanMono(), args) or {}
mw.smw.set(monoProps)
local cat = 'Books'
local properties = propertiesPlan()
local sections = infoboxSectionPlan()
local infobox = utils.createInfobox(frame, cat, properties, sections)
return infobox
end
return p