Modul:Vorlage:stolpersteine-berlin.de

Modul:Vorlage:stolpersteine-berlin.de

Die Dokumentation für dieses Modul kann unter Modul:Vorlage:stolpersteine-berlin.de/Doku erstellt werden

-- Modul:Vorlage:stolpersteine-berlin.de
-- Parametercheck [[Vorlage:stolpersteine-berlin.de]]
-- 2026-03-07



local faultID = function ( arg )
    local r = not  arg:match( "^[1-9]%d*$" )
    return r
end -- faultID()



local faultPfad = function ( arg )
    local s, s2 = arg:match( "^(.+)/(%l%l[%l%-]+%l%l)$" )
    if not s then
        s, s2 = arg:match( "^(.+)/(%l%l[%l%-]+%l%l%-0)$" )
    end
    if s then
        if s:find( "/", 5, true ) then
            s, s2 = s:match( "^(.+)/([1-9]%d*%-?%d*%l?)$" )
        end
        if s   and
           not ( s:match( "^%l%l[%l%d%-]+%l%l$" )  or 
                 s:match( "^%l%l[%l%d%-]+%l%l%-[1-9]%d*$" ) ) then
            s = false
        end
    end
    return  not s
end -- faultPfad()



-- Export
local p = { }

p.fault = function ( frame )
    local params = frame:getParent().args
    local sID    = params.ID
    local sPfad  = params.Pfad
    local r
    local s = mw.text.trim( frame.args[ 1 ]  or  "" )
    if sID == "" then
        sID = false
    end
    if sPfad == "" then
        sPfad = false
    end
    if sID then
        if faultID( sID ) then
            r = "ID"
        end
    end
    if sPfad then
        if faultPfad( sPfad ) then
            if r then
                r = "ID, Pfad"
            else
                r = "Pfad"
            end
        end
    end
    return r or ""
end -- p.fault

return p