Dokumentation für das Modul IETF RFC[Ansicht] [Bearbeiten] [Versionsgeschichte] [Aktualisieren]

Die Vorlage liefert Links zu den Request for Comments (RFC) der Internet Engineering Task Force (IETF) anhand der vorgegebenen numerischen IDs.

Beschreibung siehe unter der Vorlage {{IETF RFC}}.
Hinweise
local RFC = { suite   = 'IETF RFC',
              serial  = '2018-08-25',
              version = '1.0' }

local p = {}

local yn = require( 'Module:Yesno' )

-- I18n
local rfcDefs = {
	plainLink = 'n',    -- default value
	rfc       = 'RFC ', -- RFC string before link
	rfcUrl    = '[//tools.ietf.org/html/rfc%s %s]' -- link string formatter
}

function p.rfc( frame )
	local rfcs = {}, k, v, n
	
	-- Getting arguments
	local args = frame:getParent().args
	args.plainlink = args.plainlink or ''
	if args.plainlink == '' then
		args.plainlink = rfcDefs.plainLink
	end
	args.leadout = args.leadout or ''

	-- Getting and linking RFCs
	for k, v in pairs( args ) do
		v = mw.text.trim( v )
		n = tonumber( v )
		if tonumber( k ) and n and ( n == math.floor( n ) ) then
			table.insert( rfcs, string.format( rfcDefs.rfcUrl, v, v ) )
		end
	end

	-- Formatting RFCs
	n = ''
	if #rfcs > 0 then
		n = table.concat( rfcs, ', ' )
		if args.leadout ~= '' then
			n = n:gsub( ',([^,]*)$' , ' ' .. args.leadout .. '%1' )
		end
		if not yn( args.plainlink, rfcDefs.plainLink ~= 'n' ) then
			n = rfcDefs.rfc .. n
		end
	end

	return n
end

return p