Module:Book
From Eli's Software Encyclopedia
Documentation for this module may be created at Module:Book/doc
local p = {}
local function splitValues(str, sep)
local result = {}
for part in raw:gmatch("[^" .. sep .. "]+") do
part = part:match("^%s*(.-)%s*$")
table.insert(result, part)
end
return result
end
function p.semanticStore(frame)
local titleObj = mw.title.getCurrentTitle()
local args = frame:getParent().args or {}
local booktitle = args.booktitle
local authors = args['author'] or ''
local publisher = args.publisher
local releaseDate = args.released or args['release date']
local genre = args.genre
local isbn = args.ISBN
local lcc = args.LCC
local bookformat = args['format']
local country = args.country
local language = args.language
if not booktitle or booktitle == '' then
booktitle = titleObj.text
end
mw.smw.set{
'Has Title=' .. booktitle,
'Author=' .. authors,
'+sep=,',
'Publisher=' .. publisher,
'Release Date=' .. releaseDate,
'Genre=' .. genre,
'ISBN=' .. isbn,
'LCC=' .. lcc,
'Book Format=' .. bookformat,
'Country=' .. country,
'Language=' .. language
}
end
return p
