Content deleted Content added
Migrations-Version zur Umparametrisierung |
Migration zur Umparametrisierung abgeschlossen; keine Einbindungen mehr |
||
Line 1:
--[=[ TemplatePar 2013-
Template parameter utility
* check
Line 80:
[ "base64" ] = "^[A-Za-z0-9%+/]*$",
[ "base64+" ] = "^[A-Za-z0-9%+/]+$",
[ "aa" ] = "[%a%a].*[%a%a]",
[ "+" ] = "%S"
}
local patternCJK = false
local function containsCJK( s )
-- Is any CJK character present?
-- Precondition:
-- s -- string
-- Postcondition:
-- Return false iff no CJK present
-- Uses:
-- >< patternCJK
-- mw.ustring.char()
-- mw.ustring.match()
local r = false
if not patternCJK then
patternCJK = mw.ustring.char( 91,
end
if mw.ustring.match( s, patternCJK ) then
r = true
end
return r
end -- factory()
Line 118 ⟶ 145:
local function failsafe( story, scan )
-- Test for match (possibly user-defined with
-- Precondition:
-- story -- string; parameter value
Line 539 ⟶ 566:
-- mw.text.trim()
-- failsafe()
-- containsCJK()
local r = false
local s
Line 586 ⟶ 614:
if legal then
if not got then
got = containsCJK( story )
end
if not got then
seek = "'" .. seek .. "'"
r = failure( "invalid", seek, options )
end
end
else
Line 762 ⟶ 796:
-- form()
-- fill()
local options = { optional = { "
▲ "all",
"opt",
"cat",
Line 773 ⟶ 806:
local r = form( false, options )
if not r then
options = { mandatory = fill( frame.args.all
optional = fill( frame.args.opt
cat = frame.args.cat,
low = frame.args.low,
Line 819 ⟶ 852:
-- mw.text.trim()
-- TemplatePar.valid()
local options = { mandatory = { "1" },
optional = ▲ "all",
▲ "opt",
"cat",
"low",
Line 833 ⟶ 864:
local r = form( false, options )
if not r then
local s = mw.text.trim(
options = { cat = frame.args.cat,
low = frame.args.low,
Line 873 ⟶ 904:
r = finalize( r, options )
else
s =
r = TemplatePar.valid( s, options )
end
|