第8行: |
第8行: |
| local div = mw.html.create( 'div' ) | | local div = mw.html.create( 'div' ) |
| :attr( 'class', 'noteTA-title' ) | | :attr( 'class', 'noteTA-title' ) |
− | :attr( 'data-noteta-code', mw.uri.encode( args.T ) ) | + | :attr( 'data-noteta-code', args.T ) |
| :wikitext( WikitextLC.title( args.T ) ) | | :wikitext( WikitextLC.title( args.T ) ) |
| if args.dt ~= nil and args.dt ~= '' then | | if args.dt ~= nil and args.dt ~= '' then |
− | div:attr( 'data-noteta-desc', mw.uri.encode( args.dt ) ) | + | div:attr( 'data-noteta-desc', args.dt ) |
| end | | end |
| return tostring( div ) | | return tostring( div ) |
第22行: |
第22行: |
| local moduleTitle = mw.title.makeTitle( 'Module', 'CGroup/' .. name ) | | local moduleTitle = mw.title.makeTitle( 'Module', 'CGroup/' .. name ) |
| if moduleTitle and moduleTitle.exists then | | if moduleTitle and moduleTitle.exists then |
− | local data = require( 'Module:CGroup/' .. name ) | + | local data = mw.loadData( 'Module:CGroup/' .. name ) |
| local pieces = {} | | local pieces = {} |
| if data.content then | | if data.content then |
第69行: |
第69行: |
| local div = mw.html.create( 'div' ) | | local div = mw.html.create( 'div' ) |
| -- :attr( 'id', 'noteTA-local-' .. i ) | | -- :attr( 'id', 'noteTA-local-' .. i ) |
− | :attr( 'data-noteta-code', mw.uri.encode( code ) ) | + | :attr( 'data-noteta-code', code ) |
| :wikitext( WikitextLC.hidden( code ) ) | | :wikitext( WikitextLC.hidden( code ) ) |
| if desc ~= nil and desc ~= '' then | | if desc ~= nil and desc ~= '' then |
− | div:attr( 'data-noteta-desc', mw.uri.encode( desc ) ) | + | div:attr( 'data-noteta-desc', desc ) |
| end | | end |
| return tostring( div ) | | return tostring( div ) |
第95行: |
第95行: |
| | | |
| function z.main( frame ) | | function z.main( frame ) |
− | local args = frame:getParent().args | + | local args |
| + | if frame == mw.getCurrentFrame() then |
| + | -- Being called from {{noteTA}} |
| + | args = frame:getParent().args |
| + | else |
| + | -- Being called from another module |
| + | args = frame |
| + | frame = mw.getCurrentFrame() |
| + | end |
| local Tc = Tcode( args ) | | local Tc = Tcode( args ) |
| local Gc = Gcode( args, frame ) | | local Gc = Gcode( args, frame ) |
第101行: |
第109行: |
| local code = Tc .. Gc .. Lc | | local code = Tc .. Gc .. Lc |
| if code ~= '' then | | if code ~= '' then |
− | local hash = code:len() | + | local hash = require( 'Module:Crc32lua' ).crc32( mw.dumpObject( args ) ) |
− | code = frame:expandTemplate{ | + | code = frame:extensionTag{ |
− | title = 'topicon', | + | name = 'indicator', |
− | args = { | + | content = '[[File:Zh conversion icon m.svg|35px| 本页使用了标题或全文手工转换|link=]]', |
− | id = 'noteTA-topicon-' .. hash,
| + | args = { name = string.format( 'noteTA-%x', hash ) }, |
− | class = 'noteTA-topicon',
| |
− | image = 'Zh conversion icon m.svg',
| |
− | alt = ' 本页使用了标题或全文手工转换',
| |
− | title = '本页使用了标题或全文手工转换',
| |
− | link = '',
| |
− | size = '35px',
| |
− | },
| |
| } .. tostring( mw.html.create( 'div' ) | | } .. tostring( mw.html.create( 'div' ) |
− | :attr( 'id', 'noteTA-' .. hash ) | + | :attr( 'id', string.format( 'noteTA-%x', hash ) ) |
| :attr( 'class', 'noteTA' ) | | :attr( 'class', 'noteTA' ) |
| :wikitext( code ) ) | | :wikitext( code ) ) |