模块:Dict

来自希灵百科
Div2009讨论 | 贡献2020年5月10日 (日) 20:25的版本
跳转至: 导航搜索

模块说明

本模块数据存放在 模块:Dict/Data 当中,主要用于模板:可搬运目录


local p = {}

local getArgs = require("Module:Arguments").getArgs
local dictionary = mw.loadData("Module:Dict/Data")

function p.DictIndex(frame)

    local DictDate = {}
    local SerilNum = {"A","C","D","F","G","H"}
    --local SerilNum = {"A","C"}
    local res = ""
    local N = 0
    local Table_Begin = '\n{| class="table"  <br>'
    local Table_End = "\n|}"
    local Table_collapse = 'class=" mw-collapsible mw-collapsed" '

    res = res .. Table_Begin
    for a,SN  in pairs(SerilNum) do 
        res = res .."\n|- <br>"
        res = res .. '\n|  style="text-align:center; width: 25% "| ' .. SN ..'系列词条 || style="text-align:left; width: 75% "' .. Table_collapse ..'|'
        for b,list  in pairs(dictionary[SN]) do 

            res = res ..  b .. " [[" .. list .."]]  "
            N = N+1
            if N == 8 then
               res = res .." <br>"
               N = 0
            end

        end
             
            res = res .." <br>"
    end
    res = res .. Table_End

    return tostring(res)
end

return  p
为本页面评分: