模块:String2BulletedList:修订间差异

来自决策链云智库
无编辑摘要
 
(没有差异)

2023年7月25日 (二) 14:35的最新版本

可在模块:String2BulletedList/doc创建此模块的帮助文档

-- Module:StringSplit2BulletedList
local p = {}

function p.bulletedList(frame)
    -- Get the input string from the template
    local input = frame.args[1] or ''
    -- Get the prefix and suffix from the template
    local prefix = '{{Pcnodeoutput|'
    local suffix = '}}'

    -- Split the input string by space into a table
    local keywords = mw.text.split(input, ';%s*')

    -- Create the bulleted list from the table
    local list = mw.html.create('ul')
    for i, keyword in ipairs(keywords) do
        list:tag('li'):wikitext(prefix .. keyword .. suffix):done()
    end

    return tostring(list)
end

return p