WIKI公告栏
欢迎各位引航者访问卡拉彼丘WIKI,由于游客访问页面会有一定的页面旧版缓存,建议你登陆B站账号进行浏览,如果您觉得本WIKI有帮助到你,欢迎推荐给身边的引航者。
全站通知:

模块:勋章

来自卡拉彼丘WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:勋章/doc创建

local p = {}

local data = mw.loadData("Module:勋章/Data")

------勋章页面
p["勋章页面"] = function(frame)
  local Badgeget = frame.args[1]
  local keys = {}
  for key in pairs(data) do
    table.insert(keys, key)
  end
  -- 对键进行排序
  table.sort(keys, function(a, b)
    -- 比较套表中ID的值
    return data[a].ID < data[b].ID
  end)

  local resultList = {}
  for _, key in ipairs(keys) do
    local BadgeData = data[key]
    if string.find(BadgeData.Get, Badgeget, 1, true) then
      local Badgehtml = BadgeData.File .. "|'''<big>" .. key .. "</big>'''"
          .. frame:expandTemplate { title = '切换显示', args = { Badgeget .. "勋章介绍", "<br/>" .. BadgeData.Desc_string } }
          .. "<br/>'''获取方式:'''" .. BadgeData.Get
      table.insert(resultList, tostring(Badgehtml))
    end
  end
  local result = table.concat(resultList, "\n")
  return frame:preprocess('<gallery mode="packed">\n' .. result .. '\n</gallery>')
end


return p