Модуль:Unsubst: различия между версиями
sync from sandbox; see talk;
(+ параметр $format) |
(sync from sandbox; see talk;) |
||
| Строка 9: | Строка 9: | ||
['$aliases'] = 'parameter aliases', | ['$aliases'] = 'parameter aliases', | ||
['$flags'] = 'flags', | ['$flags'] = 'flags', | ||
['$ | ['$B'] = 'template content', | ||
['$ | ['$template-name'] = 'template invocation name override', | ||
} | } | ||
| Строка 48: | Строка 48: | ||
-- Find the invocation name. | -- Find the invocation name. | ||
local mTemplateInvocation = require('Module:Template invocation') | local mTemplateInvocation = require('Module:Template invocation') | ||
local name = mTemplateInvocation.name(frame:getParent():getTitle()) | local name | ||
if frame.args['$template-name'] and '' ~= frame.args['$template-name'] then | |||
name = frame.args['$template-name'] -- override whatever the template name is with this name | |||
else | |||
name = mTemplateInvocation.name(frame:getParent():getTitle()) | |||
end | |||
-- Combine passed args with passed defaults | -- Combine passed args with passed defaults | ||
local args = {} | local args = {} | ||
if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then | if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then | ||
for k, v in pairs( frame:getParent().args ) do | for k, v in pairs( frame:getParent().args ) do | ||
| Строка 60: | Строка 65: | ||
if not specialParams[k] then | if not specialParams[k] then | ||
if v == '__DATE__' then | if v == '__DATE__' then | ||
v = mw.getContentLanguage():formatDate( | v = mw.getContentLanguage():formatDate( 'F Y' ) | ||
end | end | ||
args[k] = v | args[k] = v | ||
| Строка 69: | Строка 74: | ||
if not specialParams[k] then | if not specialParams[k] then | ||
if v == '__DATE__' then | if v == '__DATE__' then | ||
v = mw.getContentLanguage():formatDate( | v = mw.getContentLanguage():formatDate( 'F Y' ) | ||
end | end | ||
args[k] = v | args[k] = v | ||