Module:NewsData

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_esports = require('Module:EsportsUtil') local util_html = require('Module:HtmlUtil') local util_math = require('Module:MathUtil') local util_news = require("Module:NewsUtil") local util_text = require('Module:TextUtil') local util_title = require('Module:TitleUtil') local util_vars = require('Module:VarsUtil') local i18n = require('Module:I18nUtil') local COLUMNS = util_news.COLUMNS local WeeklyDataPages = require('Module:WeeklyDataPages') local m_team = require('Module:Team')

local h = {}

local p = {} function p.start(frame) return WeeklyDataPages.start('NewsData') end

function p.date(frame) i18n.init('NewsData') local args = util_args.merge(true) return WeeklyDataPages.date(args, COLUMNS) end

function p.endTable(frame) return ' ' end

function p.line(frame) local args = util_args.merge(true) util_cargo.setStoreNamespace('Data') util_news.setId args.Sentence = args.sentence local data = util_news.getNewsCargoFieldsFromArgs(args) util_cargo.store(data) return util_news.makeSentenceOutput(args, data) end

function p.team(frame) local args = util_args.merge(true) util_cargo.setStoreNamespace('Data') util_news.setId args.Sentence = args.sentence local data = util_news.getNewsCargoFieldsFromArgs(args) data.Subject = m_team.teamlinkname(args.team) data.SubjectType = 'Team' util_cargo.store(data) return util_news.makeSentenceOutput(args, data) end

function p.tournament(frame) local args = util_args.merge(true) util_cargo.setStoreNamespace('Data') util_news.setId args.Sentence = args.sentence local data = util_news.getNewsCargoFieldsFromArgs(args) data.Subject = args.tournament data.SubjectLink = util_title.target(args.link) or args.tournament data.SubjectType = 'Tournament' util_cargo.store(data) return util_news.makeSentenceOutput(args, data) end

function p.player(frame) local args = util_args.merge(true) util_cargo.setStoreNamespace('Data') util_news.setId args.Sentence = args.sentence local data = util_news.getNewsCargoFieldsFromArgs(args) data.Subject = args.player data.SubjectType = 'Player' util_cargo.store(data) return util_news.makeSentenceOutput(args, data) end

return p