Module:Format work/unsubst
| This module depends on the following other modules: |
This module is invoked by and only useful for {{format work}} |
Purpose
This module is only for use by {{format work}}, serving a similar function to Module:Unsubst, but correctly maintaining param order.
local function _isEmpty(value) return value == nil or value == '' end
local function _notEmpty(value) return not _isEmpty(value) end
local function _unnilify(value) return value or '' end
local function _alarmingMessage(message)
return '<span class="error">[[Module:Format work/unsubst]] '..message..'.</span>'
-- TODO ..'[[Category:Pages displaying alarming messages about Module:Format work/unsubst]]'
end
local function _main(args, body)
if not mw.isSubsting() then
return body or args.BODY or _alarmingMessage('is disembodied')
end
local label_distributor = ' |label= |distributor='
if _notEmpty(args.label) then
label_distributor = ' |label='..args.label
elseif _notEmpty(args.distributor) then
label_distributor = ' |distributor='..args.distributor
end
return '{{Format work'..
' |act='.. _unnilify(args.act)..
' |title='.._unnilify(args.title)..
' |type='.. _unnilify(args.type)..
label_distributor..
' |year='.. _unnilify(args.year)..
' |month='.._unnilify(args.month)..
' |day='.. _unnilify(args.day)..
' |notes='.._unnilify(args.notes)..
'}}'
end
local p = {}
function p.main(frame, body)
local args = require('Module:Arguments').getArgs(frame)
if _isEmpty(args) then
return _alarmingMessage('could not getArgs') -- This really would be alarming.
end
return _main(args, body)
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.