本站页面(多半)转载自
萌娘百科
的同名页面,依CC BY-NC-SA 3.0引入,贡献者可以在历史页查询。
因各种原因页面内容可能和源页面有所出入,
非本站特有页面内容请以萌娘百科为准
。此外,因萌百的api限制,本站部分页面和图片同步自
另一个镜像站
。
置顶公告:
【置顶】关于临时开启评论区所有功能的公告(2022.10.22)
|
【置顶】关于本站Widget恢复使用的公告
你好~!欢迎来到萌娘百科镜像站!
如需查看或编辑,请联系本站管理员注册账号。
本镜像站和其他萌娘百科的镜像站
无关
,请注意分别。
查看“Module:GF utils”的源代码
←
Module:GF utils
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
--[=[ 此模块包含[[少女前线]]相关模板使用的工具函数。 ]=] local ugsub = mw.ustring.gsub local format = string.format local utils = {} --- 为星级添加颜色。 function utils.colored_rarity(frame) local arg = assert(frame.args[1], '未提供参数') local rarity_color = { '#865c7d', '#777777', '#33566f', '#7b813f', '#a7753b', '#ad4229' } -- 3 -> '<span style="...">★★★</span>' -- 9 -> nil local function make_colored_rarity(rarity) local color = rarity_color[rarity] if not color then return nil end return format('<span style="color:%s">%s</span>', color, ('★'):rep(rarity)) end -- '3' -> <span style="...">★★★</span> -- '9' -> '9' local function colorize_number(str) return make_colored_rarity(tonumber(str)) or str end -- '★★★' -> <span style="...">★★★</span> -- '★★★★★★★★★' -> '★★★★★★★★★' local function colorize_star(start, str, stop) return make_colored_rarity(stop - start) or str end local out = arg:match('^%s*(.-)%s*$') -- 去首尾空白 out = out:gsub('%s*→%s*', ' → '):gsub('%s*->%s*', ' → ') -- 调整箭头 out = ugsub(out, '()(★+)()', colorize_star) out = out:gsub('%d+', colorize_number) return out end return utils
本页使用的模板:
Template:Documentation
(
查看源代码
)(仅允许管理员和巡查姬)
Template:Documentation/docname
(
查看源代码
)
Module:GF utils/doc
(
查看源代码
)
返回
Module:GF utils
。
导航菜单
个人工具
登录
命名空间
模块
讨论
English
已展开
已折叠
查看
阅读
查看源代码
查看历史
更多
已展开
已折叠
搜索
导航
首页
随机页面
最近更改
最新文件
萌娘原味图裤
讨论版
帮助
帮助
沙盒
Wiki入门
萌百编辑教程
编辑规范
萌娘百科政策
创建新条目
请求创建条目
常见问题集
分类索引
作品
人物
组织
概念用语
设定
软件
活动
工具
链入页面
相关更改
特殊页面
页面信息