LLWiki正在建设中,欢迎
加入我们
!
查看“︁Module:Photrans”︁的源代码
←
Module:Photrans
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local getArgs = require('module:arguments').getArgs local function main(args) local rb = args[1] local rt = args[2] local rt2 = args[3] local newrb = '' local newrt = '' if rt then local lrb = mw.ustring.len(rb) local lrt = mw.ustring.len(rt) local diff = lrt * 0.8 - lrb local space = '' local important = rt2 and '!important' or '' if diff > 0 then space = tostring(math.floor(diff / (lrb + 1) * 1000) / 1000)..'em' newrb = '<span style="margin-left:'..space..important..';letter-spacing:'..space..important..'">'..rb..'</span>' newrt = rt else space = tostring(math.floor(-diff / (lrt + 1) / 0.8 * 1000) / 1000)..'em' newrb = rb newrt = '<span style="margin-left:'..space..';letter-spacing:'..space..'">'..rt..'</span>' end else newrb = rb newrt = '<span class="photrans-s">'..rb..'</span>' end return newrb, newrt, rt2 end local function one(args) local rb = args[1] local rt = args[2] or ' ' local rt2 = args[3] return '<ruby><rb>'..rb..'</rb><rt'..(args[2] and '>' or ' class="photrans-s">').. (rt2 and rt or '<span>'..rt..'</span>')..'</rt></ruby>' end local function multi(arg) local fullrb = '' local fullrt = '' local flag = false local fullrt2 = '<span class="photrans-off">' for k, v in ipairs(arg) do local args = mw.text.split(v, '_') local newrb, newrt, rt2 = main(args) fullrb = fullrb..newrb fullrt = fullrt..newrt flag = flag or rt2 fullrt2 = fullrt2..(rt2 and newrt or '<span class="photrans-s">'..args[1]..'</span>') end fullrt2 = fullrt2..'</span>' return '<ruby><rb>'..fullrb..'</rb><rt><span>'..fullrt..'</span>'..(flag and fullrt2 or '')..'</rt></ruby>' end function p.main(frame) local args = getArgs(frame) if args[2] then return multi(args) else return one(mw.text.split(args[1], '_')) end end return p
该页面使用的模板:
Module:Photrans/doc
(
查看源代码
)
返回
Module:Photrans
。
导航菜单
个人工具
创建账号
登录
命名空间
模块
讨论
English
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
随机页面
最近更改
沙盒
互助客栈
方针与指引
帮助
工具
链入页面
相关更改
特殊页面
页面信息