Citation template for books.
- Module: Module:Cite book
TemplateData
Generic citation template for books and published volumes.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Author(s) | author | Author(s) of the book. Multiple authors can be separated with semicolons or 'and'. | String | suggested |
| Chapter title | chapter | Title of the chapter | String | suggested |
| Book title | title | Title of the book | String | suggested |
| Publisher | publisher | Publisher of the book | String | suggested |
| Publication date | date | Publication year or full date | Date | suggested |
| Pages | pages | Page range of the article | String | suggested |
| Page | page | Single page reference (used if pages is not set) | String | optional |
local p = {}
function p.cite(frame)
local args = require('Module:Arguments').getArgs(frame)
local output = ""
-- 1. Author
if args.author then
output = args.author .. ", "
end
-- 2. Chapter
if args.chapter then
output = output .. '“' .. args.chapter .. ',” in '
end
-- 3. Title (italicized)
if args.title then
output = output .. "''" .. args.title .. "''"
end
-- 4. Publisher and/or date (in parentheses)
if args.publisher or args.date then
local pubParts = {}
if args.publisher then table.insert(pubParts, args.publisher) end
if args.date then table.insert(pubParts, args.date) end
output = output .. " (" .. table.concat(pubParts, ", ") .. ")"
end
-- 5. Pages
if args.pages then
output = output .. ", pp. " .. args.pages
elseif args.page then
output = output .. ", p. " .. args.page
end
return output
end
return p