Module:BookCSS

From Wikisource
Jump to navigation Jump to search

local export = {}

function export.bookCss(frame)
	local bookFileName = frame:getParent().args[1]
	if not bookFileName then
		bookFileName = string.gsub(mw.title.getCurrentTitle().baseText, '/.+', '')
	end

	local bookCssName = 'Template:BookCSS/' .. bookFileName .. '.css'

	local bookCss = mw.title.new(bookCssName).exists and frame:extensionTag{
		name = "templatestyles", args = { src = bookCssName }
	} or ''

	return bookCss
end

return export