Module:Source author box

Documentation for this module may be created at Module:Source author box/doc

local p = {}

function p.main(frame)
	
	local args = frame:getParent().args
	
	local page = args['page'] or ''
	local image = args['image'] or 'Johndoe.png'
	local info = args['info'] or ''
		
	local html = mw.html.create()
	
	local card = html:tag('div')
		:addClass('card flex-column flex-md-row border-0 mb-3')
        :css('gap', '0 1rem')

	local image_page = ''
	if image ~= '' then
		image_page = frame:preprocess('{{PAGENAME:' .. image .. '}}')
		-- image_encoded = mw.uri.encode(image_page, 'WIKI')
		image_src = frame:preprocess('{{filepath:' .. image_page .. '}}')
		-- image_formatted = '[[File:' .. image_page .. '|class=img-fluid notpageimage|link=' .. page .. ']]'
	end
	
	local image_wrapper = card:tag('div')
		:addClass('card-img thumb150')
		:attr('data-bg', image_src)
		-- :wikitext(image_formatted)
		
	local card_body =  card:tag('div')
		:addClass('card-body px-0 px-lg-3 py-lg-0 border-0')
	
	local page_formatted = ''
	if page ~= '' then
		page_formatted = '[[' .. page .. ']]'
	else
		page_formatted = 'Author'
	end
	
	local card_heading = card_body:tag('div')
		:addClass('h5 interface')
		:wikitext(page_formatted)
	
	local card_info = card_body:tag('div')
		:wikitext(info)
	
	return card
end

return p