模組:NoteTA/MediaWiki
外观
local z = {}
local WikitextLC = require( 'Module:WikitextLC' )
local NoteTA = require( 'Module:NoteTA' )
local function makeText( frame, v )
return mw.text.trim( frame:preprocess(v.text) ) .. '\n'
end
local function makeItem( frame, v )
local text = '* '
if v.original then
text = text .. '原文:' .. v.original .. ';'
end
return text .. '-{D|' .. v.rule .. '}-当前显示为:-{|' .. v.rule .. '}-\n'
end
function z.showdate( frame )
local data = require( 'Module:NoteTA/MediaWiki/code' )
local pieces = { '<strong>以下是[[Wikipedia:字詞轉換處理/公共轉換組|公共转换组]]“MediaWiki”。</strong>\n\n' }
for i, v in ipairs( data.content ) do
if v.type == 'text' then
table.insert( pieces, makeText( frame, v ) )
elseif v.type == 'item' then
table.insert( pieces, makeItem( frame, v ) )
end
end
table.insert( pieces, '[[Category:公共轉換組模板|' .. name .. ']]' )
return table.concat( pieces )
end
function z._main( args )
local Tc = NoteTA.Tcode( args )
--local Gc = NoteTA.Gcode( args, frame )
--==>不接受轉換組
local Gc
local Lc = NoteTA.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=]]',
args = { name = string.format( 'noteTA-%x', hash ) },
} .. tostring( mw.html.create( 'div' )
:attr( 'id', string.format( 'noteTA-%x', hash ) )
:attr( 'class', 'noteTA' )
:wikitext( code ) )
if mw.title.getCurrentTitle():inNamespace( 'Template' ) then
code = code .. '[[Category:放置于模板的noteTA]]'
end
end
return code
end