Module:NewsItem

From TwogPedia
Revision as of 09:45, 6 October 2022 by Couchor (talk | contribs)

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

local getArgs = require('Module:Arguments').getArgs
local Flags = require('Module:Flags')
local NewsItem = {}

function NewsItem.main(frame)
	local args = getArgs(frame)
	mw.log('ARTICLEEE')
	mw.logObject(args)
	
	local container = mw.html.create('span'):addClass('newsItem')
	
	-- local date, title, url, source, author, lang, translated, event, note
	
	if args.date then
		local date = mw.html.create('span'):addClass('news-date'):wikitext(args.date)
		container:node(date)
	end
	
	if args.lang then
		container:node(Flags.icon(args.lang))
	else 
		container:node(Flags.icon('usuk'))
	end
	
	if args.url then
		if args.title then
			container:wikitext('[[' .. args.url .. '|' .. args.title .. ']]')
		else 
			container:wikitext('[[' .. args.url .. ']]')
		end
	end
	
	return container
end

return NewsItem