Module:Story info

From Sekaipedia
Revision as of 02:55, 28 October 2021 by ChaoticShadow (talk | contribs)

Documentation for this module may be created at Module:Story info/doc

local getArgs   = require('Module:Arguments').getArgs
local icons     = require('Module:Icons')._main

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	
	local root = mw.html.create()
	local box_css = {
		['color'] = '#424362',
		['margin'] = '3px',
		['margin-left'] = '0px',
		['border'] = '2px solid #00cdba',
		['border-radius'] = '10px',
		['box-shadow'] = '2px 3px #00cdba',
		['padding']  = '20px'
	}
	
	local top = root:tag('div')
		:css(box_css)
		:css({
			['display'] = 'flex',
			['flex-wrap'] = 'wrap',
			['gap'] = '20px',
			['justify-content'] = 'center'
		})
		:tag('div')
			:css({
				['align-self'] = 'center'
			})
			:wikitext(string.format(
				'[[File:%s|280px|center]]',
				args['image']
			))
			:done()
		:tag('div')
			:css({
				['flex-grow'] = 1,
				['text-align'] = 'center',
			})
			:tag('div')
				:css({
					['border-bottom'] = '1px solid #00cdba',
					['border-top-right-radius'] = '6px',
					['color'] = '#424362',
					['padding-bottom'] = '10px'
				})
				:wikitext(string.format(
					"'''%s:'''<br />'''%s'''<br />'''%s'''",
					args['chapter'],
					args['english'],
					args['japanese']
				))
				:done()
			:tag('div')
				:css({
					['color'] = '#424362',
					['line-height'] = '2',
					['padding-top'] = '10px'
				})
				:wikitext("'''Characters that appear:'''<br/> {{{Charas}}}")
				:done()
			:done()
		:done()
			
	local bottom = root:tag('div')
		:css(box_css)
		:css({
			['display'] = 'grid',
			['grid-template-columns'] = 'repeat(2, 1fr)',
			['gap'] = '10px'
		})
		:tag('div'):css('text-align', 'right'):wikitext("'''Translator:'''"):done()
		:tag('div'):wikitext("'''{{{Translator}}}'''"):done()
		:tag('div'):css('text-align', 'right'):wikitext("'''Source:'''"):done()
		:tag('div'):wikitext("'''{{{Source}}}'''"):done()
		:done()

	return tostring(root)
end

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