Module:Chapterlist

local p = {}

--   For use on books that use "Chapter -- function p.num(frame) local args = frame.args local result = "" local i = 1 local shouldIncludePrologue = nil if args[3] == nil then shouldIncludePrologue = "false" else shouldIncludePrologue = string.lower(args[3]) end if shouldIncludePrologue == "true" then result = "Prologue" end while i <= tonumber(args[2]) do       local link = "Chapter " .. i .. "" if i > 1 or shouldIncludePrologue == "true" then result = result .. " • "       end result = result .. link i = i + 1 end return result end --   For use on books that do not follow the standard numbered chapter format, and instead use a unique name for each chapter.    The first parameter is the title of the book's page.    All the following parameters are the chapter titles. There can be an unlimited number of these added. -- function p.name(frame) local args = frame.args local result = "" for i, val in ipairs(args) do       if i > 1 then local link = "" .. val .. "" if i > 2 then result = result .. " • "           end result = result .. link end end return result end return p