GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • 首页
  • 分类索引
  • 特色内容
  • 新闻动态
  • 随机条目
  • 联络我们
  • 关于维基百科
  • 帮助
  • 维基社群
  • 编辑入门
  • 互助客栈
  • IRC即时聊天
  • 最近更改
  • 特殊页面

This view

  • Original page
  • New address

GeezerVison is showing zh.wikipedia.org — 模組:NoteTA - 维基百科,自由的百科全书

被永久保护的模块
模块文档[查看][编辑][历史][清除缓存]
此模块已评为穩定版,稳定可靠,可各处使用无误。已可在帮助页面和其他维基百科资源中提及,以帮助新用户学习。为降低服务器负载和错误输出,改善本模块前应进行沙盒测试,而不是重复的试错性编辑。
全保護此模块已被全保護。僅限管理員編輯。
移動保護此模块已被移動保護。僅限管理員移動。
警告此模块被引用於約393,000個頁面,佔全部頁面的5%。
為了避免造成大規模的影響,所有對此模块的編輯應先於沙盒或測試樣例上測試。实施修改前,建议先在討論頁發起討論。
模板引用數量會自動更新。

本模块用于执行{{NoteTA}}模板,请到模板页阅读具体用法。

上述文档嵌入自Module:NoteTA/doc。(编辑 | 历史)
编者可以在本模块的沙盒(编辑 | 差异)和测试样例(创建)页面进行实验。
本模块的子页面。

local z = {}
local WikitextLC = require( 'Module:WikitextLC' )
local mRedirect -- lazily initialized

local 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', args.T )
		:wikitext( WikitextLC.title( args.T ) )
	if args.dt ~= nil and args.dt ~= '' then
		div:attr( 'data-noteta-desc', args.dt )
	end
	return tostring( div )
end

local function processCGroupModule( name )
	local data = mw.loadData( 'Module:CGroup/' .. name )
	local pieces = {}
	if data.content then
		for i, v in ipairs( data.content ) do
			if v.type == 'item' and v.rule then
				table.insert( pieces, '-{H|' .. v.rule .. '}-' )
			end
		end
		return tostring( mw.html.create( 'div' )
			:attr( 'data-noteta-group-source', 'module' )
			:attr( 'data-noteta-group', data.name or name )
			:wikitext( table.concat( pieces ) ) )
	end
end

local function group( name, frame )
	if name == nil or name == '' then
		return ''
	end
	local moduleTitle = mw.title.makeTitle( 'Module', 'CGroup/' .. name )
	if moduleTitle and moduleTitle.exists then
		return processCGroupModule( name )
	end
	local templateTitle = mw.title.makeTitle( 'Template', 'CGroup/' .. name )
	if templateTitle and templateTitle.exists then
		if templateTitle.isRedirect then
			mRedirect = require( 'Module:Redirect' )
			local targetTitle = mw.title.new( tostring( mRedirect.getTarget( templateTitle ) ) )
			if targetTitle.nsText == 'Module' then
				return processCGroupModule( targetTitle.subpageText )
			else
				return frame:expandTemplate{ title = templateTitle }
			end
		else
			return frame:expandTemplate{ title = templateTitle }
		end
	end
	return tostring( mw.html.create( 'div' )
			:attr( 'data-noteta-group-source', 'none' )
			:attr( 'data-noteta-group', name ) )
end

local 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

local function local_( code, desc )
	if code == nil or code == '' then
		return ''
	end
	local div = mw.html.create( 'div' )
		:attr( 'data-noteta-code', code )
		:wikitext( WikitextLC.hidden( code ) )
	if desc ~= nil and desc ~= '' then
		div:attr( 'data-noteta-desc', desc )
	end
	return tostring( div )
end

local function Lcode( args )
	local code = {}
	for i = 1, 30 do
		table.insert( code, local_( 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
	if frame == mw.getCurrentFrame() then
		-- Being called from {{noteTA}}
		args = require('Module:Arguments').getArgs(frame)
	else
		-- Being called from another module
		args = frame
		frame = mw.getCurrentFrame()
	end
	local Tc = Tcode( args )
	local Gc = Gcode( args, frame )
	local Lc = Lcode( args )
	local code = Tc .. Gc .. Lc
	if code ~= '' then
		local hash = require( 'Module:Crc32lua' ).crc32( mw.dumpObject( args ) )
		code = frame:extensionTag{
			name = 'indicator',
			content = '[[File:Zh conversion icon m.svg|35px|本页使用了标题或全文手工转换|link=|class=skin-invert]]',
			args = { name = string.format( 'noteTA-%x', hash ) },
		} .. tostring( mw.html.create( 'div' )
				:attr( 'id', string.format( 'noteTA-%x', hash ) )
				:attr( 'class', 'noteTA' )
				:css( 'display', 'none' )
				:wikitext( code ) )
		if mw.title.getCurrentTitle():inNamespace( 'Template' ) then
			code = code .. '[[Category:放置于模板的noteTA]]'
		end
	end
	return code
end

return z
取自“https://zh.wikipedia.org/w/index.php?title=Module:NoteTA&oldid=95445558”
分类:
  • 通行模块
隐藏分类:
  • 被保护的模块
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.