Content deleted Content added
not needed |
rv to prev |
||
Line 1:
-- This module implements [[Template:Class mask]].
local p = {}
Line 7 ⟶ 9:
}
end
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
Line 39 ⟶ 45:
if args.ignorenamespace then
return nil
▲ end
return resolveExtraGrade('redirect',args)▼
end
local ns = title.namespace
if ns ==
return talkDefault
elseif ns ==
return resolveFQSgrade('file', args)
elseif ns ==
return resolveFQSgrade('category', args)
elseif ns ==
return resolveFQSgrade('portal', args)
elseif ns ==
return resolveFQSgrade('template', args)
elseif ns ==
return resolveFQSgrade('project', args)
elseif ns ==
return resolveFQSgrade('draft', args)
else
return 'NA'
Line 67 ⟶ 72:
-- We use string.lower here as it's faster than mw.ustring.lower and none
-- of the standard grades have non-Ascii characters.
grade = grade and trim(grade
local ret
-- Undefined
if not grade or grade == '¬' then
ret = '¬'
▲ elseif grade == '' then -- blank
-- Ucfirst
Line 143 ⟶ 148:
elseif grade == 'template' or grade == 'temp' or grade == 'tpl' or grade == 'templ' then
ret = resolveFQSgrade('template', args)
-- Book
ret = resolveExtraGrade('book', args)
-- FM
Line 153 ⟶ 162:
else
-- We can't guarantee that we will only have Ascii grades any more, so
-- normalize the grade again using mw.ustring where necessary.
local trimmedGrade = trim(args[1])
-- Upper-case syntax
ret = args[
-- Lower-case syntax
if not ret then
local normalizedGrade = mw.ustring.lower(grade)
▲ if args[grade:lower()] == 'yes' then
if args[normalizedGrade] == 'yes' then
ret = mw.language.getContentLanguage():ucfirst(
end
end
end▼
ret = resolveDefaultGrade(args, title)
end
Line 173 ⟶ 187:
function p._main(args, title)
title = title or mw.title.getCurrentTitle()
local docWarning = getDocWarning(title) or ''
local grade = getGrade(args, title) or ''
Line 180 ⟶ 194:
function p.main(frame)
end
|