Module: Chapter displaytitle: Difference between revisions

From A Wiki of Ice and Fire
Jump to: navigation, search
Abjiklam (talk | contribs)
Created page with "local p = {} function p.display() local title = mw.title.getCurrentTitle().text local book, chapter = title:match("^(.*)-Chapter (%d+)$") if not book then..."
 
Abjiklam (talk | contribs)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}


function p.display()
function p.main()
     local title = mw.title.getCurrentTitle().text
     local title = mw.title.getCurrentTitle().text


     local book, chapter = title:match("^(.*)-Chapter (%d+)$")
     local book, chapter = title:match("^(.*)-(.*)$")


     if not book then
     if not book then
Line 10: Line 10:
     end
     end


     return "''" .. book .. "''-Chapter " .. chapter
     return "''" .. book .. "''-" .. chapter
end
end


return p
return p

Latest revision as of 14:18, 18 August 2026

Documentation for this module may be created at Module:Chapter displaytitle/doc

local p = {}

function p.main()
    local title = mw.title.getCurrentTitle().text

    local book, chapter = title:match("^(.*)-(.*)$")

    if not book then
        return title
    end

    return "''" .. book .. "''-" .. chapter
end

return p