今天是2025年12月15日 第51周 星期一
代人,时大变了。
我们生活在大地上,但我们的梦想超越天空。
模块:NoteTA
wiki:zh>Liangent2014年6月7日 (六) 18:12的版本
| 本页面原先来自中文维基百科的模块:NoteTA,依照 CC BY-SA 3.0 授权被引入;原始贡献者的名字可以在这里看到。 经过双方编辑者的修改,本页面可能已与它的来源大不相同。 |
本模块用于执行{{NoteTA}}模板,请到模板页阅读具体用法。
| 上述文档嵌入自模块:NoteTA/doc。 (编辑 | 历史) 编者可以在本模块的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 本模块的子页面。 |
local z = {}
local WikitextLC = require( 'Module:WikitextLC' )
function Tcode( args )
if args.T == nil or args.T == '' then
return ''
end
local div = mw.html.create( 'div' )
:attr( 'class', 'noteTA-title' )
:attr( 'data-noteta-code', mw.uri.encode( args.T ) )
:wikitext( WikitextLC.title( args.T ) )
if args.dt ~= nil and args.dt ~= '' then
div:attr( 'data-noteta-desc', mw.uri.encode( args.dt ) )
end
return tostring( div )
end
function group( name, frame )
if name == nil or name == '' then
return ''
end
local title = mw.title.makeTitle( 'Template', 'CGroup/' .. name )
if title and title.exists then
return frame:expandTemplate{ title = title }
else
return tostring( mw.html.create( 'div' )
-- :attr( 'id', 'noteTA-group-' .. mw.uri.anchorEncode( name ) )
:attr( 'class', 'noteTA-missing' )
:attr( 'data-noteta-group', name ) )
end
end
function Gcode( args, frame )
local code = {}
for i = 1, 30 do
table.insert( code, group( args['G' .. i], frame ) )
end
code = table.concat( code )
if code ~= '' then
code = tostring( mw.html.create( 'div' )
:attr( 'class', 'noteTA-group' )
:wikitext( code ) )
if args.G31 ~= nil then
code = code .. '[[Category:NoteTA模板参数使用数量超过限制的页面|G]]'
end
end
return code
end
function local_( i, code, desc )
if code == nil or code == '' then
return ''
end
local div = mw.html.create( 'div' )
:attr( 'class', 'noteTA-local-' .. i )
:attr( 'data-noteta-code', mw.uri.encode( code ) )
:wikitext( WikitextLC.hidden( code ) )
if desc ~= nil and desc ~= '' then
div:attr( 'data-noteta-desc', mw.uri.encode( desc ) )
end
return tostring( div )
end
function Lcode( args )
local code = {}
for i = 1, 30 do
table.insert( code, local_( i, args[i], args['d' .. i] ) )
end
code = table.concat( code )
if code ~= '' then
code = tostring( mw.html.create( 'div' )
:attr( 'class', 'noteTA-local' )
:wikitext( code ) )
if args[31] ~= nil then
code = code .. '[[Category:NoteTA模板参数使用数量超过限制的页面|L]]'
end
end
return code
end
function z.main( frame )
local args = frame:getParent().args
local Tc = Tcode( args )
local Gc = Gcode( args, frame )
local Lc = Lcode( args )
local code = Tc .. Gc .. Lc
if code ~= '' then
code = frame:expandTemplate{
title = 'topicon',
args = {
class = 'noteTA-topicon',
image = 'Zh conversion icon m.svg',
alt = '本页使用了标题或全文手工转换',
title = '本页使用了标题或全文手工转换',
link = '',
size = '35px',
},
} .. tostring( mw.html.create( 'div' )
:attr( 'class', 'noteTA' )
:wikitext( code ) )
if mw.title.getCurrentTitle():inNamespace( 'Template' ) then
code = code .. '[[Category:放置于模板的noteTA]]'
end
end
return code
end
return z