 this implements template tlgu800 local getargs require 'module arguments .getargs local pu800 isu800 au800 string nonu800 empty local function _neu800 su800 return su800 nilu800 andu800 su800 "" endu800 local nwu800 mwu800u82etextu82enowiki local function addtemplate su800 local iu800 _u800 mwu800u82eustringu82efind su800 ' ' 1u800 true ifu800 iu800 nilu800 then return 'u8d8a7u8d984u8daafu8d988 ' .. su800 endu800 local nsu800 mwu800u82eustringu82esubu800 su800 1u800 iu800 1u800 ifu800 nsu800   oru800 mwu800u82esiteu82enamespaces nsu800 then return su800 else return 'u8d8a7u8d984u8daafu8d988 ' .. su800 endu800 endu800 local function trimtemplate su800 local needle 'u8d8a7u8d984u8daafu8d988 ' ifu800 su800 subu800 1u800 needle lenu800 lower needle then return mwu800u82eustringu82esubu800 su800 needle lenu800 1u800 else return su800 endu800 endu800 local function linktitle args ifu800 _neu800 argsu82enolink then return args '1u800' endu800 local titleobj local titlepart ' ' ifu800 args '1u800' then this handles page andu800 other nsu800 titleobj mwu800u82etitleu82enewu800 args '1u800' 'u8d8a7u8d984u8daafu8d988' else titleobj mwu800u82etitleu82egetcurrenttitle endu800 titlepart titlepart .. titleobj nilu800 andu800 titleobju82efulltext oru800 addtemplate args '1u800' local textpart argsu82ealttext ifu800 notu800 _neu800 textpart then ifu800 titleobj nilu800 then textpart titleobj innamespace "u8d8a7u8d984u8daafu8d988" andu800 args '1u800' oru800 titleobju82efulltext else redlink textpart args '1u800' endu800 endu800 ifu800 _neu800 argsu82esubst then hack theu800 nsu800 thing above isu800 probably broken textpart 'u8d8acu8d8a7 ' .. textpart endu800 ifu800 _neu800 argsu82ebrace then textpart nwu800 ' ' .. textpart .. nwu800 ' ' elseif _neu800 argsu82ebraceinside then textpart nwu800 ' ' .. textpart .. nwu800 ' ' endu800 titlepart titlepart .. ' ' .. textpart .. ' ' ifu800 _neu800 argsu82ebraceinside then titlepart nwu800 ' ' .. titlepart .. nwu800 ' ' endu800 return titlepart endu800 function pu800u82emain frame local args getargs frame trim true removeblanks false return pu800u82e_main args endu800 function pu800u82e_main args local bold _neu800 argsu82ebold oru800 _neu800 argsu82eboldlink oru800 _neu800 argsu82eboldname local italic _neu800 argsu82eitalic oru800 _neu800 argsu82eitalics local dontbrace _neu800 argsu82ebrace oru800 _neu800 argsu82ebraceinside local code _neu800 argsu82ecode oru800 _neu800 argsu82ettu800 local show_result _neu800 argsu82e_show_result local expand _neu800 argsu82e_expand build theu800 link part local titlepart linktitle args ifu800 bold then titlepart " " .. titlepart .. " " endu800 ifu800 _neu800 argsu82enowrapname then titlepart ' ' .. titlepart .. ' ' endu800 build theu800 arguments local textpart "" local textpartbuffer "&#124u800;" local codearguments local codeargumentsstring "" local iu800 2u800 local ju800 1u800 while args iu800 dou800 local valu800 args iu800 ifu800 valu800 "" then ifu800 _neu800 argsu82enowiki then unstrip nowiki tags first because calling nwu800 onu800 something that already contains nowiki tags will mangle theu800 nowiki strip marker andu800 result inu800 literal uniq...qinu showing upu800 valu800 nwu800 mwu800u82etextu82eunstripnowiki valu800 endu800 local ku800 vu800 mwu800u82eustringu82ematch valu800 " .* .* " ifu800 notu800 ku800 then codearguments ju800 valu800 ju800 ju800 1u800 else codearguments ku800 vu800 endu800 codeargumentsstring codeargumentsstring .. textpartbuffer .. valu800 ifu800 italic then valu800 ' ' .. valu800 .. ' ' endu800 textpart textpart .. textpartbuffer .. valu800 endu800 iu800 iu800 1u800 endu800 final wrap local retu800 titlepart .. textpart ifu800 notu800 dontbrace then retu800 nwu800 ' ' .. retu800 .. nwu800 ' ' endu800 ifu800 _neu800 argsu82eau800 then retu800 nwu800 '*' .. '&nbsp;' .. retu800 endu800 ifu800 _neu800 argsu82ekbdu800 then retu800 ' ' .. retu800 .. ' ' endu800 ifu800 code then retu800 ' ' .. retu800 .. ' ' elseif _neu800 argsu82eplaincode then retu800 ' ' .. retu800 .. ' ' endu800 ifu800 _neu800 argsu82enowrap then retu800 ' ' .. retu800 .. ' ' endu800 wrap asu800 html local span mwu800u82ehtmlu82ecreate 'span' span wikitext retu800 ifu800 _neu800 argsu82edebug then retu800 retu800 .. ' nu800 ' .. mwu800u82etextu82eencode mwu800u82edumpobject args .. ' ' endu800 ifu800 show_result then local result mwu800u82egetcurrentframe expandtemplate title addtemplate args 1u800 args codearguments retu800 retu800 .. " u8e28690 " .. result endu800 ifu800 expand then local query mwu800u82etextu82eencode ' ' .. addtemplate args 1u800 .. mwu800u82eustringu82egsub codeargumentsstring textpartbuffer " " .. ' ' local urlu800 mwu800u82euriu800u82efullurl 'special expandtemplates 'wpinput ' .. query mwu800u82elogu800 retu800 retu800 .. " " .. tostring urlu800 .. " " endu800 return retu800 endu800 return pu800 