×
新規記事を作成
ここにページのタイトルを記入:
We currently have 2 articles on ポリティボールwiki 日本語版. Type your article name above or click on one of the titles below and start writing!



    ポリティボールwiki 日本語版
    2026年7月11日 (土) 15:35時点におけるLiberalPolandball (トーク | 投稿記録)による版 (ページの作成:「-- This module implements {{error}}. local p = {} local function _error(frame, args) local tag = mw.ustring.lower(tostring(args.tag)) -- Work out what html tag we should use. if not (tag == 'p' or tag == 'span' or tag == 'div') then tag = 'strong' end -- Generate the html. local retval = frame:extensionTag{name = 'templatestyles', args = {src = 'Module:Error/styles.css'}} local errortag = mw.html.create(tag) :addCl…」)
    (差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)

    テンプレート:使用箇所の多いテンプレート テンプレート:Module rating テンプレート:Uses TemplateStyles このモジュールは"error"クラスのHTMLメッセージを作成します。{{error}}の置換として作成されたモジュールであり、詳しい使い方についてはそちらをご参照ください。 テンプレート:Sandbox other


    -- This module implements {{error}}.
    
    local p = {}
    
    local function _error(frame, args)
        local tag = mw.ustring.lower(tostring(args.tag))
    
        -- Work out what html tag we should use.
        if not (tag == 'p' or tag == 'span' or tag == 'div') then
            tag = 'strong'
        end
        
        -- Generate the html.
        local retval = frame:extensionTag{name = 'templatestyles', args = {src = 'Module:Error/styles.css'}}
        local errortag = mw.html.create(tag)
            :addClass('error')
            :wikitext(tostring(args.message or args[1] or error('エラーメッセージが指定されていません', 2)))
        retval = retval .. tostring(errortag)
    
        return retval
    end
    
    function p.error(frame)
        local args
        if type(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.
        if args.message == "" then
            args.message = nil
        end
        return _error(frame, args)
    end
    
    return p