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



    政治ボールwiki 日本語版

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

    -- This module implements {{anchor}}.
    
    local yesno = require('Module:Yesno')
    local getArgs = require('Module:Arguments').getArgs
    local compressSparseArray = require('Module:TableTools').compressSparseArray
    
    local p = {}
    
    function p.main(frame)
    	-- Get the positional arguments from #invoke and remove any nil values
    	local visible = yesno(frame.args.visible, false)
    	local args = getArgs(frame)
    	local argArray = compressSparseArray(args)
    
    	local ret = {}
    	for i, el in ipairs(argArray) do
    		local anchor = frame:callParserFunction('anchorencode', { el })
    		anchor = mw.text.decode(anchor, true)
    		if i == 1 and visible then
    			local display = string.gsub(anchor, '_', ' ')
    			table.insert(ret, display)
    		end
    		local node = mw.html.create('span')
    			:attr('class', 'anchor')
    			:attr('id', anchor)
    		table.insert(ret, tostring(node))
    	end
    
    	return table.concat(ret)
    end
    
    return p