Модуль:Песочница/Pok: различия между версиями

Нет описания правки
Нет описания правки
 
Строка 12: Строка 12:
     if not s then return s end
     if not s then return s end
     return (s:gsub("^%s*(.-)%s*$", "%1"))
     return (s:gsub("^%s*(.-)%s*$", "%1"))
end
local function ucfirst(s)
    if not s or s == "" then return s end
    return mw.ustring.upper(mw.ustring.sub(s, 1, 1)) .. mw.ustring.sub(s, 2)
end
end


Строка 45: Строка 50:
     end
     end
     return content
     return content
end
local function lcfirst(s)
    if not s or s == "" then return s end
    return string.lower(s:sub(1, 1)) .. (s:sub(2) or "")
end
end


Строка 308: Строка 308:
local function makeSourceLink(s)
local function makeSourceLink(s)
     local className =
     local className =
         (s.name .. s.name:sub(2)) ..
         (s.name:sub(1, 1):upper() .. s.name:sub(2)) ..
         (s.kind and (s.kind .. s.kind:sub(2)) or "")
         (s.kind and (s.kind:sub(1, 1):upper() .. s.kind:sub(2)) or "")


     local tplLabel = "Template:" .. s.tplPath
     local tplLabel = "Template:" .. s.tplPath
Строка 926: Строка 926:


     local function processEntity(kind, name, isStore)
     local function processEntity(kind, name, isStore)
         local pathName = lcfirst(name)
         local pathName = ucfirst(name)
         local tplPath = kind .. "/" .. pathName
         local tplPath = kind .. "/" .. pathName
         if isStore then
         if isStore then
Строка 1069: Строка 1069:


local function build_missing_template_error(kind, name, isStore, tplPath)
local function build_missing_template_error(kind, name, isStore, tplPath)
     local baseType = (kind and (kind .. kind:sub(2)) or "")
     local baseType = (kind and (kind:sub(1, 1):upper() .. kind:sub(2)) or "")
     local classType = baseType
     local classType = baseType
     if isStore then
     if isStore then