模块:ZyPy
(重定向自Module:沙盒/Supergrey1/zy)
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame, {wrappers = 'Template:ZyPy'})
local ruby = mw.html.create('ruby'):css('text-align', 'justify'):css('text-justify', 'none')
local rb = ruby:tag('rb'):addClass('center'):wikitext(args[1])
local rpl = ruby:tag('rp'):css('user-select', 'none'):wikitext('(')
local zy = args[2]
if args[3] and args[4] then
zy = '-{zh-cn:' .. zy .. ';zh-tw:' .. args[3] .. ';zh-hk:' .. args[4] .. ';}-'
elseif args[3] then
zy = '-{zh-cn:' .. zy .. ';zh-tw:' .. args[3] .. ';}-'
end
local rt = ruby:tag('rt'):cssText('font-feature-settings: "ruby" 1; font-size: 90%; user-select: none;'):wikitext(zy)
local rpr = ruby:tag('rp'):css('user-select', 'none'):wikitext(')')
return ruby
end
return p