Module: Chapter displaytitle: Difference between revisions

From A Wiki of Ice and Fire
Jump to: navigation, search
Abjiklam (talk | contribs)
No edit summary
Abjiklam (talk | contribs)
No edit summary
 
Line 4: Line 4:
     local title = mw.title.getCurrentTitle().text
     local title = mw.title.getCurrentTitle().text


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


     if not book then
     if not book then

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