コンテンツにスキップ

モジュール:Error

半永久的に保護されているモジュール
モジュールの giải thuyết[Biểu kỳ] [Biên tập] [Lí lịch] [キャッシュを phá khí]

このモジュールは "error" クラスのHTMLメッセージを tác thành します. {{error}}の trí hoán として tác thành されたモジュールであり, tường しい sử い phương についてはそちらをご tham chiếu ください.

-- This module implements {{error}}.

localp={}

localfunction_error(frame,args)
localtag=mw.ustring.lower(tostring(args.tag))

-- Work out what html tag we should use.
ifnot(tag=='p'ortag=='span'ortag=='div')then
tag='strong'
end

-- Generate the html.
localretval=frame:extensionTag{name='templatestyles',args={src='Module:Error/styles.css'}}
localerrortag=mw.html.create(tag)
:addClass('error')
:wikitext(tostring(args.messageorargs[1]orerror('エラーメッセージが chỉ định されていません',2)))
retval=retval..tostring(errortag)

returnretval
end

functionp.error(frame)
localargs
iftype(frame.args)=='table'then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
args=frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
args=frame
end
-- if the message parameter is present but blank, change it to nil so that Lua will
-- consider it false.
ifargs.message==""then
args.message=nil
end
return_error(frame,args)
end

returnp