Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Please sign up or log in to edit the wiki.

Citation template for books.

TemplateData

Generic citation template for books and published volumes.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Author(s)author

Author(s) of the book. Multiple authors can be separated with semicolons or 'and'.

Stringsuggested
Chapter titlechapter

Title of the chapter

Stringsuggested
Book titletitle

Title of the book

Stringsuggested
Publisherpublisher

Publisher of the book

Stringsuggested
Publication datedate

Publication year or full date

Datesuggested
Pagespages

Page range of the article

Stringsuggested
Pagepage

Single page reference (used if pages is not set)

Stringoptional

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