Module:OtherNewsDataSources

local util_args = require('Module:ArgsUtil') local util_cargo = require("Module:CargoUtil") local util_html = require("Module:HtmlUtil") local util_map = require('Module:MapUtil') local util_table = require("Module:TableUtil") local util_text = require("Module:TextUtil") local util_vars = require("Module:VarsUtil") local i18n = require("Module:I18nUtil") local lang = mw.getLanguage('en') local h = {} local p = {} function p.main i18n.init('OtherNewsDataSources') local date = util_vars.getVar('Date') local listOfPages = h.makeAndRunQuery(date) if #listOfPages == 0 then return '' end return h.makeOutput(listOfPages) end

function h.makeAndRunQuery(date) local query = { tables = { 'NewsItems' }, where = h.getWhere(date), fields = { '_pageName' }, groupBy = '_pageName', }	return util_cargo.getOrderedList(query, '_pageName') end

function h.getWhere(date) local where = { ('_pageName != "%s"'):format(mw.title.getCurrentTitle.fullText), ('Date_Sort = "%s"'):format(date) }	return where end

function h.makeOutput(listOfPages) local output = mw.html.create output:wikitext(i18n.print('intro')) local ul = output:tag('ul') util_map.copy(listOfPages, h.printOnePage, ul) return output end

function h.printOnePage(page, ul) ul:tag('li') :wikitext(util_text.intLinkOrText(page)) end

return p