Nicht angemeldeter Benutzer - Bearbeiten von Seiten ist nur als angemeldeter Benutzer möglich.
Änderungen
Zur Navigation springen
Zur Suche springen
Zeile 1:
Zeile 1:
− +
+
+
+
Zeile 21:
Zeile 24:
+
+
Zeile 171:
Zeile 176:
− +
− table.concat( unknown, " " ), +
− Config.scheme )+
+
Zeile 188:
Zeile 194:
+
Zeile 195:
Zeile 202:
− +
− +
− r, factory( "problemNote" ) )+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Zeile 211:
Zeile 237:
− -- Export+
− local p = { }
−
− p.main = function ( argsF, argsT )
Zeile 264:
Zeile 287:
− +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
− +
Zeile 279:
Zeile 348:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
− +
− function p.failsafe()+
− +
− +
Modul:Vorlage:Handle (Quelltext anzeigen)
Version vom 14. Juli 2019, 18:06 Uhr
, 18:06, 14. Jul. 20192019-07-14
local Serial = "2018-01-10"
local Handle = { suite = "Handle",
serial = "2019-07-14",
item = 19644424 }
--[=[
--[=[
Template:Handle {{DOI}} {{HDL}}
Template:Handle {{DOI}} {{HDL}}
require: URIutil
require: URIutil
]=]
]=]
local Failsafe = Handle
errHide = false,
errHide = false,
errNS = false,
errNS = false,
errDate = { en = "Bad ISO year (month)",
de = "ISO-Jahr (ggf. Monat) fehlerhaft" },
errInvalid = { en = "Invalid:",
errInvalid = { en = "Invalid:",
de = "Ungültig:" },
de = "Ungültig:" },
end
end
if unknown then
if unknown then
r = string.format( "'<code>%s</code>' in Template:%s",
local e = mw.html.create( "code" )
e:wikitext( table.concat( unknown, " " ) )
r = string.format( "'%s' in Template:%s",
tostring( e ), Config.scheme )
r = failed( "errUnkown", r )
r = failed( "errUnkown", r )
else
else
end
end
if URIutil[ "is" .. Config.showName ]( access ) then
if URIutil[ "is" .. Config.showName ]( access ) then
local suffer = args[ Config.parProblem ]
r = URIutil[ "link" .. Config.showName ]( access )
r = URIutil[ "link" .. Config.showName ]( access )
if Config.showArticle then
if Config.showArticle then
r = string.format( "%s:%s", Config.scheme, r )
r = string.format( "%s:%s", Config.scheme, r )
end
end
if args[ Config.parProblem ] then
if suffer and suffer ~= "" then
r = string.format( "%s <small>%s</small>",
local scan = "^(2[01]%d%d)(%-?[01]?%d?)$"
local s, sm = suffer:match( scan )
local e
if sm and sm ~= "" then
s = sm:match( "^%-([01]%d)$" )
if s then
local m = tonumber( s )
if m < 1 or m > 12 then
s = false
end
end
end
if s then
e = mw.html.create( "small" )
:wikitext( factory( "problemNote" ) )
r = string.format( "%s %s", r, tostring( e ) )
else
e = mw.html.create( "code" )
:wikitext( Config.parProblem .. "=" )
r = failed( "errDate", tostring( e ) )
end
end
end
else
else
Handle.main = function ( argsF, argsT )
-- Invocation; decide between first and secondary processing
-- Invocation; decide between first and secondary processing
-- argsF -- table, with #invoke parameters
-- argsF -- table, with #invoke parameters
end
end
return r
return r
end -- p.main()
end -- Handle.main()
Failsafe.failsafe = function ( atleast )
-- Retrieve versioning and check for compliance
-- Precondition:
-- atleast -- string, with required version or "wikidata" or "~"
-- or false
-- Postcondition:
-- Returns string -- with queried version, also if problem
-- false -- if appropriate
local last = ( atleast == "~" )
local since = atleast
local r
if last or since == "wikidata" then
local item = Failsafe.item
since = false
if type( item ) == "number" and item > 0 then
local entity = mw.wikibase.getEntity( string.format( "Q%d",
item ) )
if type( entity ) == "table" then
local vsn = entity:formatPropertyValues( "P348" )
if type( vsn ) == "table" and
type( vsn.value ) == "string" and
vsn.value ~= "" then
if last and vsn.value == Failsafe.serial then
r = false
else
r = vsn.value
end
end
end
end
end
if type( r ) == "nil" then
if not since or since <= Failsafe.serial then
r = Failsafe.serial
else
r = false
end
end
return r
end -- Failsafe.failsafe()
-- Export
local p = { }
p.f = function ( frame )
p.f = function ( frame )
local lucky, r
local lucky, r
Config.frame = frame
Config.frame = frame
lucky, r = pcall( p.main, frame.args, frame:getParent().args )
lucky, r = pcall( Handle.main, frame.args, frame:getParent().args )
if not lucky then
if not lucky then
r = Config.fault( string.format( "%s * %s",
r = Config.fault( string.format( "%s * %s",
end -- p.f()
end -- p.f()
p.failsafe = function ( frame )
-- Versioning interface
local s = type( frame )
local since
if s == "table" then
since = frame.args[ 1 ]
elseif s == "string" then
since = frame
end
if since then
since = mw.text.trim( since )
if since == "" then
since = false
end
end
return Failsafe.failsafe( since ) or ""
end -- p.failsafe()
p.Handle = function ()
-- Module interface
return Serial
return Handle
end -- p.failsafe()
end -- p.Handle()
return p
return p