×
新規記事を作成
ここにページのタイトルを記入:
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月13日 (月) 17:05時点におけるLiberalPolandball (トーク | 投稿記録)による版 (ページの作成:「local p = {} -- Return a blue noredirect wikilink for an existing page, a red wikilink for a non-existing page function p.noredirect(pagetitle, label) -- Evaluate pagetitle if pagetitle == nil or pagetitle == '' then return error('ページ名が指定されていません') end pagetitle = pagetitle:gsub('^%[*', ''):gsub('%]*$', '') -- Remove leading/trailing brackets to prevent errors pagetitle = pagetitle:gsub('_', ' ') -- Replace un…」)
    (差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)

    このモジュールについての説明文ページを モジュール:Noredirect/doc に作成できます

    local p = {}
    
    -- Return a blue noredirect wikilink for an existing page, a red wikilink for a non-existing page
    function p.noredirect(pagetitle, label)
    
        -- Evaluate pagetitle
        if pagetitle == nil or pagetitle == '' then
            return error('ページ名が指定されていません')
        end
        pagetitle = pagetitle:gsub('^%[*', ''):gsub('%]*$', '') -- Remove leading/trailing brackets to prevent errors
        pagetitle = pagetitle:gsub('_', ' ') -- Replace underscores with spaces because this variable will be used for the link's label
        pagetitle = pagetitle:gsub('^%s*', ''):gsub('%s*$', '') -- trim
        if pagetitle == '' then
            return error('ページ名が不正です')
        elseif pagetitle:find('[<>[%]{}|]') then
            return error('ページ名に使用できない記号が含まれています( < > [ ] { } | )')
        end
    
        -- Create link
        local title = mw.title.new(pagetitle)
        if label == nil or label == '' then
            label = pagetitle -- Don't use title.prefixedText here because the namespace alias (if the title contains any) is replaced by its canonical one
        end
        if title.exists then
            local link = '[' .. tostring(mw.uri.fullUrl(title.prefixedText, {redirect = 'no'})) .. ' ' .. label .. ']'
            link = '<span class="plainlinks">' .. link .. '</span>'
            return link
        else
            return '[[:' .. title.prefixedText .. '|' .. label .. ']]'
        end
    
    end
    
    -- Main package function
    function p.Main(frame)
        return p.noredirect(frame.args['1'], frame.args['2'])
    end
    
    return p