Module:title/getMainPageTitle

From Linguifex
Jump to navigation Jump to search

Documentation for this module may be created at Module:title/getMainPageTitle/doc

local title_new_title_module = "Module:title/newTitle"

local require = require

local function new_title(...)
	new_title = require(title_new_title_module)
	return new_title(...)
end

local main_page
local function get_main_page()
	-- Ideally this would be done via some kind of :parse() method, but the
	-- mw.message library got heavily nerfed by [[phab:T62758]], meaning it's
	-- now only able to fetch the unparsed wikitext and can't expand it.
	main_page, get_main_page = require("Module:frame").preprocess(mw.message.new("mainpage"):plain()), nil
	return main_page
end

return function()
	return new_title(main_page or get_main_page())
end