<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://galbaike.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ANoteTA-lite</id>
	<title>Module:NoteTA-lite - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://galbaike.com/index.php?action=history&amp;feed=atom&amp;title=Module%3ANoteTA-lite"/>
	<link rel="alternate" type="text/html" href="https://galbaike.com/index.php?title=Module:NoteTA-lite&amp;action=history"/>
	<updated>2026-11-23T22:42:42Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://galbaike.com/index.php?title=Module:NoteTA-lite&amp;diff=3740&amp;oldid=prev</id>
		<title>imported&gt;Cwek：​关闭测试</title>
		<link rel="alternate" type="text/html" href="https://galbaike.com/index.php?title=Module:NoteTA-lite&amp;diff=3740&amp;oldid=prev"/>
		<updated>2026-07-06T03:15:43Z</updated>

		<summary type="html">&lt;p&gt;关闭测试&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local z = {}&lt;br /&gt;
local WikitextLC = require( &amp;#039;Module:WikitextLC&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
function Tcode( args )&lt;br /&gt;
	if args.T == nil or args.T == &amp;#039;&amp;#039; then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local div = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
		:attr( &amp;#039;class&amp;#039;, &amp;#039;noteTA-title&amp;#039; )&lt;br /&gt;
		:attr( &amp;#039;data-noteta-code&amp;#039;, args.T )&lt;br /&gt;
		:wikitext( WikitextLC.title( args.T ) )&lt;br /&gt;
	if args.dt ~= nil and args.dt ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		div:attr( &amp;#039;data-noteta-desc&amp;#039;, args.dt )&lt;br /&gt;
	end&lt;br /&gt;
	return tostring( div )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function group( name, frame )&lt;br /&gt;
	if name == nil or name == &amp;#039;&amp;#039; then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local moduleTitle = mw.title.makeTitle( &amp;#039;Module&amp;#039;, &amp;#039;CGroup/&amp;#039; .. name )&lt;br /&gt;
	if moduleTitle and moduleTitle.exists then&lt;br /&gt;
		local data = mw.loadData( &amp;#039;Module:CGroup/&amp;#039; .. name )&lt;br /&gt;
		local pieces = {}&lt;br /&gt;
		if data.content then&lt;br /&gt;
			local matched_indices = z.match_text_with_cgroup(mw.title.getCurrentTitle(), data.content)&lt;br /&gt;
			for i, v in ipairs( data.content ) do&lt;br /&gt;
				if matched_indices[i] and v.type == &amp;#039;item&amp;#039; and v.rule then&lt;br /&gt;
					table.insert( pieces, &amp;#039;-{H|&amp;#039; .. v.rule .. &amp;#039;}-&amp;#039; )&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return tostring( mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
				:attr( &amp;#039;data-noteta-group-source&amp;#039;, &amp;#039;module&amp;#039; )&lt;br /&gt;
				:attr( &amp;#039;data-noteta-group&amp;#039;, data.name or name )&lt;br /&gt;
				:wikitext( table.concat( pieces ) ) )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local templateTitle = mw.title.makeTitle( &amp;#039;Template&amp;#039;, &amp;#039;CGroup/&amp;#039; .. name )&lt;br /&gt;
	if templateTitle and templateTitle.exists then&lt;br /&gt;
		return frame:expandTemplate{ title = templateTitle }&lt;br /&gt;
	end&lt;br /&gt;
	return tostring( mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
			-- :attr( &amp;#039;id&amp;#039;, &amp;#039;noteTA-group-&amp;#039; .. mw.uri.anchorEncode( name ) )&lt;br /&gt;
			:attr( &amp;#039;data-noteta-group-source&amp;#039;, &amp;#039;none&amp;#039; )&lt;br /&gt;
			:attr( &amp;#039;data-noteta-group&amp;#039;, name ) )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Gcode( args, frame )&lt;br /&gt;
	local code = {}&lt;br /&gt;
	for i = 1, 30 do&lt;br /&gt;
		table.insert( code, group( args[&amp;#039;G&amp;#039; .. i], frame ) )&lt;br /&gt;
	end&lt;br /&gt;
	code = table.concat( code )&lt;br /&gt;
	if code ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		code = tostring( mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
				:attr( &amp;#039;class&amp;#039;, &amp;#039;noteTA-group&amp;#039; )&lt;br /&gt;
				:wikitext( code ) )&lt;br /&gt;
		if args.G31 ~= nil then&lt;br /&gt;
			code = code .. &amp;#039;[[Category:NoteTA模板参数使用数量超过限制的页面|G]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return code&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function local_( i, code, desc )&lt;br /&gt;
	if code == nil or code == &amp;#039;&amp;#039; then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local div = mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
		-- :attr( &amp;#039;id&amp;#039;, &amp;#039;noteTA-local-&amp;#039; .. i )&lt;br /&gt;
		:attr( &amp;#039;data-noteta-code&amp;#039;, code )&lt;br /&gt;
		:wikitext( WikitextLC.hidden( code ) )&lt;br /&gt;
	if desc ~= nil and desc ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		div:attr( &amp;#039;data-noteta-desc&amp;#039;, desc )&lt;br /&gt;
	end&lt;br /&gt;
	return tostring( div )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function Lcode( args )&lt;br /&gt;
	local code = {}&lt;br /&gt;
	for i = 1, 30 do&lt;br /&gt;
		table.insert( code, local_( i, args[i], args[&amp;#039;d&amp;#039; .. i] ) )&lt;br /&gt;
	end&lt;br /&gt;
	code = table.concat( code )&lt;br /&gt;
	if code ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		code = tostring( mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
				:attr( &amp;#039;class&amp;#039;, &amp;#039;noteTA-local&amp;#039; )&lt;br /&gt;
				:wikitext( code ) )&lt;br /&gt;
		if args[31] ~= nil then&lt;br /&gt;
			code = code .. &amp;#039;[[Category:NoteTA模板参数使用数量超过限制的页面|L]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return code&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function z.main( frame )&lt;br /&gt;
	local args&lt;br /&gt;
	if frame == mw.getCurrentFrame() then&lt;br /&gt;
		-- Being called from {{noteTA}}&lt;br /&gt;
		args = require(&amp;#039;Module:Arguments&amp;#039;).getArgs(frame)&lt;br /&gt;
	else&lt;br /&gt;
		-- Being called from another module&lt;br /&gt;
		args = frame&lt;br /&gt;
		frame = mw.getCurrentFrame()&lt;br /&gt;
	end&lt;br /&gt;
	local Tc = Tcode( args )&lt;br /&gt;
	local Gc = Gcode( args, frame )&lt;br /&gt;
	local Lc = Lcode( args )&lt;br /&gt;
	local code = Tc .. Gc .. Lc&lt;br /&gt;
	if code ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		local hash = require( &amp;#039;Module:Crc32lua&amp;#039; ).crc32( mw.dumpObject( args ) )&lt;br /&gt;
		code = frame:extensionTag{&lt;br /&gt;
			name = &amp;#039;indicator&amp;#039;,&lt;br /&gt;
			content = &amp;#039;[[File:Zh conversion icon m.svg|35px|本页使用了标题或全文手工转换|link=|class=skin-invert]]&amp;#039;,&lt;br /&gt;
			args = { name = string.format( &amp;#039;noteTA-%x&amp;#039;, hash ) },&lt;br /&gt;
		} .. tostring( mw.html.create( &amp;#039;div&amp;#039; )&lt;br /&gt;
				:attr( &amp;#039;id&amp;#039;, string.format( &amp;#039;noteTA-%x&amp;#039;, hash ) )&lt;br /&gt;
				:attr( &amp;#039;class&amp;#039;, &amp;#039;noteTA&amp;#039; )&lt;br /&gt;
				:wikitext( code ) )&lt;br /&gt;
		if mw.title.getCurrentTitle():inNamespace( &amp;#039;Template&amp;#039; ) then&lt;br /&gt;
			code = code .. &amp;#039;[[Category:放置于模板的noteTA]]&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return code&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- Construct a trie from CGroup rules for faster matching.&lt;br /&gt;
function z.build_trie(cgroup_content)&lt;br /&gt;
	local matchers = {}&lt;br /&gt;
	for index, content in ipairs(cgroup_content) do&lt;br /&gt;
		if content.type == &amp;#039;item&amp;#039; then&lt;br /&gt;
			-- check content.rule is null&lt;br /&gt;
			-- if content.rule == nil then mw.logObject(content,&amp;#039;NoteTA-lite:cgroup:build_trie:content.rule is null&amp;#039;) end&lt;br /&gt;
			&lt;br /&gt;
			for flag, full_rules in string.gmatch(&amp;#039;-{H|&amp;#039; .. content.rule .. &amp;#039;}-&amp;#039;, &amp;#039;%-{(.-)|(.-)}%-&amp;#039;) do -- 从 -{flag|full_rules}- 提取 flag 和 full_rules&lt;br /&gt;
				if flag == &amp;#039;-&amp;#039; then&lt;br /&gt;
					matchers[full_rules] = nil&lt;br /&gt;
				else&lt;br /&gt;
					for rules in string.gmatch(full_rules, &amp;#039;([^;]+)&amp;#039;) do&lt;br /&gt;
						local matcher = rules:match(&amp;quot;=&amp;gt;&amp;quot;) and rules:match(&amp;#039;^(.-)=&amp;gt;&amp;#039;) or rules:match(&amp;#039;^.-:(.+)&amp;#039;) -- 按 &amp;quot;;&amp;quot; 分割后，有 &amp;quot;=&amp;gt;&amp;quot; 就取前面的，没有就取第一个 &amp;quot;:&amp;quot; 后面的&lt;br /&gt;
						if matcher then&lt;br /&gt;
							mather_trimmed = mw.text.trim(matcher)&lt;br /&gt;
							matchers[mather_trimmed] = matchers[mather_trimmed] or {}&lt;br /&gt;
							table.insert(matchers[mather_trimmed], index)&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local trie = {}&lt;br /&gt;
	for matcher, index in pairs(matchers) do&lt;br /&gt;
		local current_node = trie&lt;br /&gt;
		for i = 1, #matcher do&lt;br /&gt;
    		local byte = matcher:sub(i,i)&lt;br /&gt;
			current_node[byte] = current_node[byte] or {}&lt;br /&gt;
			current_node = current_node[byte]&lt;br /&gt;
		end&lt;br /&gt;
		current_node.index = index&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return trie&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Match the content of an article against CGroup rules using a trie.&lt;br /&gt;
function z.match_text_with_cgroup(article_title, cgroup_content)&lt;br /&gt;
	local trie = z.build_trie(cgroup_content)&lt;br /&gt;
	local content = article_title:getContent()&lt;br /&gt;
	&lt;br /&gt;
	local matches = {}&lt;br /&gt;
    for start_pos = 1, #content do&lt;br /&gt;
        local current_node = trie&lt;br /&gt;
        local matched_index = nil&lt;br /&gt;
        for i = start_pos, #content do&lt;br /&gt;
            local byte = content:sub(i, i)&lt;br /&gt;
            current_node = current_node[byte]&lt;br /&gt;
            if not current_node then&lt;br /&gt;
                break&lt;br /&gt;
            end&lt;br /&gt;
            if current_node.index then&lt;br /&gt;
                matched_index = current_node.index&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        &lt;br /&gt;
        if matched_index then&lt;br /&gt;
        	for i = 1, #matched_index do&lt;br /&gt;
        		matches[matched_index[i]] = true&lt;br /&gt;
        	end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    return matches&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
return z&lt;/div&gt;</summary>
		<author><name>imported&gt;Cwek</name></author>
	</entry>
</feed>