“模块:Dict”的版本间的差异
来自希灵百科
(创建页面,内容为“local p = {} local getArgs = require('Module:Arguments').getArgs local dictionary = mw.loadData('Module:Dict/Data') function p.DictIndex(frame) local DictDate...”) |
|||
(未显示同一用户的31个中间版本) | |||
第1行: | 第1行: | ||
local p = {} | local p = {} | ||
− | local getArgs = require( | + | local getArgs = require("Module:Arguments").getArgs |
− | local dictionary = mw.loadData( | + | local dictionary = mw.loadData("Module:Dict/Data") |
function p.DictIndex(frame) | function p.DictIndex(frame) | ||
local DictDate = {} | local DictDate = {} | ||
− | local SerilNum = {"A","C","D","F","G","H"," | + | local SerilNum = {"A","C","D","F","G","H"} |
− | + | --local SerilNum = {"A","C"} | |
+ | local res = "" | ||
+ | local N = 0 | ||
+ | local Table_Begin = '\n{| class="table" style="width: 100%" <br>' | ||
+ | local Table_End = "\n|}" | ||
+ | local Table_collapse = 'class=" mw-collapsible mw-collapsed" ' | ||
+ | res = res .. Table_Begin | ||
for a,SN in pairs(SerilNum) do | 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%" class="mw-collapsible mw-collapsed" |' | ||
for b,list in pairs(dictionary[SN]) do | for b,list in pairs(dictionary[SN]) do | ||
− | res = res .. | + | res = res .. b .. " [[" .. list .."]] " |
+ | N = N+1 | ||
+ | if N == 7 then | ||
+ | res = res .." <br>" | ||
+ | N = 0 | ||
+ | end | ||
end | end | ||
− | res = res .. | + | res = res .." <br>" |
end | end | ||
− | + | res = res .. Table_End | |
return tostring(res) | return tostring(res) |
2020年5月10日 (日) 20:40的最新版本
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" style="width: 100%" <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%" class="mw-collapsible mw-collapsed" |' for b,list in pairs(dictionary[SN]) do res = res .. b .. " [[" .. list .."]] " N = N+1 if N == 7 then res = res .." <br>" N = 0 end end res = res .." <br>" end res = res .. Table_End return tostring(res) end return p