Module:NewsItem: Difference between revisions

From TwogPedia
No edit summary
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:
function NewsItem.main(frame)
function NewsItem.main(frame)
local args = getArgs(frame)
local args = getArgs(frame)
mw.log('ARTICLEEE')
mw.logObject(args)
local container = mw.html.create('span'):addClass('newsItem')
local container = mw.html.create('span'):addClass('newsItem')
-- local date, title, url, source, author, lang, translated, event, note
if args.date then
if args.date then
local date = mw.html.create('span'):addClass('news-date'):wikitext(args.date)
local date = mw.html.create('span'):addClass('news-date'):wikitext(mw.text.split(args.date, ' ')[1])
container:node(date)
container:node(date)
end
end
 
if args.lang then
if args._pageName then
container:node(Flags.icon(args.lang))
container:wikitext(' [[' .. args._pageName .. ']]')
else
container:node(Flags.icon('usuk'))
end
end
if args.url then
--if args.author then
if args.title then
-- local link = args.authorlink == nil and args.author or args.author .. '|' .. args.authorlink
container:wikitext('[' .. args.url .. '|' .. args.title .. ']')
-- container:wikitext(' by [[' ..link .. ']]')
else
--end
container:wikitext('[' .. args.url .. ']')
end
end
return container
return container

Latest revision as of 21:42, 23 February 2024

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)
	local container = mw.html.create('span'):addClass('newsItem')
	
	if args.date then
		local date = mw.html.create('span'):addClass('news-date'):wikitext(mw.text.split(args.date, ' ')[1])
		container:node(date)
	end

	if args._pageName then
		container:wikitext(' [[' .. args._pageName .. ']]')
	end
	
	--if args.author then
	--	local link = args.authorlink == nil and args.author or args.author .. '|' .. args.authorlink
	--	container:wikitext(' by [[' ..link .. ']]')
	--end
	
	return container
end

return NewsItem