Saltu al enhavo

Modulo:IsValidPageName

El Vikipedio, la libera enciklopedio
Dokumentado Dokumentado

Alvokata far {{Uzanto2}}.


Se vi havas demandon pri ĉi tiu Lua-modulo, tiam vi povas demandi en la diskutejo pri Lua-moduloj. La Intervikiaj ligiloj estu metataj al Vikidatumoj. (Vidu Helpopaĝon pri tio.)
-- Must NOT be "updated" with or reverted to versions from other wikis

local export = {}

function export.isValidPageName(xxframe)
  local strsftitle = xxframe.args[1]
  local tabtitleobject = {}
  local numnsoftheobject = 0
  local bootitlecxsafe = false -- preASSume guilt
  if (type(strsftitle)=='string') then
    tabtitleobject = mw.title.new(strsftitle) -- type "nil" for invalid
    if (type(tabtitleobject)=='table') then
      numnsoftheobject = tabtitleobject.namespace
      bootitlecxsafe = ((tabtitleobject.interwiki=='') and (numnsoftheobject>=0) and (numnsoftheobject~=6) and (tabtitleobject.prefixedText==strsftitle))
    end--if
  end--if
  if (bootitlecxsafe) then
    return 'valid'
  else
    return ''
  end--if
end

return export