Jump to content
Menü aufrufen
Toggle preferences menu
Persönliches Menü aufrufen
Nicht angemeldet
Ihre IP-Adresse wird öffentlich sichtbar sein, wenn Sie Änderungen vornehmen.

Die Dokumentation für dieses Modul kann unter Modul:Main/doc erstellt werden

--[[
-- Dieser Modul erzeugt einen Hinweis auf den Hauptartikel eines Themas.
-- Er implementiert die Vorlage {{Hauptartikel}}.
-- Portiert von starcitizen.tools (Modul:Main, Wikipedia-Ursprung).
--]]

local mHatnote = require('Modul:Hatnote')
local mHatlist = require('Modul:Hatnote list')
local mArguments -- lazy
local p = {}

function p.main(frame)
	mArguments = require('Modul:Arguments')
	local args = mArguments.getArgs(frame, {parentOnly = true})
	local pages = {}
	for k, v in pairs(args) do
		if type(k) == 'number' then
			local display = args['label ' .. k] or args['l' .. k]
			local page = display and
				string.format('%s|%s', string.gsub(v, '|.*$', ''), display) or v
			pages[#pages + 1] = page
		end
	end
	if #pages == 0 and mw.title.getCurrentTitle().namespace == 0 then
		return mHatnote.makeWikitextError(
			'keine Seitennamen angegeben',
			'Vorlage:Hauptartikel#Fehler',
			args.category
		)
	end
	local options = {
		selfref = args.selfref
	}
	return p._main(pages, options)
end

function p._main(args, options)
	-- Ohne erste Seite: aktueller Seitentitel.
	local currentTitle = mw.title.getCurrentTitle()
	if #args == 0 then args = {currentTitle.text} end
	local list = mHatlist.andList(args, true)
	local isPlural = #args > 1
	local text
	local curNs = currentTitle.namespace
	if (curNs == 14) or (curNs == 15) then -- Kategorie(/Diskussion)
		text = isPlural
			and string.format('Die Hauptartikel dieser [[Hilfe:Kategorien|Kategorie]] sind %s', list)
			or string.format('Der Hauptartikel dieser [[Hilfe:Kategorien|Kategorie]] ist %s', list)
	else
		text = 'Hauptartikel: ' .. list
	end
	options = options or {}
	local hnOptions = {
		selfref = options.selfref,
		icon = 'WikimediaUI-Article-ltr.svg'
	}
	return mHatnote._hatnote(text, hnOptions)
end
return p
Zuletzt geändert
Urheberrecht
Cookies helfen uns bei der Bereitstellung dieses Wikis. Durch die Nutzung des Star Citizen Wiki erklärst du dich damit einverstanden, dass wir Cookies speichern.