Jump to content

Module:Film

From Wikisource

require('strict')

local p = {}

local getArgs = require('Module:Arguments').getArgs
local error_message = require('Module:Error')['error']
-- local yesno = require('Module:Yesno')

function p._film(args)
	if not args[1] then
		return error_message({'[[Module:Film]] error: no file provided'})
	end
	
	--[=[
	local blackface_warning = ''
	if yesno(args.blackface or false) then
		blackface_warning = require('Module:Blackface').blackface()
	end
	]=]
	
	local film_key = mw.html.create('table'):addClass('wst-film-key')
	film_key:wikitext(table.concat({
		'<tr><th colspan="2"><span class="key">Key</span> <span class="info">([[Help:Film|info]])</span></th></tr>',
		'<tr><td class="dialog"></td><td>Dialogue</td></tr>',
		'<tr><td class="in_scene"></td><td>In scene</td></tr>',
		'<tr><td class="storyline"></td><td>Storyline</td></tr>'
	}))
	film_key = tostring(film_key)
	
	local wst_film_file = mw.html.create('div'):addClass('wst-film-file')
	wst_film_file:wikitext('[[File:' .. args[1] .. '|center|thumbtime=' .. (args.thumbtime or '') .. '|' .. (args.size or '400px') .. ']]')
	wst_film_file = tostring(wst_film_file)
	
	local transcript_info = mw.html.create('div'):addClass('wst-transcript-info')
	transcript_info:wikitext('[[File:Video Camera Icon.svg|20px]] The following is a transcription of a [[Portal:Film|film]]. The contents below represent text or spoken dialogue that are transcribed directly from the video of the film provided above. On certain screen sizes, each line is represented by a timestamp next to it which shows when the text appears on the video. For more information, see [[Help:Film]].')
	transcript_info = tostring(transcript_info)
	
	local container = mw.html.create('div'):addClass('wst-film-container')
	container:wikitext(table.concat({
		-- blackface_warning,
		film_key,
		wst_film_file,
		require('Module:Film song')._film_song_list({args['wikidata_id']}),
		require('Module:Cast and crew')._generateCastAndCrew({args['wikidata_id']}),
		transcript_info,
		tostring(mw.html.create('div'):css({clear = 'both'})),
		require('Module:Pre-Code film').check(),
		args.category or '[[Category:' .. 'Film' .. ']]'
	}))
	return tostring(container)
end

function p.film(frame)
	return p._film(getArgs(frame))
end

return p