Module:DecodeEncode

local p = {}

function _getBoolean( boolean_str ) -- from: module:String; adapted -- requires an explicit true local boolean_value

if type( boolean_str ) == 'string' then boolean_str = boolean_str:lower if boolean_str == 'true' or boolean_str == 'yes' or boolean_str == '1' then boolean_value = true else boolean_value = false end elseif type( boolean_str ) == 'boolean' then boolean_value = boolean_str else boolean_value = false end return boolean_value end

function p.decode( frame ) local s	local XMLonly

s = frame.args['s'] or '' XMLonly = _getBoolean(frame.args['XMLonly'] or false)

p._decode( s, XMLonly ) end

function p._decode( s, XMLonly ) local ret = nil;

local stext = 'unk' if XMLonly==nil then stext='nil' elseif XMLonly==false then stext='F' else stext='T' end

ret = mw.text.decode( s, not XMLonly ) .. ' (dbg: s: ' .. s .. ' XMLonly: ' .. stext ..')'

return ret end

function p.encode( frame ) local ret = textEncode-todo

return ret end

return p