Module:Event story chapter info

From Sekaipedia
Revision as of 01:24, 22 April 2022 by ChaoticShadow (talk | contribs)


To generate {{Event story chapter info}}, invoke using the main function.


local getArgs   = require('Module:Arguments').getArgs
local StoryInfo = require('Module:Story info')._main
local utils     = require('Module:Utilities')

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	
	local chapter  = args['chapter']
	local english  = args['english']
	local japanese = args['japanese']
	local romaji   = args['romaji']
	
	local title = string.format(
			"Chapter %s: %s",
			utils.editIfNil(chapter),
			utils.editIfNil(english)
		)
		
	if japanese or romaji then
		title = title .. string.format(
			"<br>%s (%s)",
			utils.editIfNil(japanese),
			utils.editIfNil(romaji)
		)
	end
	
	args['title'] = title
	
	if mw.title.getCurrentTitle().namespace == 0 then
		mw.ext.seo.set{
			title = string.format(
				"Chapter %s: %s",
				chapter,
				english or japanese
			),
			title_mode = 'prepend',
		}
	end
	
	return StoryInfo(args)
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.