Difference between revisions of "Module:CodeWrapper"
Jump to navigation
Jump to search
(Created page with " function p.returnHTMLText(a) pageContent = tostring(mw.getCurrentFrame().args[1]) local div = mw.html.create( 'syntaxhighlight' ) div :attr( 'lang', 'HTML' ) :wi...") |
|||
Line 1: | Line 1: | ||
p = {} | |||
function p.returnHTMLText(a) | function p.returnHTMLText(a) |
Revision as of 06:47, 18 May 2022
Documentation for this module may be created at Module:CodeWrapper/doc
p = {}
function p.returnHTMLText(a)
pageContent = tostring(mw.getCurrentFrame().args[1])
local div = mw.html.create( 'syntaxhighlight' )
div
:attr( 'lang', 'HTML' )
:wikitext( pageContent )
return a:preprocess(tostring( div ))
end
function p.returnNowkiText(a)
pageContent = tostring(mw.getCurrentFrame().args[1])
local div = mw.html.create( 'nowiki' )
div
:wikitext( pageContent )
return a:preprocess(tostring( div ))
end
function p.luaSourceCodeText(a)
pageContent = tostring(mw.getCurrentFrame().args[1])
local div = mw.html.create( 'syntaxhighlight' )
div
:attr( 'lang', 'lua' )
:wikitext( pageContent )
return a:preprocess(tostring( div ))
end
function p.originalText(a)
return mw.getCurrentFrame().args[1]
end
function p.reverseResult(a)
str = mw.getCurrentFrame().args[1]
text = string.reverse(str)
return a:preprocess(text)
end
function p.reverse(a)
str = mw.getCurrentFrame().args[1]
text = string.reverse(str)
return text
end
function p.greek_letter()
cf = mw.getCurrentFrame()
-- aString = "<math>\\" .. mw.allToString(cf.args[1]) .. "</math>"
str = mw.getCurrentFrame().args[1]
aString = cf:preprocess("<math>\\"..str.."</math>")
return aString
end
function p.rawstring()
cf = mw.getCurrentFrame()
return mw.allToString(cf.args[1])
end