Module:Infobox/Lead

local Lead = {} local HF = require('Module:HF') local getArgs = require('Module:Arguments').getArgs local language = mw.language.new('en') local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame) return Lead[funcName](args) end end Lead.character = makeInvokeFunc('_character') Lead.episode = makeInvokeFunc('_episode') function Lead._character( args ) local intro = {} local story = HF.parseStory( args.story ) or "" local plural = 1 local gender = args.gender or 'neutral' gender = string.lower( gender ) if not HF.isempty( args.plural ) then plural = 2 end if not HF.isempty( args.name ) then table.insert( intro, "'''" ) if not HF.isempty( args.honorific ) then table.insert( intro, args.honorific .. ' ' ) end table.insert( intro, "" .. args.name .. "''' " ) if not HF.isempty( args.othernames ) then local othernames = mw.html.create('span'):addClass('plainlinks'):wikitext( args.othernames ) table.insert( intro, tostring(othernames) .. ' ' ) end table.insert( intro, language:plural( plural, 'is ', 'are ' ) ) if not HF.isempty( args.description ) then table.insert( intro, args.description .. '. ') else table.insert( intro, language:plural( plural, 'a character. ', 'characters. ' ) )   end table.insert( intro, language:gender( gender, language:plural( plural, 'He ', 'They '), language:plural( plural, 'She ', 'They '), language:plural( plural, 'It ', 'They ' ) ) ) table.insert( intro, language:plural( plural, 'is a character in ', 'are characters in ' ) ) if story == 'Murder House' then table.insert( intro, "the first season (dubbed by fans \"Murder House\")" ) elseif (story ~= "") then table.insert( intro,  .. story ..  ) else table.insert( intro, 'American Horror Story' ) end if not HF.isempty( args.portrayer ) then if not HF.isempty( args.altportrayer ) then table.insert( intro, ' primarily ' ) end table.insert( intro, ' portrayed by ' .. args.portrayer ) end table.insert( intro, '.' ) if not HF.isempty( args.additional ) then table.insert( intro, " " .. args.additional ) end end if ( args.story ~= 'suppress' ) then return table.concat( intro ) end end function Lead._episode( args ) local introduction = '' local intro = {} local story = HF.parseStory( args.story ) or '' if not HF.isempty( args.name ) then table.insert( intro, "\"" .. args.name .."\" " ) if not HF.isempty( args.story ) and not HF.isempty( args.episode ) then table.insert( intro, 'is the '..HF.numtoordinal(args.episode)..' episode of ' ) if story == "Murder House" then table.insert( intro, "the first season (\"Murder House\")." ) elseif (story ~= '') then table.insert( intro, ''..story..'.' ) else table.insert( intro, 'American Horror Story.' ) end else table.insert( intro, 'is an episode of American Horror Story.' ) end if not HF.isempty( args.premiere) then table.insert( intro, ' It premiered '..HF.__formatDate( args.premiere )..'.' ) end if not HF.isempty( args.additional ) then table.insert( intro, ' '..args.additional ) end end -- Synopsis is going to be args[2] if ( args.story ~= 'suppress' ) then return table.concat( intro ) end end function Lead.delay(frame) local diff = os.difftime(language:formatDate('U',nil,false),language:formatDate('U',(frame.args['premiere'] .. 'T21:00:00-05:00'),false)) local output = diff return output end return Lead