Module:NewsItem: Difference between revisions

From TwogPedia
No edit summary
No edit summary
Line 25: Line 25:
if args.url then
if args.url then
if args.title then
if args.title then
container:wikitext('[' .. args.url .. '|' .. args.title .. ']')
container:wikitext('[' .. args.url .. ' ' .. args.title .. ']')
else  
else  
container:wikitext('[' .. args.url .. ']')
container:wikitext('[' .. args.url .. ']')

Revision as of 09:49, 6 October 2022

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