查看“模块:你知道吗”的源代码
←
模块:你知道吗
跳转到导航
跳转到搜索
因为以下原因,你没有权限 编辑此页:
你请求的操作仅限属于此用户组的用户执行:
用户
你可以查看和复制此页面的源代码。
-- implements [[模板:你知道吗]] local p = { } local function get_facts_from(title) frame = mw.getCurrentFrame() str = frame:expandTemplate{title = title} facts = {} for s in str:gmatch("[^\r\n]+") do table.insert(facts, s) end return facts end local function pick_facts(all_facts, n) facts = {} repeat i = math.random(1, #all_facts) if facts[i] == nil then facts[i] = all_facts[i] n = n - 1 end until n == 0 return facts end function p.facts(frame) date = os.date("*t") math.randomseed(date.year * date.month * date.day) all_facts = get_facts_from("你知道吗/事实") facts = pick_facts(all_facts, frame.args[1] or 6) result = "" for _, v in pairs(facts) do result = result .. v .. "\n" end return result end return p
此页使用的模板:
模块:你知道吗/doc
(
查看源代码
)
返回
模块:你知道吗
。
导航菜单
个人工具
登录
命名空间
模块
讨论
English
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
批量上传文件
深色模式
工具
链入页面
相关更改
特殊页面
页面信息
获取短URL