跳转到内容
打开/关闭搜索
搜索
打开/关闭菜单
389
文件
1
用户
6086
编辑
Gal中文百科
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
在其他项目中
打开/关闭外观设置菜单
无法加载偏好设置。请检查您的网络连接并重试。
重试
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
讨论
贡献
创建账号
登录
编辑“︁
Module
:
ZyPy
”︁
来自Gal中文百科
查看
阅读
编辑源代码
查看历史
associated-pages
模块
讨论
更多操作
更多
工具
链入页面
相关更改
页面信息
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
local p = {} local getArgs = require('Module:Arguments').getArgs function p.main(frame) local args = getArgs(frame, { wrappers = 'Template:Zy' }) return p._main(args) end function p.nocat(frame) local args = getArgs(frame, { wrappers = 'Template:ZyPy' }) args.nocat = true return p._main(args) end function p._main(args) local pinyin = args[2] and mw.text.tag{ name = 'span', attrs = { lang = 'zh-Latn-pinyin' }, content = args[2] } local zhuyin = args[3] and mw.text.tag{ name = 'span', attrs = { lang = 'zh-Bopo' }, content = args[3] } local jyutping = args[4] and mw.text.tag{ name = 'span', attrs = { lang = 'yue-Latn-jyutping' }, content = args[4] } if not pinyin and not zhuyin then return args[1] end local ruby = mw.html.create('ruby'):addClass('zy') ruby:wikitext(args[1]) ruby:tag('rp'):wikitext('(') ruby:tag('rt'):wikitext(string.format( '-{zh-hans:%s;zh-hant:%s;zh-tw:%s;zh-hk:%s;}-', pinyin or zhuyin, -- zh-hans (zh-cn, zh-my, zh-sg, zh) pinyin or zhuyin, -- zh-hant zhuyin or pinyin, -- zh-tw jyutping or pinyin or zhuyin -- zh-hk (zh-mo) )) ruby:tag('rp'):wikitext(')') local rubyText = tostring(ruby) -- 仅在部分变体下注音 local v = args.v local t = { hans = 'tw', hant = 'cn' } if v and t[v] then rubyText = string.format( '-{zh-%s:-{zh;zh-hans;zh-hant|%s}-;zh-%s:%s;}-', v, rubyText, t[v], args[1] ) end if args.nocat then return rubyText end -- 维护分类 local getCategoryName = require('Module:Lang')._category_from_tag local result = { rubyText } if mw.title.getCurrentTitle().namespace == 0 then if pinyin then table.insert(result, '[[') table.insert(result, getCategoryName({ 'zh-Latn-pinyin' })) table.insert(result, ']]') end if zhuyin then table.insert(result, '[[') table.insert(result, getCategoryName({ 'zh-Bopo' })) table.insert(result, ']]') end -- 目前没有粤拼分类 -- if jyutping then -- table.insert(categories, '[[') -- table.insert(categories, getCategoryName({' yue-Latn-jyutping '})) -- table.insert(categories, ']]') -- end end local count = (pinyin and 1 or 0) + (zhuyin and 1 or 0) + (jyutping and 1 or 0) if count == 3 then table.insert(result, '[[Category:使用了三种注音方式的页面]]') elseif count == 2 then table.insert(result, '[[Category:使用了两种注音方式的页面]]') else table.insert(result, '[[Category:使用了一种注音方式的页面]]') end return table.concat(result) end return p
摘要:
请注意,所有对Gal中文百科的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Gal中文百科:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
此页面嵌入的页面:
Module:ZyPy/doc
(
编辑
)
编辑“︁
Module
:
ZyPy
”︁
来自Gal中文百科