Introducing: Representatives. swedishwin.com, chud.win, and soyzellig.party positions are vacant.


The new Community missions system is now live! Where anyone can propose a task, discuss nominations, or join the current mission. Community missions give editors a place to turn requests from the Janny noticeboard into focused projects. No mission can be too small

Module:News/links

From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search

This module simply draws the links row under the front nameplate and in the footer band of every issue. It is used by Template:News/links and takes no parameters, as everything is handled automatically from links in Module:News/config.


local p = {}

local News = require('Module:News')
local cfg = News.cfg

function p.main(frame)
	local state = News.newState()
	local latest = News.listed(News.today(frame))[1]
	local root = mw.html.create('div'):addClass('sn-news-links')

	for _, entry in ipairs(cfg.links) do
		local target
		if entry.page then
			target = entry.page
		elseif entry.key == 'latest' then
			target = latest and latest.page
		else
			target = News.pageTitle(entry.key)
			if target == nil then
				root:tag('span'):wikitext(News.errorText(state, 'unknownLink', { value = tostring(entry.key) }))
			end
		end
		if target then root:tag('span'):wikitext('[[' .. target .. '|' .. entry.label .. ']]') end
	end

	return News.finish(state, tostring(root))
end
return p