יחידה:ParamValidator: הבדלים בין גרסאות בדף
Typo |
. |
||
| שורה 57: | שורה 57: | ||
]] | ]] | ||
} | } | ||
function empty( s ) | |||
return not s or type( s ) == 'string' and mw.text.trim( s ) == '' | |||
end | |||
function extract_options( frame ) | function extract_options( frame ) | ||
| שורה 62: | שורה 66: | ||
local args = frame.args | local args = frame.args | ||
local base = args.base or 'default' | local base = args.base or 'default' | ||
local options = mw.text.jsonDecode( args.options | local options | ||
if empty( args.options ) then | |||
options = {} | |||
else | |||
options = mw.text.jsonDecode( args.options ) | |||
end | |||
local base_options = mw.text.jsonDecode( inbuilt_options[base] or '{}' ) | local base_options = mw.text.jsonDecode( inbuilt_options[base] or '{}' ) | ||