Module:TextCopy
Documentation for this module may be created at Module:TextCopy/doc
--
-- This module implements {{TextCopy}}
-- =p.main{text='testtext'}
--
require('Module:No globals')
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame, args)
if not args then
args = getArgs(frame)
mw.log('got args')
end
local root = mw.html.create('div')
root
:addClass('textcopyouter')
local fdiv = root:tag('div')
:addClass('copyleft')
:attr('id','text')
if args.text then
fdiv:wikitext(args.text)
else
fdiv:wikitext('no text given')
end
local sdiv = root:tag('div')
:addClass('textcopyright')
sdiv:tag('span')
:attr('onclick','textCopyStringToClipboard(this)')
:attr('role','button')
:wikitext('📋')
:addClass('textcopybutton')
return tostring(root)
end
return p