Follow TV Tropes

Following

History Tropers / STUART

Go To

OR

Is there an issue? Send a MessageReason:
None


@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@

to:

@@[= =][= =][= =][= =][={ =][={ 589, 1786, 585, 1781, 1785,=]@@

Added: 454

Changed: 163

Is there an issue? Send a MessageReason:
dammit, tv tropes


@@[= =][= =][= =][= =][="[[folder:%s]]\n%s\n[[/folder]]",=]@@

to:

@@[= =][= =][= =][= =][="[[folder:%s]]\n%s\n[[/folder]]",=]@@=][="[[folder:%s]]\n%s\n[[/folder]=]][=",=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape everything, and only fiddle with=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--what must be fiddled with=]@@
\\



@@[= =][= =][= =][= =][= =][= =][= =][= =][=--also split the folder controls, because hurf durf that ignores=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--non-formatting=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=string.gsub(escaped,"folder]=]][=","folder]=]=[=]][=")=]@@
\\



@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start of a line=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start _every single instance of a line=]@@more than two adjacent spaces_=]@@



@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@

to:

@@[= =][= =][= =][= =][=if not posted then print" print" Retrying..." end=]@@



@@[=push "Now without tokens appearing in the scripts themselves for safety"=]@@

to:

@@[=push "Now without tokens appearing in the scripts themselves for safety"=]@@"dammit, tv tropes"=]@@



@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@

to:

@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, =][={ 6641, 6644, 6643, 6638, 6639,=]@@



@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@

to:

@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, =][={ 6640, 6642, 6635, 6636, 6637,=]@@

Changed: 1233

Removed: 269

Is there an issue? Send a MessageReason:
Now without tokens appearing in the scripts themselves for safety


@@[=local urlencode=]=[={}=]@@

to:

@@[=local urlencode=]=[={}=]@@urlencode={}=]@@



@@[= =][= =][=str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@

to:

@@[= =][= =][=str =]=[= = string.gsub (str, "\r?\n", "\r\n")=]@@



@@[= =][= =][=str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@

to:

@@[= =][= =][=str =]=[= = string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
"([^%w%-%.%_%~ ])",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", ("%%%02X", string.byte(c)) end)=]@@



@@[=urlencode.string =]=[= encode=]@@

to:

@@[=urlencode.string =]=[= = encode=]@@



@@[= =][= =][=local argts, i=]=[= {}, 1=]@@

to:

@@[= =][= =][=local argts, i=]=[= i= {}, 1=]@@



@@[= =][= =][= =][= =][=argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=]=[=i+1=]@@

to:

@@[= =][= =][= =][= =][=argts[i=]][==]=[=encode(k).."=]=[="..=][=argts[i]=encode(k).."="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=]=[=i+1=]@@=][=i=i+1=]@@



@@[=local http =]=[= require"socket.http"=]@@

to:

@@[=local http =]=[= = require"socket.http"=]@@



@@[=local urlencode =]=[= require "urlencode"=]@@

to:

@@[=local urlencode =]=[= = require "urlencode"=]@@



@@[=local tvtropes=]=[={}=]@@

to:

@@[=local tvtropes=]=[={}=]@@tvtropes={}=]@@



@@[= =][= =][=assert(type(page)=]=[==]=[="string","Destination page name required")=]@@

to:

@@[= =][= =][=assert(type(page)=]=[==]=[="string","Destination =][=assert(type(page)=="string","Destination page name required")=]@@



@@[= =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page end=]@@

to:

@@[= =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page="Main/"..page end=]@@



@@[= =][= =][=page=]=[=fullname(page)=]@@

to:

@@[= =][= =][=page=]=[=fullname(page)=]@@=][=page=fullname(page)=]@@



@@[= =][= =][=assert(type(body)=]=[==]=[="string","Page body required")=]@@

to:

@@[= =][= =][=assert(type(body)=]=[==]=[="string","Page =][=assert(type(body)=="string","Page body required")=]@@



@@[= =][= =][=local response =]=[==]@@

to:

@@[= =][= =][=local response =]=[==]@@==]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=action=]=[="post", post=]=[="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=]=[=page, text=]=[=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=]=[=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=]=[=reason or ""=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=action=]=[="post", post=]=[="save",=]@@
=][=action="post", post="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=]=[=page, text=]=[=body,=]@@
=][=pagename=page, text=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=]=[=author =][=author=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=]=[=reason =][=reason=reason or ""=]@@



@@[= =][= =][=assert(response[1=]][=,response[2=]][=)=]@@

to:

@@[= =][= =][=assert(response[1=]][=,response[2=]][=)=]@@=][=assert(response[1],response[2])=]@@



@@[= =][= =][=if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@

to:

@@[= =][= =][=if tonumber(response[2=]][=)=]~[==]=[=302 tonumber(response[2])~=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@response[2], response[1]=]@@



@@[= =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@

to:

@@[= =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@= {quot='"', amp='&', lt='<', gt='>'}=]@@



@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@

to:

@@[= =][= =][= =][= =][=src=]=[=string.=][=src=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@=][=src=string.gsub(src,"&(%w-);",ents)=]@@



@@[= =][= =][=page=]=[=fullname(page)=]@@

to:

@@[= =][= =][=page=]=[=fullname(page)=]@@=][=page=fullname(page)=]@@



@@[= =][= =][=local body, code =]=[= http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=]=[=source')=]@@

to:

@@[= =][= =][=local body, code =]=[= = http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=]=[=source')=]@@'?action=source')=]@@



@@[=local tvtropes =]=[= require "tvtropes"=]@@

to:

@@[=local tvtropes =]=[= = require "tvtropes"=]@@



@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@

to:

@@[=local target =]=[= = "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@user="STUART"=]@@



@@[=local scripts=]=[={=]@@

to:

@@[=local scripts=]=[={=]@@scripts={=]@@



@@[= =][= =][= =][= =][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@

to:

@@[= =][= =][= =][= =][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@=][="[[folder:%s]]\n%s\n[[/folder]]",=]@@



@@[= =][= =][=local folders=]=[={=]@@
@@[= =][= =][= =][= =][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol=]][==]][="=]@@

to:

@@[= =][= =][=local folders=]=[={=]@@
folders={=]@@
@@[= =][= =][= =][= =][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@
=][="%%START".."SCRIPTS%%",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol=]][==]][="=]@@=][="[[foldercontrol]]"=]@@



@@[= =][= =][=local headers=]=[=#folders=]@@

to:

@@[= =][= =][=local headers=]=[=#folders=]@@headers=#folders=]@@



@@[= =][= =][=for i=]=[=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines=]=[={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) do=]@@

to:

@@[= =][= =][=for i=]=[=1, i=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines=]=[={}=]@@
slines={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) lines(scripts[i]) do=]@@



@@[= =][= =][= =][= =][= =][= =][=if line=]=[==]=[="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[='\\\\'=]@@

to:

@@[= =][= =][= =][= =][= =][= =][=if line=]=[==]=[="" line=="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[='\\\\'=]@@=][=slines[#slines+1]='\\\\'=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
=][=--split anything that would end the escaped region=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
escaped=string.gsub(line,"=]=[=]","=]=[=]=[=]=[=]")=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=]=[=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =]=[==]][=[=]=[=")=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=]=[=string.=][=escaped=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =]=[==]][=[=]=[=")=]@@=]=[=][=")=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@=][=slines[#slines+1]=string.format("@@[=%s=]=[=]@@",escaped)=]@@



@@[= =][= =][= =][= =][=local content=]=[=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@

to:

@@[= =][= =][= =][= =][=local content=]=[=table.content=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@=][=folders[i+headers]=scriptfolder(scripts[i],content)=]@@



@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@

to:

@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@=][=folders[#folders+1]="%%END".."SCRIPTS%%"=]@@



@@[= =][= =][=local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= =][= =][=local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@gssscripts=string.gsub(revsection(),"%%","%%%%")=]@@



@@[= =][= =][=print(string.format("Getting current version of =]%[=s...",target))=]@@

to:

@@[= =][= =][=print(string.format("Getting current version of =]%[=s...%s...",target))=]@@



@@[= =][= =][=local current=]=[=tvtropes.get(target)=]@@

to:

@@[= =][= =][=local current=]=[=tvtropes.current=tvtropes.get(target)=]@@



@@[= =][= =][=local updated=]=[=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@

to:

@@[= =][= =][=local updated=]=[=string.updated=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@=][="%%%%START".."SCRIPTS%%%%.-%%%%END".."SCRIPTS%%%%",=]@@



@@[= =][= =][=print(string.format("Posting new version of =]%[=s...",target))=]@@

to:

@@[= =][= =][=print(string.format("Posting new version of =]%[=s...%s...",target))=]@@



@@[= =][= =][= =][= =][=posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@

to:

@@[= =][= =][= =][= =][=posted=]=[=tvtropes.=][=posted=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" print" Retrying..." end=]@@



@@[=local tvtropes=]=[=require "tvtropes"=]@@

to:

@@[=local tvtropes=]=[=require tvtropes=require "tvtropes"=]@@



@@[=local urlencode=]=[=require "urlencode"=]@@

to:

@@[=local urlencode=]=[=require urlencode=require "urlencode"=]@@



@@[=adeps=]=[={=]@@

to:

@@[=adeps=]=[={=]@@@@[=adeps={=]@@



@@[=local tokens=]=[={}=]@@

to:

@@[=local tokens=]=[={}=]@@tokens={}=]@@



@@[= =][= =][=local disambigeps=]=[={=]@@

to:

@@[= =][= =][=local disambigeps=]=[={=]@@disambigeps={=]@@



@@[= =][= =][=local disambiguated=]=[={}=]@@
@@[= =][= =][=for s=]=[=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s=]][==]=[={}=]@@
@@[= =][= =][= =][= =][=for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@

to:

@@[= =][= =][=local disambiguated=]=[={}=]@@
disambiguated={}=]@@
@@[= =][= =][=for s=]=[=1,#disambigeps s=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s=]][==]=[={}=]@@
=][=disambiguated[s]={}=]@@
@@[= =][= =][= =][= =][=for i=]=[=1,#disambigeps[s=]][= i=1,#disambigeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@=][=disambiguated[s][disambigeps[s][i]]=true=]@@



@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s=]][=[e=]][= then=]@@

to:

@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.=][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.=][=pagename=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s=]][=[e=]][= disambiguated[s][e] then=]@@



@@[= =][= =][= =][= =][= =][= =][=pagename=]=[=pagename.."_(Arrested_Development)"=]@@

to:

@@[= =][= =][= =][= =][= =][= =][=pagename=]=[=pagename..=][=pagename=pagename.."_(Arrested_Development)"=]@@



@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@

to:

@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.=][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.=][=pagename=urlencode.string(pagename)=]@@



@@[= =][= =][=local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@

to:

@@[= =][= =][=local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 s1flips={ [5]=6, [6]=5, [7]=8, [8]=7, [16]=18, [17]=16, [18]=17 }=]@@



@@[= =][= =][= =][= =][=if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@

to:

@@[= =][= =][= =][= =][=if s=]=[==]=[=1 s==1 then e =]=[= s1flips[e=]][= = s1flips[e] or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@com/episode/%i%02i",s,e)=]@@



@@[= =][= =][=local ttnums=]=[={=]@@

to:

@@[= =][= =][=local ttnums=]=[={=]@@ttnums={=]@@



@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@

to:

@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@com/title/tt%07i/",ttnums[s][e])=]@@



@@[= =][= =][=local watchnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@

to:

@@[= =][= =][=local watchnums=]=[={=]@@
watchnums={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, =][={ 6641, 6644, 6643, 6638, 6639,=]@@



@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@

to:

@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, =][={ 6640, 6642, 6635, 6636, 6637,=]@@



@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@

to:

@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@com/watch/%i", watchnums[s][e])=]@@



@@[= =][= =][=local movieids=]=[={=]@@

to:

@@[= =][= =][=local movieids=]=[={=]@@movieids={=]@@



@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@

to:

@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@com/WiPlayer?movieid=%i",movieids[s][e])=]@@



@@[= =][= =][=local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@

to:

@@[= =][= =][=local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
template=[=[=]@@
@@[=%%STARTLINKS%%=]@@



@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@

to:

@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= Wikipedia]] -- [[$wikia Wikia=]][==]][= Wikia]] -- [[$theop Balboa Observer-Picayune=]][==]][= Observer-Picayune]] -- [[$imdb IMDB=]][==]][==]@@IMDB]]=]@@



@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@

to:

@@[=Watch now: [[$hulu Hulu=]][==]][= Hulu]] -- [[$netflix Netflix=]][==]][==]@@Netflix]]=]@@



@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@

to:

@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[=%%ENDLINKS%%=]@@
@@[=]=]=[=]=]@@



@@[= =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@

to:

@@[= =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) gsub(template,"%$(%w+)",function(token) return tokens[token=]][=(s,e) tokens[token](s,e) end))=]@@



@@[= =][= =][=local title=]=[=adeps[s=]][=[e=]][==]@@

to:

@@[= =][= =][=local title=]=[=adeps[s=]][=[e=]][==]@@title=adeps[s][e]=]@@



@@[= =][= =][=title=]=[=string.gsub(title,'é','e')=]@@

to:

@@[= =][= =][=title=]=[=string.=][=title=string.gsub(title,'é','e')=]@@



@@[= =][= =][=title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@

to:

@@[= =][= =][=title=]=[=string.=][=title=string.gsub(title,' (=]%[=l?)',string.(%l?)',string.upper)=]@@



@@[= =][= =][=title=]=[=string.gsub(title,'=]%[=W','')=]@@

to:

@@[= =][= =][=title=]=[=string.gsub(title,'=]%[=W','')=]@@=][=title=string.gsub(title,'%W','')=]@@



@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@

to:

@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@format("Recap/ArrestedDevelopmentS%iE%i%s",s,e,title)=]@@



@@[= =][= =][= =][= =][= =][= =][="\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@

to:

@@[= =][= =][= =][= =][= =][= =][="\n\n=]%[=s\n!The =][="\n\n%s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" \"%s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@=][=ad_ep_links(s,e),adeps[s][e]),=]@@



@@[= =][= =][= =][= =][=if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@

to:

@@[= =][= =][= =][= =][=if s=]=[==]=[=2 s==2 and e=]=[==]=[=3 e==3 then=]@@



@@[= =][= =][= =][= =][= =][= =][=local pagename=]=[=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= =][= =][= =][= =][= =][= =][=local pagename=]=[=recap_pagename(s,e)=]@@
pagename=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=]=[=tvtropes.pageasis=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= = string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@gsub(ad_ep_links(s,e),"%%","%%%%")=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= = tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@gsub(pageasis,"%%%%STARTLINKS%%%%.-%%%%ENDLINKS%%%%",gsubsafelinks),=]@@



@@[= =][= =][=for s=]=[=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=]=[=1,#adeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@

to:

@@[= =][= =][=for s=]=[=1,#adeps s=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=]=[=1,#adeps[s=]][= e=1,#adeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i %i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@%i, "%s"...',s,e,adeps[s][e]))=]@@
Is there an issue? Send a MessageReason:
Now without tokens appearing in the scripts themselves for safety

Added DiffLines:

[[foldercontrol]]

[[folder:urlencode.lua]]
@@[=local urlencode=]=[={}=]@@
\\
@@[=--URL encode a string.=]@@
@@[=local function encode(str)=]@@
@@[= =][= =][=--Ensure all newlines are in CRLF form=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= =][= =][=--Percent-encode all non-unreserved characters=]@@
@@[= =][= =][=--as per RFC 3986, Section 2.3=]@@
@@[= =][= =][=--(except for space, which gets plus-encoded)=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= =][= =][=--Convert spaces to plus signs=]@@
@@[= =][= =][=return string.gsub (str, " ", "+")=]@@
@@[=end=]@@
\\
@@[=--Make this function available as part of the module=]@@
@@[=urlencode.string =]=[= encode=]@@
\\
@@[=--URL encode a table as a series of parameters.=]@@
@@[=function urlencode.table(t)=]@@
@@[= =][= =][=--table of argument strings=]@@
@@[= =][= =][=local argts, i=]=[= {}, 1=]@@
@@[= =][= =][=for k, v in pairs(t) do=]@@
@@[= =][= =][= =][= =][=argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=]=[=i+1=]@@
@@[= =][= =][=end=]@@
@@[= =][= =][=return table.concat(argts,'&')=]@@
@@[=end=]@@
\\
@@[=return urlencode=]@@
[[/folder]]

[[folder:tvtropes.lua]]
@@[=--Required to send to TVTropes site.=]@@
@@[=local http =]=[= require"socket.http"=]@@
\\
@@[=--Required to create page post data.=]@@
@@[=local urlencode =]=[= require "urlencode"=]@@
\\
@@[=local tvtropes=]=[={}=]@@
\\
@@[=--Function that returns the authenticated TVTropes URL for the given page.=]@@
@@[=local function authpageurl(page)=]@@
@@[= =][= =][=return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
@@[=end=]@@
\\
@@[=local function fullname(page)=]@@
@@[= =][= =][=--Require pagename=]@@
@@[= =][= =][=assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= =][= =][=--If no namespace specified, assume Main=]@@
@@[= =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
\\
@@[= =][= =][=return page=]@@
@@[=end=]@@
\\
@@[=--Function that posts the given page.=]@@
@@[=function tvtropes.post(page, body, author, reason)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=assert(type(body)=]=[==]=[="string","Page body required")=]@@
\\
@@[= =][= =][=local response =]=[==]@@
@@[= =][= =][= =][= =][={http.request(authpageurl(page),=]@@
@@[= =][= =][= =][= =][= =][= =][=urlencode.table{=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=action=]=[="post", post=]=[="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=]=[=page, text=]=[=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=]=[=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=]=[=reason or ""=]@@
@@[= =][= =][= =][= =][= =][= =][=})}=]@@
\\
@@[= =][= =][=--Error on any socket errors=]@@
@@[= =][= =][=assert(response[1=]][=,response[2=]][=)=]@@
\\
@@[= =][= =][=--If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= =][= =][=--sometimes it just rejects the password for some reason.=]@@
@@[= =][= =][=if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@
@@[= =][= =][=else return true=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Technically, this is kind of a general function, but it's designed exclusively around=]@@
@@[=--TVTropes' source converter, so it's kept in here.=]@@
@@[=local html2plain=]@@
@@[=do=]@@
@@[= =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
\\
@@[= =][= =][=function html2plain(src)=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= =][= =][= =][= =][=return src=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that gets a given page source.=]@@
@@[=function tvtropes.get(page)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=local body, code =]=[= http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=]=[=source')=]@@
\\
@@[= =][= =][=--Trigger error on socket failure=]@@
@@[= =][= =][=assert(body,code)=]@@
\\
@@[= =][= =][=--Return the source converted back from the HTML conversion=]@@
@@[= =][= =][=return html2plain(body)=]@@
@@[=end=]@@
\\
@@[=return tvtropes=]@@
[[/folder]]

[[folder:tropersrepo.lua]]
@@[=--Script that posts the latest version of the TV Tropes=]@@
@@[=--scripts to my contributor page.=]@@
\\
@@[=--Any edit to the functionality of this script tends to generate=]@@
@@[=--about fifteen or 20 edits to the page: see ProximalErrorProbability.=]@@
\\
@@[=local tvtropes =]=[= require "tvtropes"=]@@
\\
@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@
\\
@@[=local scripts=]=[={=]@@
@@[= =][= =][="urlencode.lua",=]@@
@@[= =][= =][="tvtropes.lua",=]@@
@@[= =][= =][="tropersrepo.lua",=]@@
@@[= =][= =][="arrdev_recap.lua",=]@@
@@[=}=]@@
\\
@@[=local function scriptfolder(name,script)=]@@
@@[= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= =][= =][= =][= =][=name,script)=]@@
@@[=end=]@@
\\
@@[=local function revsection()=]@@
@@[= =][= =][=local folders=]=[={=]@@
@@[= =][= =][= =][= =][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol=]][==]][="=]@@
@@[= =][= =][=}=]@@
@@[= =][= =][=local headers=]=[=#folders=]@@
\\
@@[= =][= =][=for i=]=[=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines=]=[={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) do=]@@
\\
@@[= =][= =][= =][= =][= =][= =][=if line=]=[==]=[="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[='\\\\'=]@@
@@[= =][= =][= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--do I hate this? yes, I do.=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start of a line=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--to keep them from being folded on commit=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=]=[=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =]=[==]][=[=]=[=")=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=local content=]=[=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@
\\
@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\
@@[=local function push(notes)=]@@
@@[= =][= =][=local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
\\
@@[= =][= =][=print(string.format("Getting current version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local current=]=[=tvtropes.get(target)=]@@
\\
@@[= =][= =][=local updated=]=[=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= =][= =][= =][= =][=gssscripts)=]@@
\\
@@[= =][= =][=print(string.format("Posting new version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local posted=]@@
@@[= =][= =][=while not posted do=]@@
@@[= =][= =][= =][= =][=posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Executing code---------------------------------------------------------------=]@@
\\
@@[=push "Now without tokens appearing in the scripts themselves for safety"=]@@
\\
[[/folder]]

[[folder:arrdev_recap.lua]]
@@[=--encoding: UTF-8=]@@
\\
@@[=--Required to post pages=]@@
@@[=local tvtropes=]=[=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=]=[=require "urlencode"=]@@
\\
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps=]=[={=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="Pilot",=]@@
@@[= =][= =][= =][= =][="Top Banana",=]@@
@@[= =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= =][= =][= =][= =][="Key Decisions",=]@@
@@[= =][= =][= =][= =][="Visiting Ours",=]@@
@@[= =][= =][= =][= =][="Charity Drive",=]@@
@@[= =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= =][= =][= =][= =][="In God We Trust",=]@@
@@[= =][= =][= =][= =][="Storming the Castle",=]@@
@@[= =][= =][= =][= =][="Pier Pressure",=]@@
@@[= =][= =][= =][= =][="Public Relations",=]@@
@@[= =][= =][= =][= =][="Marta Complex",=]@@
@@[= =][= =][= =][= =][="Beef Consommé",=]@@
@@[= =][= =][= =][= =][="Shock and Aww",=]@@
@@[= =][= =][= =][= =][="Staff Infection",=]@@
@@[= =][= =][= =][= =][="Missing Kitty",=]@@
@@[= =][= =][= =][= =][="Altar Egos",=]@@
@@[= =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= =][= =][= =][= =][="¡Amigos!",=]@@
@@[= =][= =][= =][= =][="Good Grief",=]@@
@@[= =][= =][= =][= =][="Sad Sack",=]@@
@@[= =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= =][= =][= =][= =][="Switch Hitter",=]@@
@@[= =][= =][= =][= =][="Queen for a Day",=]@@
@@[= =][= =][= =][= =][="Burning Love",=]@@
@@[= =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= =][= =][= =][= =][="Out on a Limb",=]@@
@@[= =][= =][= =][= =][="Hand to God",=]@@
@@[= =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= =][= =][= =][= =][="Meat the Veals",=]@@
@@[= =][= =][= =][= =][="Spring Breakout",=]@@
@@[= =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The Cabin Show",=]@@
@@[= =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= =][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= =][= =][= =][= =][="Notapusy",=]@@
@@[= =][= =][= =][= =][="Mr. F",=]@@
@@[= =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= =][= =][= =][= =][="Prison Break-In",=]@@
@@[= =][= =][= =][= =][="Making a Stand",=]@@
@@[= =][= =][= =][= =][="S.O.B.s",=]@@
@@[= =][= =][= =][= =][="Fakin' It",=]@@
@@[= =][= =][= =][= =][="Family Ties",=]@@
@@[= =][= =][= =][= =][="Exit Strategy",=]@@
@@[= =][= =][= =][= =][="Development Arrested"=]@@
@@[= =][= =][=},=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens=]=[={}=]@@
\\
@@[=do --wikipedia=]@@
@@[= =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= =][= =][=local disambigeps=]=[={=]@@
@@[= =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--construct lookup table=]@@
@@[= =][= =][=local disambiguated=]=[={}=]@@
@@[= =][= =][=for s=]=[=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s=]][==]=[={}=]@@
@@[= =][= =][= =][= =][=for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s=]][=[e=]][= then=]@@
@@[= =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
\\
@@[=do --Balboa Observer-Picayune=]@@
@@[= =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= =][= =][=local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
\\
@@[= =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= =][= =][=function tokens.theop(s,e)=]@@
@@[= =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= =][= =][=--that I have to use you=]@@
@@[= =][= =][=local ttnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= =][= =][=function tokens.imdb(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Hulu, you know, just in case=]@@
@@[= =][= =][=local watchnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.hulu(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Netflix Watch Instantly=]@@
@@[= =][= =][=--It's largely sequential, but not quite.=]@@
@@[= =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= =][= =][=local movieids=]=[={=]@@
@@[= =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.netflix(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= =][= =][=local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
\\
@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= =][= =][=function ad_ep_links(s,e)=]@@
@@[= =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= =][= =][=--get the ep title=]@@
@@[= =][= =][=local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][=--replace the é in Beef Consommé=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'é','e')=]@@
@@[= =][= =][=--transform to CamelCased WikiWord=]@@
@@[= =][= =][=title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'=]%[=W','')=]@@
\\
@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
@@[=end=]@@
\\
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= =][= =][=return tvtropes.post(=]@@
@@[= =][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= =][= =][= =][= =][=string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= =][= =][= =][= =][="STUART",=]@@
@@[= =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
\\
@@[=local function update_links(reason)=]@@
@@[= =][= =][=return function(s,e)=]@@
@@[= =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][=local pagename=]=[=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= =][= =][= =][= =][= =][= =][=local success=]@@
@@[= =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=local function for_all_eps(f)=]@@
@@[= =][= =][=for s=]=[=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=]=[=1,#adeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= =][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Okay, put your executing commands down here.=]@@
[[/folder]]

Removed: 58909

Is there an issue? Send a MessageReason:
d'oh...


[[foldercontrol]]

[[folder:urlencode.lua]]
@@[=local urlencode=]=[={}=]@@
\\
@@[=--URL encode a string.=]@@
@@[=local function encode(str)=]@@
@@[= =][= =][=--Ensure all newlines are in CRLF form=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= =][= =][=--Percent-encode all non-unreserved characters=]@@
@@[= =][= =][=--as per RFC 3986, Section 2.3=]@@
@@[= =][= =][=--(except for space, which gets plus-encoded)=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= =][= =][=--Convert spaces to plus signs=]@@
@@[= =][= =][=return string.gsub (str, " ", "+")=]@@
@@[=end=]@@
\\
@@[=--Make this function available as part of the module=]@@
@@[=urlencode.string =]=[= encode=]@@
\\
@@[=--URL encode a table as a series of parameters.=]@@
@@[=function urlencode.table(t)=]@@
@@[= =][= =][=--table of argument strings=]@@
@@[= =][= =][=local argts, i=]=[= {}, 1=]@@
@@[= =][= =][=for k, v in pairs(t) do=]@@
@@[= =][= =][= =][= =][=argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=]=[=i+1=]@@
@@[= =][= =][=end=]@@
@@[= =][= =][=return table.concat(argts,'&')=]@@
@@[=end=]@@
\\
@@[=return urlencode=]@@
[[/folder]]

[[folder:tvtropes.lua]]
@@[=--Required to send to TVTropes site.=]@@
@@[=local http =]=[= require"socket.http"=]@@
\\
@@[=--Required to create page post data.=]@@
@@[=local urlencode =]=[= require "urlencode"=]@@
\\
@@[=local tvtropes=]=[={}=]@@
\\
@@[=--Function that returns the authenticated TVTropes URL for the given page.=]@@
@@[=local function authpageurl(page)=]@@
@@[= =][= =][=return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
@@[=end=]@@
\\
@@[=local function fullname(page)=]@@
@@[= =][= =][=--Require pagename=]@@
@@[= =][= =][=assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= =][= =][=--If no namespace specified, assume Main=]@@
@@[= =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
\\
@@[= =][= =][=return page=]@@
@@[=end=]@@
\\
@@[=--Function that posts the given page.=]@@
@@[=function tvtropes.post(page, body, author, reason)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=assert(type(body)=]=[==]=[="string","Page body required")=]@@
\\
@@[= =][= =][=local response =]=[==]@@
@@[= =][= =][= =][= =][={http.request(authpageurl(page),=]@@
@@[= =][= =][= =][= =][= =][= =][=urlencode.table{=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=action=]=[="post", post=]=[="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=]=[=page, text=]=[=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=]=[=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=]=[=reason or ""=]@@
@@[= =][= =][= =][= =][= =][= =][=})}=]@@
\\
@@[= =][= =][=--Error on any socket errors=]@@
@@[= =][= =][=assert(response[1=]][=,response[2=]][=)=]@@
\\
@@[= =][= =][=--If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= =][= =][=--sometimes it just rejects the password for some reason.=]@@
@@[= =][= =][=if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@
@@[= =][= =][=else return true=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Technically, this is kind of a general function, but it's designed exclusively around=]@@
@@[=--TVTropes' source converter, so it's kept in here.=]@@
@@[=local html2plain=]@@
@@[=do=]@@
@@[= =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
\\
@@[= =][= =][=function html2plain(src)=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= =][= =][= =][= =][=return src=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that gets a given page source.=]@@
@@[=function tvtropes.get(page)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=local body, code =]=[= http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=]=[=source')=]@@
\\
@@[= =][= =][=--Trigger error on socket failure=]@@
@@[= =][= =][=assert(body,code)=]@@
\\
@@[= =][= =][=--Return the source converted back from the HTML conversion=]@@
@@[= =][= =][=return html2plain(body)=]@@
@@[=end=]@@
\\
@@[=return tvtropes=]@@
[[/folder]]

[[folder:tropersrepo.lua]]
@@[=--Script that posts the latest version of the TV Tropes=]@@
@@[=--scripts to my contributor page.=]@@
\\
@@[=--Any edit to the functionality of this script tends to generate=]@@
@@[=--about fifteen or 20 edits to the page: see ProximalErrorProbability.=]@@
\\
@@[=local tvtropes =]=[= require "tvtropes"=]@@
\\
@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@
\\
@@[=local scripts=]=[={=]@@
@@[= =][= =][="urlencode.lua",=]@@
@@[= =][= =][="tvtropes.lua",=]@@
@@[= =][= =][="tropersrepo.lua",=]@@
@@[= =][= =][="arrdev_recap.lua",=]@@
@@[=}=]@@
\\
@@[=local function scriptfolder(name,script)=]@@
@@[= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= =][= =][= =][= =][=name,script)=]@@
@@[=end=]@@
\\
@@[=local function revsection()=]@@
@@[= =][= =][=local folders=]=[={=]@@
@@[= =][= =][= =][= =][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol=]][==]][="=]@@
@@[= =][= =][=}=]@@
@@[= =][= =][=local headers=]=[=#folders=]@@
\\
@@[= =][= =][=for i=]=[=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines=]=[={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) do=]@@
\\
@@[= =][= =][= =][= =][= =][= =][=if line=]=[==]=[="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[='\\\\'=]@@
@@[= =][= =][= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--do I hate this? yes, I do.=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start of a line=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--to keep them from being folded on commit=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=]=[=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =]=[==]][=[=]=[=")=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=local content=]=[=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@
\\
@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\
@@[=local function push(notes)=]@@
@@[= =][= =][=local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
\\
@@[= =][= =][=print(string.format("Getting current version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local current=]=[=tvtropes.get(target)=]@@
\\
@@[= =][= =][=local updated=]=[=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= =][= =][= =][= =][=gssscripts)=]@@
\\
@@[= =][= =][=print(string.format("Posting new version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local posted=]@@
@@[= =][= =][=while not posted do=]@@
@@[= =][= =][= =][= =][=posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Executing code---------------------------------------------------------------=]@@
\\
@@[=push "Now without tokens appearing in the scripts themselves for safety"=]@@
\\
[[/folder]]

[[folder:arrdev_recap.lua]]
@@[=--encoding: UTF-8=]@@
\\
@@[=--Required to post pages=]@@
@@[=local tvtropes=]=[=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=]=[=require "urlencode"=]@@
\\
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps=]=[={=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="Pilot",=]@@
@@[= =][= =][= =][= =][="Top Banana",=]@@
@@[= =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= =][= =][= =][= =][="Key Decisions",=]@@
@@[= =][= =][= =][= =][="Visiting Ours",=]@@
@@[= =][= =][= =][= =][="Charity Drive",=]@@
@@[= =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= =][= =][= =][= =][="In God We Trust",=]@@
@@[= =][= =][= =][= =][="Storming the Castle",=]@@
@@[= =][= =][= =][= =][="Pier Pressure",=]@@
@@[= =][= =][= =][= =][="Public Relations",=]@@
@@[= =][= =][= =][= =][="Marta Complex",=]@@
@@[= =][= =][= =][= =][="Beef Consommé",=]@@
@@[= =][= =][= =][= =][="Shock and Aww",=]@@
@@[= =][= =][= =][= =][="Staff Infection",=]@@
@@[= =][= =][= =][= =][="Missing Kitty",=]@@
@@[= =][= =][= =][= =][="Altar Egos",=]@@
@@[= =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= =][= =][= =][= =][="¡Amigos!",=]@@
@@[= =][= =][= =][= =][="Good Grief",=]@@
@@[= =][= =][= =][= =][="Sad Sack",=]@@
@@[= =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= =][= =][= =][= =][="Switch Hitter",=]@@
@@[= =][= =][= =][= =][="Queen for a Day",=]@@
@@[= =][= =][= =][= =][="Burning Love",=]@@
@@[= =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= =][= =][= =][= =][="Out on a Limb",=]@@
@@[= =][= =][= =][= =][="Hand to God",=]@@
@@[= =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= =][= =][= =][= =][="Meat the Veals",=]@@
@@[= =][= =][= =][= =][="Spring Breakout",=]@@
@@[= =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The Cabin Show",=]@@
@@[= =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= =][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= =][= =][= =][= =][="Notapusy",=]@@
@@[= =][= =][= =][= =][="Mr. F",=]@@
@@[= =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= =][= =][= =][= =][="Prison Break-In",=]@@
@@[= =][= =][= =][= =][="Making a Stand",=]@@
@@[= =][= =][= =][= =][="S.O.B.s",=]@@
@@[= =][= =][= =][= =][="Fakin' It",=]@@
@@[= =][= =][= =][= =][="Family Ties",=]@@
@@[= =][= =][= =][= =][="Exit Strategy",=]@@
@@[= =][= =][= =][= =][="Development Arrested"=]@@
@@[= =][= =][=},=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens=]=[={}=]@@
\\
@@[=do --wikipedia=]@@
@@[= =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= =][= =][=local disambigeps=]=[={=]@@
@@[= =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--construct lookup table=]@@
@@[= =][= =][=local disambiguated=]=[={}=]@@
@@[= =][= =][=for s=]=[=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s=]][==]=[={}=]@@
@@[= =][= =][= =][= =][=for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s=]][=[e=]][= then=]@@
@@[= =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
\\
@@[=do --Balboa Observer-Picayune=]@@
@@[= =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= =][= =][=local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
\\
@@[= =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= =][= =][=function tokens.theop(s,e)=]@@
@@[= =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= =][= =][=--that I have to use you=]@@
@@[= =][= =][=local ttnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= =][= =][=function tokens.imdb(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Hulu, you know, just in case=]@@
@@[= =][= =][=local watchnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.hulu(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Netflix Watch Instantly=]@@
@@[= =][= =][=--It's largely sequential, but not quite.=]@@
@@[= =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= =][= =][=local movieids=]=[={=]@@
@@[= =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.netflix(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= =][= =][=local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
\\
@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= =][= =][=function ad_ep_links(s,e)=]@@
@@[= =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= =][= =][=--get the ep title=]@@
@@[= =][= =][=local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][=--replace the é in Beef Consommé=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'é','e')=]@@
@@[= =][= =][=--transform to CamelCased WikiWord=]@@
@@[= =][= =][=title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'=]%[=W','')=]@@
\\
@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
@@[=end=]@@
\\
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= =][= =][=return tvtropes.post(=]@@
@@[= =][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= =][= =][= =][= =][=string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= =][= =][= =][= =][="STUART",=]@@
@@[= =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
\\
@@[=local function update_links(reason)=]@@
@@[= =][= =][=return function(s,e)=]@@
@@[= =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][=local pagename=]=[=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= =][= =][= =][= =][= =][= =][=local success=]@@
@@[= =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=local function for_all_eps(f)=]@@
@@[= =][= =][=for s=]=[=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=]=[=1,#adeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= =][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Okay, put your executing commands down here.=]@@
[[/folder]]

%%ENDSCRIPTS%%"=]@@
\\
@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\
@@[=local function push(notes)=]@@
@@[= =][= =][=local gssscripts=string.gsub(revsection(),"%%","%%%%")=]@@
\\
@@[= =][= =][=print(string.format("Getting current version of %s...",target))=]@@
\\
@@[= =][= =][=local current=tvtropes.get(target)=]@@
\\
@@[= =][= =][=local updated=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="%%%%STARTSCRIPTS%%

[[foldercontrol]]

[[folder:urlencode.lua]]
@@[=local urlencode=]=[={}=]@@
\\
@@[=--URL encode a string.=]@@
@@[=local function encode(str)=]@@
@@[= =][= =][=--Ensure all newlines are in CRLF form=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= =][= =][=--Percent-encode all non-unreserved characters=]@@
@@[= =][= =][=--as per RFC 3986, Section 2.3=]@@
@@[= =][= =][=--(except for space, which gets plus-encoded)=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= =][= =][=--Convert spaces to plus signs=]@@
@@[= =][= =][=return string.gsub (str, " ", "+")=]@@
@@[=end=]@@
\\
@@[=--Make this function available as part of the module=]@@
@@[=urlencode.string =]=[= encode=]@@
\\
@@[=--URL encode a table as a series of parameters.=]@@
@@[=function urlencode.table(t)=]@@
@@[= =][= =][=--table of argument strings=]@@
@@[= =][= =][=local argts, i=]=[= {}, 1=]@@
@@[= =][= =][=for k, v in pairs(t) do=]@@
@@[= =][= =][= =][= =][=argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=]=[=i+1=]@@
@@[= =][= =][=end=]@@
@@[= =][= =][=return table.concat(argts,'&')=]@@
@@[=end=]@@
\\
@@[=return urlencode=]@@
[[/folder]]

[[folder:tvtropes.lua]]
@@[=--Required to send to TVTropes site.=]@@
@@[=local http =]=[= require"socket.http"=]@@
\\
@@[=--Required to create page post data.=]@@
@@[=local urlencode =]=[= require "urlencode"=]@@
\\
@@[=local tvtropes=]=[={}=]@@
\\
@@[=--Function that returns the authenticated TVTropes URL for the given page.=]@@
@@[=local function authpageurl(page)=]@@
@@[= =][= =][=return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
@@[=end=]@@
\\
@@[=local function fullname(page)=]@@
@@[= =][= =][=--Require pagename=]@@
@@[= =][= =][=assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= =][= =][=--If no namespace specified, assume Main=]@@
@@[= =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
\\
@@[= =][= =][=return page=]@@
@@[=end=]@@
\\
@@[=--Function that posts the given page.=]@@
@@[=function tvtropes.post(page, body, author, reason)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=assert(type(body)=]=[==]=[="string","Page body required")=]@@
\\
@@[= =][= =][=local response =]=[==]@@
@@[= =][= =][= =][= =][={http.request(authpageurl(page),=]@@
@@[= =][= =][= =][= =][= =][= =][=urlencode.table{=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=action=]=[="post", post=]=[="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=]=[=page, text=]=[=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=]=[=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=]=[=reason or ""=]@@
@@[= =][= =][= =][= =][= =][= =][=})}=]@@
\\
@@[= =][= =][=--Error on any socket errors=]@@
@@[= =][= =][=assert(response[1=]][=,response[2=]][=)=]@@
\\
@@[= =][= =][=--If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= =][= =][=--sometimes it just rejects the password for some reason.=]@@
@@[= =][= =][=if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@
@@[= =][= =][=else return true=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Technically, this is kind of a general function, but it's designed exclusively around=]@@
@@[=--TVTropes' source converter, so it's kept in here.=]@@
@@[=local html2plain=]@@
@@[=do=]@@
@@[= =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
\\
@@[= =][= =][=function html2plain(src)=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= =][= =][= =][= =][=return src=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that gets a given page source.=]@@
@@[=function tvtropes.get(page)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=local body, code =]=[= http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=]=[=source')=]@@
\\
@@[= =][= =][=--Trigger error on socket failure=]@@
@@[= =][= =][=assert(body,code)=]@@
\\
@@[= =][= =][=--Return the source converted back from the HTML conversion=]@@
@@[= =][= =][=return html2plain(body)=]@@
@@[=end=]@@
\\
@@[=return tvtropes=]@@
[[/folder]]

[[folder:tropersrepo.lua]]
@@[=--Script that posts the latest version of the TV Tropes=]@@
@@[=--scripts to my contributor page.=]@@
\\
@@[=--Any edit to the functionality of this script tends to generate=]@@
@@[=--about fifteen or 20 edits to the page: see ProximalErrorProbability.=]@@
\\
@@[=local tvtropes =]=[= require "tvtropes"=]@@
\\
@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@
\\
@@[=local scripts=]=[={=]@@
@@[= =][= =][="urlencode.lua",=]@@
@@[= =][= =][="tvtropes.lua",=]@@
@@[= =][= =][="tropersrepo.lua",=]@@
@@[= =][= =][="arrdev_recap.lua",=]@@
@@[=}=]@@
\\
@@[=local function scriptfolder(name,script)=]@@
@@[= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= =][= =][= =][= =][=name,script)=]@@
@@[=end=]@@
\\
@@[=local function revsection()=]@@
@@[= =][= =][=local folders=]=[={=]@@
@@[= =][= =][= =][= =][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol=]][==]][="=]@@
@@[= =][= =][=}=]@@
@@[= =][= =][=local headers=]=[=#folders=]@@
\\
@@[= =][= =][=for i=]=[=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines=]=[={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) do=]@@
\\
@@[= =][= =][= =][= =][= =][= =][=if line=]=[==]=[="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[='\\\\'=]@@
@@[= =][= =][= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--do I hate this? yes, I do.=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start of a line=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--to keep them from being folded on commit=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=]=[=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =]=[==]][=[=]=[=")=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=local content=]=[=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@
\\
@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\
@@[=local function push(notes)=]@@
@@[= =][= =][=local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
\\
@@[= =][= =][=print(string.format("Getting current version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local current=]=[=tvtropes.get(target)=]@@
\\
@@[= =][= =][=local updated=]=[=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= =][= =][= =][= =][=gssscripts)=]@@
\\
@@[= =][= =][=print(string.format("Posting new version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local posted=]@@
@@[= =][= =][=while not posted do=]@@
@@[= =][= =][= =][= =][=posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Executing code---------------------------------------------------------------=]@@
\\
@@[=push "Now without tokens appearing in the scripts themselves for safety"=]@@
\\
[[/folder]]

[[folder:arrdev_recap.lua]]
@@[=--encoding: UTF-8=]@@
\\
@@[=--Required to post pages=]@@
@@[=local tvtropes=]=[=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=]=[=require "urlencode"=]@@
\\
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps=]=[={=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="Pilot",=]@@
@@[= =][= =][= =][= =][="Top Banana",=]@@
@@[= =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= =][= =][= =][= =][="Key Decisions",=]@@
@@[= =][= =][= =][= =][="Visiting Ours",=]@@
@@[= =][= =][= =][= =][="Charity Drive",=]@@
@@[= =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= =][= =][= =][= =][="In God We Trust",=]@@
@@[= =][= =][= =][= =][="Storming the Castle",=]@@
@@[= =][= =][= =][= =][="Pier Pressure",=]@@
@@[= =][= =][= =][= =][="Public Relations",=]@@
@@[= =][= =][= =][= =][="Marta Complex",=]@@
@@[= =][= =][= =][= =][="Beef Consommé",=]@@
@@[= =][= =][= =][= =][="Shock and Aww",=]@@
@@[= =][= =][= =][= =][="Staff Infection",=]@@
@@[= =][= =][= =][= =][="Missing Kitty",=]@@
@@[= =][= =][= =][= =][="Altar Egos",=]@@
@@[= =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= =][= =][= =][= =][="¡Amigos!",=]@@
@@[= =][= =][= =][= =][="Good Grief",=]@@
@@[= =][= =][= =][= =][="Sad Sack",=]@@
@@[= =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= =][= =][= =][= =][="Switch Hitter",=]@@
@@[= =][= =][= =][= =][="Queen for a Day",=]@@
@@[= =][= =][= =][= =][="Burning Love",=]@@
@@[= =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= =][= =][= =][= =][="Out on a Limb",=]@@
@@[= =][= =][= =][= =][="Hand to God",=]@@
@@[= =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= =][= =][= =][= =][="Meat the Veals",=]@@
@@[= =][= =][= =][= =][="Spring Breakout",=]@@
@@[= =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The Cabin Show",=]@@
@@[= =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= =][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= =][= =][= =][= =][="Notapusy",=]@@
@@[= =][= =][= =][= =][="Mr. F",=]@@
@@[= =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= =][= =][= =][= =][="Prison Break-In",=]@@
@@[= =][= =][= =][= =][="Making a Stand",=]@@
@@[= =][= =][= =][= =][="S.O.B.s",=]@@
@@[= =][= =][= =][= =][="Fakin' It",=]@@
@@[= =][= =][= =][= =][="Family Ties",=]@@
@@[= =][= =][= =][= =][="Exit Strategy",=]@@
@@[= =][= =][= =][= =][="Development Arrested"=]@@
@@[= =][= =][=},=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens=]=[={}=]@@
\\
@@[=do --wikipedia=]@@
@@[= =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= =][= =][=local disambigeps=]=[={=]@@
@@[= =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--construct lookup table=]@@
@@[= =][= =][=local disambiguated=]=[={}=]@@
@@[= =][= =][=for s=]=[=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s=]][==]=[={}=]@@
@@[= =][= =][= =][= =][=for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s=]][=[e=]][= then=]@@
@@[= =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
\\
@@[=do --Balboa Observer-Picayune=]@@
@@[= =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= =][= =][=local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
\\
@@[= =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= =][= =][=function tokens.theop(s,e)=]@@
@@[= =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= =][= =][=--that I have to use you=]@@
@@[= =][= =][=local ttnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= =][= =][=function tokens.imdb(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Hulu, you know, just in case=]@@
@@[= =][= =][=local watchnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.hulu(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Netflix Watch Instantly=]@@
@@[= =][= =][=--It's largely sequential, but not quite.=]@@
@@[= =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= =][= =][=local movieids=]=[={=]@@
@@[= =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.netflix(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= =][= =][=local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
\\
@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= =][= =][=function ad_ep_links(s,e)=]@@
@@[= =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= =][= =][=--get the ep title=]@@
@@[= =][= =][=local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][=--replace the é in Beef Consommé=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'é','e')=]@@
@@[= =][= =][=--transform to CamelCased WikiWord=]@@
@@[= =][= =][=title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'=]%[=W','')=]@@
\\
@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
@@[=end=]@@
\\
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= =][= =][=return tvtropes.post(=]@@
@@[= =][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= =][= =][= =][= =][=string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= =][= =][= =][= =][="STUART",=]@@
@@[= =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
\\
@@[=local function update_links(reason)=]@@
@@[= =][= =][=return function(s,e)=]@@
@@[= =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][=local pagename=]=[=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= =][= =][= =][= =][= =][= =][=local success=]@@
@@[= =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=local function for_all_eps(f)=]@@
@@[= =][= =][=for s=]=[=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=]=[=1,#adeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= =][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Okay, put your executing commands down here.=]@@
[[/folder]]

%%ENDSCRIPTS%%%%",=]@@
@@[= =][= =][= =][= =][=gssscripts)=]@@
\\
@@[= =][= =][=print(string.format("Posting new version of %s...",target))=]@@
\\
@@[= =][= =][=local posted=]@@
@@[= =][= =][=while not posted do=]@@
@@[= =][= =][= =][= =][=posted=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Executing code---------------------------------------------------------------=]@@
\\
@@[=push "bloody spaces"=]@@
\\
[[/folder]]

[[folder:arrdev_recap.lua]]
@@[=--encoding: UTF-8=]@@
\\
@@[=--Required to post pages=]@@
@@[=local tvtropes=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=require "urlencode"=]@@
\\
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps={=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="Pilot",=]@@
@@[= =][= =][= =][= =][="Top Banana",=]@@
@@[= =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= =][= =][= =][= =][="Key Decisions",=]@@
@@[= =][= =][= =][= =][="Visiting Ours",=]@@
@@[= =][= =][= =][= =][="Charity Drive",=]@@
@@[= =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= =][= =][= =][= =][="In God We Trust",=]@@
@@[= =][= =][= =][= =][="Storming the Castle",=]@@
@@[= =][= =][= =][= =][="Pier Pressure",=]@@
@@[= =][= =][= =][= =][="Public Relations",=]@@
@@[= =][= =][= =][= =][="Marta Complex",=]@@
@@[= =][= =][= =][= =][="Beef Consommé",=]@@
@@[= =][= =][= =][= =][="Shock and Aww",=]@@
@@[= =][= =][= =][= =][="Staff Infection",=]@@
@@[= =][= =][= =][= =][="Missing Kitty",=]@@
@@[= =][= =][= =][= =][="Altar Egos",=]@@
@@[= =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= =][= =][= =][= =][="¡Amigos!",=]@@
@@[= =][= =][= =][= =][="Good Grief",=]@@
@@[= =][= =][= =][= =][="Sad Sack",=]@@
@@[= =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= =][= =][= =][= =][="Switch Hitter",=]@@
@@[= =][= =][= =][= =][="Queen for a Day",=]@@
@@[= =][= =][= =][= =][="Burning Love",=]@@
@@[= =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= =][= =][= =][= =][="Out on a Limb",=]@@
@@[= =][= =][= =][= =][="Hand to God",=]@@
@@[= =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= =][= =][= =][= =][="Meat the Veals",=]@@
@@[= =][= =][= =][= =][="Spring Breakout",=]@@
@@[= =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The Cabin Show",=]@@
@@[= =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= =][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= =][= =][= =][= =][="Notapusy",=]@@
@@[= =][= =][= =][= =][="Mr. F",=]@@
@@[= =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= =][= =][= =][= =][="Prison Break-In",=]@@
@@[= =][= =][= =][= =][="Making a Stand",=]@@
@@[= =][= =][= =][= =][="S.O.B.s",=]@@
@@[= =][= =][= =][= =][="Fakin' It",=]@@
@@[= =][= =][= =][= =][="Family Ties",=]@@
@@[= =][= =][= =][= =][="Exit Strategy",=]@@
@@[= =][= =][= =][= =][="Development Arrested"=]@@
@@[= =][= =][=},=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens={}=]@@
\\
@@[=do --wikipedia=]@@
@@[= =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= =][= =][=local disambigeps={=]@@
@@[= =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--construct lookup table=]@@
@@[= =][= =][=local disambiguated={}=]@@
@@[= =][= =][=for s=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s]={}=]@@
@@[= =][= =][= =][= =][=for i=1,#disambigeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s][disambigeps[s][i]]=true=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s][e] then=]@@
@@[= =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=pagename=pagename.."_(Arrested_Development)"=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
\\
@@[=do --Balboa Observer-Picayune=]@@
@@[= =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= =][= =][=local s1flips={ [5]=6, [6]=5, [7]=8, [8]=7, [16]=18, [17]=16, [18]=17 }=]@@
\\
@@[= =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= =][= =][=function tokens.theop(s,e)=]@@
@@[= =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= =][= =][= =][= =][=if s==1 then e = s1flips[e] or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/%i%02i",s,e)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= =][= =][=--that I have to use you=]@@
@@[= =][= =][=local ttnums={=]@@
@@[= =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= =][= =][=function tokens.imdb(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt%07i/",ttnums[s][e])=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Hulu, you know, just in case=]@@
@@[= =][= =][=local watchnums={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.hulu(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/%i", watchnums[s][e])=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Netflix Watch Instantly=]@@
@@[= =][= =][=--It's largely sequential, but not quite.=]@@
@@[= =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= =][= =][=local movieids={=]@@
@@[= =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.netflix(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=%i",movieids[s][e])=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= =][= =][=local template=[=[=]@@
@@[=%%STARTLINKS%%=]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia]] -- [[$wikia Wikia]] -- [[$theop Balboa Observer-Picayune]] -- [[$imdb IMDB]]=]@@
\\
@@[=Watch now: [[$hulu Hulu]] -- [[$netflix Netflix]]=]@@
@@[=----=]@@
@@[=%%ENDLINKS%%=]@@
@@[=]=]=]@@
@@[= =][= =][=function ad_ep_links(s,e)=]@@
@@[= =][= =][= =][= =][=return (string.gsub(template,"%$(%w+)",function(token) return tokens[token](s,e) end))=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= =][= =][=--get the ep title=]@@
@@[= =][= =][=local title=adeps[s][e]=]@@
@@[= =][= =][=--replace the é in Beef Consommé=]@@
@@[= =][= =][=title=string.gsub(title,'é','e')=]@@
@@[= =][= =][=--transform to CamelCased WikiWord=]@@
@@[= =][= =][=title=string.gsub(title,' (%l?)',string.upper)=]@@
@@[= =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= =][= =][=title=string.gsub(title,'%W','')=]@@
\\
@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS%iE%i%s",s,e,title)=]@@
@@[=end=]@@
\\
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= =][= =][=return tvtropes.post(=]@@
@@[= =][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= =][= =][= =][= =][=string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="\n\n%s\n!The ''ArrestedDevelopment'' episode \"%s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s][e]),=]@@
@@[= =][= =][= =][= =][="STUART",=]@@
@@[= =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
\\
@@[=local function update_links(reason)=]@@
@@[= =][= =][=return function(s,e)=]@@
@@[= =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= =][= =][= =][= =][=if s==2 and e==3 then=]@@
@@[= =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][=local pagename=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks = string.gsub(ad_ep_links(s,e),"%%","%%%%")=]@@
@@[= =][= =][= =][= =][= =][= =][=local success=]@@
@@[= =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code = tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"%%%%STARTLINKS%%%%.-%%%%ENDLINKS%%%%",gsubsafelinks),=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=local function for_all_eps(f)=]@@
@@[= =][= =][=for s=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=1,#adeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season %i Episode %i, "%s"...',s,e,adeps[s][e]))=]@@
@@[= =][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Okay, put your executing commands down here.=]@@
[[/folder]]
Is there an issue? Send a MessageReason:
Now without tokens appearing in the scripts themselves for safety


@@[= =][= =][= =][= =][="=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@

to:

@@[= =][= =][= =][= =][="=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@=][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@



@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@

to:

@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@=][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@



@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@

to:

@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@=][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@



@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@

to:

@@[= =][= =][= =][= =][=if not posted then print" print" Retrying..." end=]@@



@@[=push "bloody spaces"=]@@

to:

@@[=push "bloody spaces"=]@@"Now without tokens appearing in the scripts themselves for safety"=]@@



@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@

to:

@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, =][={ 6641, 6644, 6643, 6638, 6639,=]@@



@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@

to:

@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, =][={ 6640, 6642, 6635, 6636, 6637,=]@@



@@[= =][= =][= =][= =][="=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@

to:

@@[= =][= =][= =][= =][="=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@=][="=]%[==]%[=START".."SCRIPTS=]%[==]%[=",=]@@



@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@

to:

@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@=][=folders[#folders+1=]][==]=[="=]%[==]%[=END".."SCRIPTS=]%[==]%[="=]@@



@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@

to:

@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@=][="=]%[==]%[==]%[==]%[=START".."SCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=END".."SCRIPTS=]%[==]%[==]%[==]%[=",=]@@



@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@

to:

@@[= =][= =][= =][= =][=if not posted then print" print" Retrying..." end=]@@



@@[=push "bloody spaces"=]@@

to:

@@[=push "bloody spaces"=]@@"Now without tokens appearing in the scripts themselves for safety"=]@@



@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@

to:

@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, =][={ 6641, 6644, 6643, 6638, 6639,=]@@



@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@

to:

@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, =][={ 6640, 6642, 6635, 6636, 6637,=]@@

Added: 36594

Changed: 1179

Is there an issue? Send a MessageReason:
bloody spaces


@@[=local urlencode={}=]@@

to:

@@[=local urlencode={}=]@@urlencode=]=[={}=]@@



@@[= =][= =][=str = string.gsub (str, "\r?\n", "\r\n")=]@@

to:

@@[= =][= =][=str = =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@



@@[= =][= =][=str = string.gsub (str, "([^%w%-%.%_%~ ])",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("%%%02X", string.byte(c)) end)=]@@

to:

@@[= =][= =][=str = =]=[= string.gsub (str, "([^%w%-%.%_%~ ])",=]@@
"([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("%%%02X", ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@



@@[=urlencode.string = encode=]@@

to:

@@[=urlencode.string = =]=[= encode=]@@



@@[= =][= =][=local argts, i= {}, 1=]@@

to:

@@[= =][= =][=local argts, i= i=]=[= {}, 1=]@@



@@[= =][= =][= =][= =][=argts[i]=encode(k).."="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=i+1=]@@

to:

@@[= =][= =][= =][= =][=argts[i]=encode(k).."="..=][=argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=i+1=]@@=][=i=]=[=i+1=]@@



@@[=local http = require"socket.http"=]@@

to:

@@[=local http = =]=[= require"socket.http"=]@@



@@[=local urlencode = require "urlencode"=]@@

to:

@@[=local urlencode = =]=[= require "urlencode"=]@@



@@[=local tvtropes={}=]@@

to:

@@[=local tvtropes={}=]@@tvtropes=]=[={}=]@@



@@[= =][= =][=assert(type(page)=="string","Destination page name required")=]@@

to:

@@[= =][= =][=assert(type(page)=="string","Destination =][=assert(type(page)=]=[==]=[="string","Destination page name required")=]@@



@@[= =][= =][=if not string.find(page,'/') then page="Main/"..page end=]@@

to:

@@[= =][= =][=if not string.find(page,'/') then page="Main/"..page=]=[="Main/"..page end=]@@



@@[= =][= =][=page=fullname(page)=]@@

to:

@@[= =][= =][=page=fullname(page)=]@@=][=page=]=[=fullname(page)=]@@



@@[= =][= =][=assert(type(body)=="string","Page body required")=]@@

to:

@@[= =][= =][=assert(type(body)=="string","Page =][=assert(type(body)=]=[==]=[="string","Page body required")=]@@



@@[= =][= =][=local response ==]@@

to:

@@[= =][= =][=local response ==]@@=]=[==]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=action="post", post="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=page, text=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=reason or ""=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=action="post", post="save",=]@@
=][=action=]=[="post", post=]=[="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=page, text=body,=]@@
=][=pagename=]=[=page, text=]=[=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=author =][=author=]=[=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=reason =][=reason=]=[=reason or ""=]@@



@@[= =][= =][=assert(response[1],response[2])=]@@

to:

@@[= =][= =][=assert(response[1],response[2])=]@@=][=assert(response[1=]][=,response[2=]][=)=]@@



@@[= =][= =][=if tonumber(response[2])~=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2], response[1]=]@@

to:

@@[= =][= =][=if tonumber(response[2])~=302 tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2], response[1]=]@@response[2=]][=, response[1=]][==]@@



@@[= =][= =][=local ents = {quot='"', amp='&', lt='<', gt='>'}=]@@

to:

@@[= =][= =][=local ents = {quot='"', amp='&', lt='<', gt='>'}=]@@=]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@



@@[= =][= =][= =][= =][=src=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=string.gsub(src,"&(%w-);",ents)=]@@

to:

@@[= =][= =][= =][= =][=src=string.=][=src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=string.gsub(src,"&(%w-);",ents)=]@@=][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@



@@[= =][= =][=page=fullname(page)=]@@

to:

@@[= =][= =][=page=fullname(page)=]@@=][=page=]=[=fullname(page)=]@@



@@[= =][= =][=local body, code = http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=source')=]@@

to:

@@[= =][= =][=local body, code = =]=[= http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=source')=]@@'?action=]=[=source')=]@@



@@[=local tvtropes = require "tvtropes"=]@@

to:

@@[=local tvtropes = =]=[= require "tvtropes"=]@@



@@[=local target = "Tropers/STUART"=]@@
@@[=local user="STUART"=]@@

to:

@@[=local target = =]=[= "Tropers/STUART"=]@@
@@[=local user="STUART"=]@@user=]=[="STUART"=]@@



@@[=local scripts={=]@@

to:

@@[=local scripts={=]@@scripts=]=[={=]@@



@@[= =][= =][= =][= =][="[[folder:%s]]\n%s\n[[/folder]]",=]@@

to:

@@[= =][= =][= =][= =][="[[folder:%s]]\n%s\n[[/folder]]",=]@@=][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@



@@[= =][= =][=local folders={=]@@
@@[= =][= =][= =][= =][="%%STARTSCRIPTS%%",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol]]"=]@@

to:

@@[= =][= =][=local folders={=]@@
folders=]=[={=]@@
@@[= =][= =][= =][= =][="%%STARTSCRIPTS%%",=]@@
=][="=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol]]"=]@@=][="[[foldercontrol=]][==]][="=]@@



@@[= =][= =][=local headers=#folders=]@@

to:

@@[= =][= =][=local headers=#folders=]@@headers=]=[=#folders=]@@



@@[= =][= =][=for i=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i]) do=]@@

to:

@@[= =][= =][=for i=1, i=]=[=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines={}=]@@
slines=]=[={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i]) lines(scripts[i=]][=) do=]@@



@@[= =][= =][= =][= =][= =][= =][=if line=="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1]='\\\\'=]@@

to:

@@[= =][= =][= =][= =][= =][= =][=if line=="" line=]=[==]=[="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1]='\\\\'=]@@=][=slines[#slines+1=]][==]=[='\\\\'=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=string.gsub(line,"[%~%=%]%%]",=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=string.gsub(line,"[%~%=%]%%]",=]@@escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]&#%i;[=",string.byte(char))=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]&#%i;[=",string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=string.gsub(line,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =][=")=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=string.gsub(line,"^ =][=escaped=]=[=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =][=")=]@@=]=[==]][=[=]=[=")=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1]=string.format("@@[=%s=]@@",escaped)=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1]=string.format("@@[=%s=]@@",escaped)=]@@=][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@



@@[= =][= =][= =][= =][=local content=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers]=scriptfolder(scripts[i],content)=]@@

to:

@@[= =][= =][= =][= =][=local content=table.content=]=[=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers]=scriptfolder(scripts[i],content)=]@@=][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@



@@[= =][= =][=folders[#folders+1]="%%ENDSCRIPTS%%"=]@@

to:

@@[= =][= =][=folders[#folders+1]="%%ENDSCRIPTS%%"=]@@=][=folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@



@@[= =][= =][=local gssscripts=string.gsub(revsection(),"%%","%%%%")=]@@

to:

@@[= =][= =][=local gssscripts=string.gsub(revsection(),"%%","%%%%")=]@@gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= =][= =][=print(string.format("Getting current version of %s...",target))=]@@

to:

@@[= =][= =][=print(string.format("Getting current version of %s...=]%[=s...",target))=]@@



@@[= =][= =][=local current=tvtropes.get(target)=]@@

to:

@@[= =][= =][=local current=tvtropes.current=]=[=tvtropes.get(target)=]@@



@@[= =][= =][=local updated=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="%%%%STARTSCRIPTS%%%%.-%%%%ENDSCRIPTS%%%%",=]@@

to:

@@[= =][= =][=local updated=string.updated=]=[=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="%%%%STARTSCRIPTS%%%%.-%%%%ENDSCRIPTS%%%%",=]@@=][="=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@



@@[= =][= =][=print(string.format("Posting new version of %s...",target))=]@@

to:

@@[= =][= =][=print(string.format("Posting new version of %s...=]%[=s...",target))=]@@



@@[= =][= =][= =][= =][=posted=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@

to:

@@[= =][= =][= =][= =][=posted=tvtropes.=][=posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" print" Retrying..." end=]@@



@@[=local tvtropes=require "tvtropes"=]@@

to:

@@[=local tvtropes=require tvtropes=]=[=require "tvtropes"=]@@



@@[=local urlencode=require "urlencode"=]@@

to:

@@[=local urlencode=require urlencode=]=[=require "urlencode"=]@@



@@[=adeps={=]@@

to:

@@[=adeps={=]@@@@[=adeps=]=[={=]@@



@@[=local tokens={}=]@@

to:

@@[=local tokens={}=]@@tokens=]=[={}=]@@



@@[= =][= =][=local disambigeps={=]@@

to:

@@[= =][= =][=local disambigeps={=]@@disambigeps=]=[={=]@@



@@[= =][= =][=local disambiguated={}=]@@
@@[= =][= =][=for s=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s]={}=]@@
@@[= =][= =][= =][= =][=for i=1,#disambigeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s][disambigeps[s][i]]=true=]@@

to:

@@[= =][= =][=local disambiguated={}=]@@
disambiguated=]=[={}=]@@
@@[= =][= =][=for s=1,#disambigeps s=]=[=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s]={}=]@@
=][=disambiguated[s=]][==]=[={}=]@@
@@[= =][= =][= =][= =][=for i=1,#disambigeps[s] i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s][disambigeps[s][i]]=true=]@@=][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@



@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s][e] then=]@@

to:

@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=string.=][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.=][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s][e] disambiguated[s=]][=[e=]][= then=]@@



@@[= =][= =][= =][= =][= =][= =][=pagename=pagename.."_(Arrested_Development)"=]@@

to:

@@[= =][= =][= =][= =][= =][= =][=pagename=pagename..=][=pagename=]=[=pagename.."_(Arrested_Development)"=]@@



@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@

to:

@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=string.=][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.=][=pagename=]=[=urlencode.string(pagename)=]@@



@@[= =][= =][=local s1flips={ [5]=6, [6]=5, [7]=8, [8]=7, [16]=18, [17]=16, [18]=17 }=]@@

to:

@@[= =][= =][=local s1flips={ [5]=6, [6]=5, [7]=8, [8]=7, [16]=18, [17]=16, [18]=17 s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@



@@[= =][= =][= =][= =][=if s==1 then e = s1flips[e] or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/%i%02i",s,e)=]@@

to:

@@[= =][= =][= =][= =][=if s==1 s=]=[==]=[=1 then e = s1flips[e] =]=[= s1flips[e=]][= or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/%i%02i",s,e)=]@@com/episode/=]%[=i=]%[=02i",s,e)=]@@



@@[= =][= =][=local ttnums={=]@@

to:

@@[= =][= =][=local ttnums={=]@@ttnums=]=[={=]@@



@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt%07i/",ttnums[s][e])=]@@

to:

@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt%07i/",ttnums[s][e])=]@@com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@



@@[= =][= =][=local watchnums={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@

to:

@@[= =][= =][=local watchnums={=]@@
watchnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, =][={ 6641, 6644, 6643, 6638, 6639,=]@@



@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@

to:

@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, =][={ 6640, 6642, 6635, 6636, 6637,=]@@



@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/%i", watchnums[s][e])=]@@

to:

@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/%i", watchnums[s][e])=]@@com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@



@@[= =][= =][=local movieids={=]@@

to:

@@[= =][= =][=local movieids={=]@@movieids=]=[={=]@@



@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=%i",movieids[s][e])=]@@

to:

@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=%i",movieids[s][e])=]@@com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@



@@[= =][= =][=local template=[=[=]@@
@@[=%%STARTLINKS%%=]@@

to:

@@[= =][= =][=local template=[=[=]@@
@@[=%%STARTLINKS%%=]@@
template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@



@@[=Interwiki: [[$wikipedia Wikipedia]] -- [[$wikia Wikia]] -- [[$theop Balboa Observer-Picayune]] -- [[$imdb IMDB]]=]@@

to:

@@[=Interwiki: [[$wikipedia Wikipedia]] Wikipedia=]][==]][= -- [[$wikia Wikia]] Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune]] Observer-Picayune=]][==]][= -- [[$imdb IMDB]]=]@@IMDB=]][==]][==]@@



@@[=Watch now: [[$hulu Hulu]] -- [[$netflix Netflix]]=]@@

to:

@@[=Watch now: [[$hulu Hulu]] Hulu=]][==]][= -- [[$netflix Netflix]]=]@@Netflix=]][==]][==]@@



@@[=%%ENDLINKS%%=]@@
@@[=]=]=]@@

to:

@@[=%%ENDLINKS%%=]@@
@@[=]=]=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@



@@[= =][= =][= =][= =][=return (string.gsub(template,"%$(%w+)",function(token) return tokens[token](s,e) end))=]@@

to:

@@[= =][= =][= =][= =][=return (string.gsub(template,"%$(%w+)",function(token) gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token](s,e) tokens[token=]][=(s,e) end))=]@@



@@[= =][= =][=local title=adeps[s][e]=]@@

to:

@@[= =][= =][=local title=adeps[s][e]=]@@title=]=[=adeps[s=]][=[e=]][==]@@



@@[= =][= =][=title=string.gsub(title,'é','e')=]@@

to:

@@[= =][= =][=title=string.=][=title=]=[=string.gsub(title,'é','e')=]@@



@@[= =][= =][=title=string.gsub(title,' (%l?)',string.upper)=]@@

to:

@@[= =][= =][=title=string.=][=title=]=[=string.gsub(title,' (%l?)',string.(=]%[=l?)',string.upper)=]@@



@@[= =][= =][=title=string.gsub(title,'%W','')=]@@

to:

@@[= =][= =][=title=string.gsub(title,'%W','')=]@@=][=title=]=[=string.gsub(title,'=]%[=W','')=]@@



@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS%iE%i%s",s,e,title)=]@@

to:

@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS%iE%i%s",s,e,title)=]@@format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@



@@[= =][= =][= =][= =][= =][= =][="\n\n%s\n!The ''ArrestedDevelopment'' episode \"%s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s][e]),=]@@

to:

@@[= =][= =][= =][= =][= =][= =][="\n\n%s\n!The =][="\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"%s\" \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s][e]),=]@@=][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@



@@[= =][= =][= =][= =][=if s==2 and e==3 then=]@@

to:

@@[= =][= =][= =][= =][=if s==2 s=]=[==]=[=2 and e==3 e=]=[==]=[=3 then=]@@



@@[= =][= =][= =][= =][= =][= =][=local pagename=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks = string.gsub(ad_ep_links(s,e),"%%","%%%%")=]@@

to:

@@[= =][= =][= =][= =][= =][= =][=local pagename=recap_pagename(s,e)=]@@
pagename=]=[=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=tvtropes.pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks = =]=[= string.gsub(ad_ep_links(s,e),"%%","%%%%")=]@@gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code = tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"%%%%STARTLINKS%%%%.-%%%%ENDLINKS%%%%",gsubsafelinks),=]@@

to:

@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code = =]=[= tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"%%%%STARTLINKS%%%%.-%%%%ENDLINKS%%%%",gsubsafelinks),=]@@gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@



@@[= =][= =][=for s=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=1,#adeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season %i Episode %i, "%s"...',s,e,adeps[s][e]))=]@@

to:

@@[= =][= =][=for s=1,#adeps s=]=[=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=1,#adeps[s] e=]=[=1,#adeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season %i =]%[=i Episode %i, "%s"...',s,e,adeps[s][e]))=]@@=]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@


Added DiffLines:

%%ENDSCRIPTS%%"=]@@
\\
@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\
@@[=local function push(notes)=]@@
@@[= =][= =][=local gssscripts=string.gsub(revsection(),"%%","%%%%")=]@@
\\
@@[= =][= =][=print(string.format("Getting current version of %s...",target))=]@@
\\
@@[= =][= =][=local current=tvtropes.get(target)=]@@
\\
@@[= =][= =][=local updated=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="%%%%STARTSCRIPTS%%

[[foldercontrol]]

[[folder:urlencode.lua]]
@@[=local urlencode=]=[={}=]@@
\\
@@[=--URL encode a string.=]@@
@@[=local function encode(str)=]@@
@@[= =][= =][=--Ensure all newlines are in CRLF form=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= =][= =][=--Percent-encode all non-unreserved characters=]@@
@@[= =][= =][=--as per RFC 3986, Section 2.3=]@@
@@[= =][= =][=--(except for space, which gets plus-encoded)=]@@
@@[= =][= =][=str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= =][= =][=--Convert spaces to plus signs=]@@
@@[= =][= =][=return string.gsub (str, " ", "+")=]@@
@@[=end=]@@
\\
@@[=--Make this function available as part of the module=]@@
@@[=urlencode.string =]=[= encode=]@@
\\
@@[=--URL encode a table as a series of parameters.=]@@
@@[=function urlencode.table(t)=]@@
@@[= =][= =][=--table of argument strings=]@@
@@[= =][= =][=local argts, i=]=[= {}, 1=]@@
@@[= =][= =][=for k, v in pairs(t) do=]@@
@@[= =][= =][= =][= =][=argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= =][= =][= =][= =][=i=]=[=i+1=]@@
@@[= =][= =][=end=]@@
@@[= =][= =][=return table.concat(argts,'&')=]@@
@@[=end=]@@
\\
@@[=return urlencode=]@@
[[/folder]]

[[folder:tvtropes.lua]]
@@[=--Required to send to TVTropes site.=]@@
@@[=local http =]=[= require"socket.http"=]@@
\\
@@[=--Required to create page post data.=]@@
@@[=local urlencode =]=[= require "urlencode"=]@@
\\
@@[=local tvtropes=]=[={}=]@@
\\
@@[=--Function that returns the authenticated TVTropes URL for the given page.=]@@
@@[=local function authpageurl(page)=]@@
@@[= =][= =][=return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
@@[=end=]@@
\\
@@[=local function fullname(page)=]@@
@@[= =][= =][=--Require pagename=]@@
@@[= =][= =][=assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= =][= =][=--If no namespace specified, assume Main=]@@
@@[= =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
\\
@@[= =][= =][=return page=]@@
@@[=end=]@@
\\
@@[=--Function that posts the given page.=]@@
@@[=function tvtropes.post(page, body, author, reason)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=assert(type(body)=]=[==]=[="string","Page body required")=]@@
\\
@@[= =][= =][=local response =]=[==]@@
@@[= =][= =][= =][= =][={http.request(authpageurl(page),=]@@
@@[= =][= =][= =][= =][= =][= =][=urlencode.table{=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=action=]=[="post", post=]=[="save",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=pagename=]=[=page, text=]=[=body,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=author=]=[=author or "Anonymous",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=reason=]=[=reason or ""=]@@
@@[= =][= =][= =][= =][= =][= =][=})}=]@@
\\
@@[= =][= =][=--Error on any socket errors=]@@
@@[= =][= =][=assert(response[1=]][=,response[2=]][=)=]@@
\\
@@[= =][= =][=--If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= =][= =][=--sometimes it just rejects the password for some reason.=]@@
@@[= =][= =][=if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@
@@[= =][= =][=else return true=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Technically, this is kind of a general function, but it's designed exclusively around=]@@
@@[=--TVTropes' source converter, so it's kept in here.=]@@
@@[=local html2plain=]@@
@@[=do=]@@
@@[= =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
\\
@@[= =][= =][=function html2plain(src)=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= =][= =][= =][= =][=src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= =][= =][= =][= =][=return src=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that gets a given page source.=]@@
@@[=function tvtropes.get(page)=]@@
\\
@@[= =][= =][=page=]=[=fullname(page)=]@@
\\
@@[= =][= =][=local body, code =]=[= http.request(=]@@
@@[= =][= =][= =][= =][=authpageurl(page)..'?action=]=[=source')=]@@
\\
@@[= =][= =][=--Trigger error on socket failure=]@@
@@[= =][= =][=assert(body,code)=]@@
\\
@@[= =][= =][=--Return the source converted back from the HTML conversion=]@@
@@[= =][= =][=return html2plain(body)=]@@
@@[=end=]@@
\\
@@[=return tvtropes=]@@
[[/folder]]

[[folder:tropersrepo.lua]]
@@[=--Script that posts the latest version of the TV Tropes=]@@
@@[=--scripts to my contributor page.=]@@
\\
@@[=--Any edit to the functionality of this script tends to generate=]@@
@@[=--about fifteen or 20 edits to the page: see ProximalErrorProbability.=]@@
\\
@@[=local tvtropes =]=[= require "tvtropes"=]@@
\\
@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@
\\
@@[=local scripts=]=[={=]@@
@@[= =][= =][="urlencode.lua",=]@@
@@[= =][= =][="tvtropes.lua",=]@@
@@[= =][= =][="tropersrepo.lua",=]@@
@@[= =][= =][="arrdev_recap.lua",=]@@
@@[=}=]@@
\\
@@[=local function scriptfolder(name,script)=]@@
@@[= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][="[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= =][= =][= =][= =][=name,script)=]@@
@@[=end=]@@
\\
@@[=local function revsection()=]@@
@@[= =][= =][=local folders=]=[={=]@@
@@[= =][= =][= =][= =][="=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= =][= =][= =][= =][="[[foldercontrol=]][==]][="=]@@
@@[= =][= =][=}=]@@
@@[= =][= =][=local headers=]=[=#folders=]@@
\\
@@[= =][= =][=for i=]=[=1, #scripts do=]@@
@@[= =][= =][= =][= =][=local slines=]=[={}=]@@
@@[= =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) do=]@@
\\
@@[= =][= =][= =][= =][= =][= =][=if line=]=[==]=[="" then=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[='\\\\'=]@@
@@[= =][= =][= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--do I hate this? yes, I do.=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start of a line=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=--to keep them from being folded on commit=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=]=[=string.gsub(escaped,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =]=[==]][=[=]=[=")=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@
\\
@@[= =][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=local content=]=[=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@
\\
@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\
@@[=local function push(notes)=]@@
@@[= =][= =][=local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
\\
@@[= =][= =][=print(string.format("Getting current version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local current=]=[=tvtropes.get(target)=]@@
\\
@@[= =][= =][=local updated=]=[=string.gsub(current,=]@@
@@[= =][= =][= =][= =][="=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= =][= =][= =][= =][=gssscripts)=]@@
\\
@@[= =][= =][=print(string.format("Posting new version of =]%[=s...",target))=]@@
\\
@@[= =][= =][=local posted=]@@
@@[= =][= =][=while not posted do=]@@
@@[= =][= =][= =][= =][=posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Executing code---------------------------------------------------------------=]@@
\\
@@[=push "bloody spaces"=]@@
\\
[[/folder]]

[[folder:arrdev_recap.lua]]
@@[=--encoding: UTF-8=]@@
\\
@@[=--Required to post pages=]@@
@@[=local tvtropes=]=[=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=]=[=require "urlencode"=]@@
\\
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps=]=[={=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="Pilot",=]@@
@@[= =][= =][= =][= =][="Top Banana",=]@@
@@[= =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= =][= =][= =][= =][="Key Decisions",=]@@
@@[= =][= =][= =][= =][="Visiting Ours",=]@@
@@[= =][= =][= =][= =][="Charity Drive",=]@@
@@[= =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= =][= =][= =][= =][="In God We Trust",=]@@
@@[= =][= =][= =][= =][="Storming the Castle",=]@@
@@[= =][= =][= =][= =][="Pier Pressure",=]@@
@@[= =][= =][= =][= =][="Public Relations",=]@@
@@[= =][= =][= =][= =][="Marta Complex",=]@@
@@[= =][= =][= =][= =][="Beef Consommé",=]@@
@@[= =][= =][= =][= =][="Shock and Aww",=]@@
@@[= =][= =][= =][= =][="Staff Infection",=]@@
@@[= =][= =][= =][= =][="Missing Kitty",=]@@
@@[= =][= =][= =][= =][="Altar Egos",=]@@
@@[= =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= =][= =][= =][= =][="¡Amigos!",=]@@
@@[= =][= =][= =][= =][="Good Grief",=]@@
@@[= =][= =][= =][= =][="Sad Sack",=]@@
@@[= =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= =][= =][= =][= =][="Switch Hitter",=]@@
@@[= =][= =][= =][= =][="Queen for a Day",=]@@
@@[= =][= =][= =][= =][="Burning Love",=]@@
@@[= =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= =][= =][= =][= =][="Out on a Limb",=]@@
@@[= =][= =][= =][= =][="Hand to God",=]@@
@@[= =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= =][= =][= =][= =][="Meat the Veals",=]@@
@@[= =][= =][= =][= =][="Spring Breakout",=]@@
@@[= =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The Cabin Show",=]@@
@@[= =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= =][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= =][= =][= =][= =][="Notapusy",=]@@
@@[= =][= =][= =][= =][="Mr. F",=]@@
@@[= =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= =][= =][= =][= =][="Prison Break-In",=]@@
@@[= =][= =][= =][= =][="Making a Stand",=]@@
@@[= =][= =][= =][= =][="S.O.B.s",=]@@
@@[= =][= =][= =][= =][="Fakin' It",=]@@
@@[= =][= =][= =][= =][="Family Ties",=]@@
@@[= =][= =][= =][= =][="Exit Strategy",=]@@
@@[= =][= =][= =][= =][="Development Arrested"=]@@
@@[= =][= =][=},=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens=]=[={}=]@@
\\
@@[=do --wikipedia=]@@
@@[= =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= =][= =][=local disambigeps=]=[={=]@@
@@[= =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--construct lookup table=]@@
@@[= =][= =][=local disambiguated=]=[={}=]@@
@@[= =][= =][=for s=]=[=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s=]][==]=[={}=]@@
@@[= =][= =][= =][= =][=for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s=]][=[e=]][= then=]@@
@@[= =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][= =][= =][=pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=]=[=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
\\
@@[=do --Balboa Observer-Picayune=]@@
@@[= =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= =][= =][=local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
\\
@@[= =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= =][= =][=function tokens.theop(s,e)=]@@
@@[= =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= =][= =][=--that I have to use you=]@@
@@[= =][= =][=local ttnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= =][= =][=function tokens.imdb(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Hulu, you know, just in case=]@@
@@[= =][= =][=local watchnums=]=[={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.hulu(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Netflix Watch Instantly=]@@
@@[= =][= =][=--It's largely sequential, but not quite.=]@@
@@[= =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= =][= =][=local movieids=]=[={=]@@
@@[= =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.netflix(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= =][= =][=local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
\\
@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= =][= =][=function ad_ep_links(s,e)=]@@
@@[= =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= =][= =][=--get the ep title=]@@
@@[= =][= =][=local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= =][= =][=--replace the é in Beef Consommé=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'é','e')=]@@
@@[= =][= =][=--transform to CamelCased WikiWord=]@@
@@[= =][= =][=title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= =][= =][=title=]=[=string.gsub(title,'=]%[=W','')=]@@
\\
@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
@@[=end=]@@
\\
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= =][= =][=return tvtropes.post(=]@@
@@[= =][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= =][= =][= =][= =][=string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= =][= =][= =][= =][="STUART",=]@@
@@[= =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
\\
@@[=local function update_links(reason)=]@@
@@[= =][= =][=return function(s,e)=]@@
@@[= =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= =][= =][= =][= =][=if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][=local pagename=]=[=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= =][= =][= =][= =][= =][= =][=local success=]@@
@@[= =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=local function for_all_eps(f)=]@@
@@[= =][= =][=for s=]=[=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=]=[=1,#adeps[s=]][= do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= =][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Okay, put your executing commands down here.=]@@
[[/folder]]

%%ENDSCRIPTS%%%%",=]@@
@@[= =][= =][= =][= =][=gssscripts)=]@@
\\
@@[= =][= =][=print(string.format("Posting new version of %s...",target))=]@@
\\
@@[= =][= =][=local posted=]@@
@@[= =][= =][=while not posted do=]@@
@@[= =][= =][= =][= =][=posted=tvtropes.post(target,updated,user,notes)=]@@
@@[= =][= =][= =][= =][=if not posted then print" Retrying..." end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Executing code---------------------------------------------------------------=]@@
\\
@@[=push "bloody spaces"=]@@
\\
[[/folder]]

[[folder:arrdev_recap.lua]]
@@[=--encoding: UTF-8=]@@
\\
@@[=--Required to post pages=]@@
@@[=local tvtropes=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=require "urlencode"=]@@
\\
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps={=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="Pilot",=]@@
@@[= =][= =][= =][= =][="Top Banana",=]@@
@@[= =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= =][= =][= =][= =][="Key Decisions",=]@@
@@[= =][= =][= =][= =][="Visiting Ours",=]@@
@@[= =][= =][= =][= =][="Charity Drive",=]@@
@@[= =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= =][= =][= =][= =][="In God We Trust",=]@@
@@[= =][= =][= =][= =][="Storming the Castle",=]@@
@@[= =][= =][= =][= =][="Pier Pressure",=]@@
@@[= =][= =][= =][= =][="Public Relations",=]@@
@@[= =][= =][= =][= =][="Marta Complex",=]@@
@@[= =][= =][= =][= =][="Beef Consommé",=]@@
@@[= =][= =][= =][= =][="Shock and Aww",=]@@
@@[= =][= =][= =][= =][="Staff Infection",=]@@
@@[= =][= =][= =][= =][="Missing Kitty",=]@@
@@[= =][= =][= =][= =][="Altar Egos",=]@@
@@[= =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= =][= =][= =][= =][="¡Amigos!",=]@@
@@[= =][= =][= =][= =][="Good Grief",=]@@
@@[= =][= =][= =][= =][="Sad Sack",=]@@
@@[= =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= =][= =][= =][= =][="Switch Hitter",=]@@
@@[= =][= =][= =][= =][="Queen for a Day",=]@@
@@[= =][= =][= =][= =][="Burning Love",=]@@
@@[= =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= =][= =][= =][= =][="Out on a Limb",=]@@
@@[= =][= =][= =][= =][="Hand to God",=]@@
@@[= =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= =][= =][= =][= =][="Meat the Veals",=]@@
@@[= =][= =][= =][= =][="Spring Breakout",=]@@
@@[= =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= =][= =][=},=]@@
@@[= =][= =][={=]@@
@@[= =][= =][= =][= =][="The Cabin Show",=]@@
@@[= =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= =][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= =][= =][= =][= =][="Notapusy",=]@@
@@[= =][= =][= =][= =][="Mr. F",=]@@
@@[= =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= =][= =][= =][= =][="Prison Break-In",=]@@
@@[= =][= =][= =][= =][="Making a Stand",=]@@
@@[= =][= =][= =][= =][="S.O.B.s",=]@@
@@[= =][= =][= =][= =][="Fakin' It",=]@@
@@[= =][= =][= =][= =][="Family Ties",=]@@
@@[= =][= =][= =][= =][="Exit Strategy",=]@@
@@[= =][= =][= =][= =][="Development Arrested"=]@@
@@[= =][= =][=},=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens={}=]@@
\\
@@[=do --wikipedia=]@@
@@[= =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= =][= =][=local disambigeps={=]@@
@@[= =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--construct lookup table=]@@
@@[= =][= =][=local disambiguated={}=]@@
@@[= =][= =][=for s=1,#disambigeps do=]@@
@@[= =][= =][= =][= =][=disambiguated[s]={}=]@@
@@[= =][= =][= =][= =][=for i=1,#disambigeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=disambiguated[s][disambigeps[s][i]]=true=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
\\
@@[= =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=if disambiguated[s][e] then=]@@
@@[= =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= =][= =][= =][= =][= =][= =][=pagename=pagename.."_(Arrested_Development)"=]@@
@@[= =][= =][= =][= =][=end=]@@
\\
@@[= =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= =][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= =][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= =][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
\\
@@[=do --Balboa Observer-Picayune=]@@
@@[= =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= =][= =][=local s1flips={ [5]=6, [6]=5, [7]=8, [8]=7, [16]=18, [17]=16, [18]=17 }=]@@
\\
@@[= =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= =][= =][=function tokens.theop(s,e)=]@@
@@[= =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= =][= =][= =][= =][=if s==1 then e = s1flips[e] or e end=]@@
@@[= =][= =][= =][= =][=return string.format("http://the-op.com/episode/%i%02i",s,e)=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= =][= =][=--that I have to use you=]@@
@@[= =][= =][=local ttnums={=]@@
@@[= =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= =][= =][=function tokens.imdb(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt%07i/",ttnums[s][e])=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Hulu, you know, just in case=]@@
@@[= =][= =][=local watchnums={=]@@
@@[= =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.hulu(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://hulu.com/watch/%i", watchnums[s][e])=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=do --Netflix Watch Instantly=]@@
@@[= =][= =][=--It's largely sequential, but not quite.=]@@
@@[= =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= =][= =][=local movieids={=]@@
@@[= =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= =][= =][=}=]@@
\\
@@[= =][= =][=function tokens.netflix(s,e)=]@@
@@[= =][= =][= =][= =][=return string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=%i",movieids[s][e])=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= =][= =][=local template=[=[=]@@
@@[=%%STARTLINKS%%=]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia]] -- [[$wikia Wikia]] -- [[$theop Balboa Observer-Picayune]] -- [[$imdb IMDB]]=]@@
\\
@@[=Watch now: [[$hulu Hulu]] -- [[$netflix Netflix]]=]@@
@@[=----=]@@
@@[=%%ENDLINKS%%=]@@
@@[=]=]=]@@
@@[= =][= =][=function ad_ep_links(s,e)=]@@
@@[= =][= =][= =][= =][=return (string.gsub(template,"%$(%w+)",function(token) return tokens[token](s,e) end))=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= =][= =][=--get the ep title=]@@
@@[= =][= =][=local title=adeps[s][e]=]@@
@@[= =][= =][=--replace the é in Beef Consommé=]@@
@@[= =][= =][=title=string.gsub(title,'é','e')=]@@
@@[= =][= =][=--transform to CamelCased WikiWord=]@@
@@[= =][= =][=title=string.gsub(title,' (%l?)',string.upper)=]@@
@@[= =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= =][= =][=title=string.gsub(title,'%W','')=]@@
\\
@@[= =][= =][=return string.format("Recap/ArrestedDevelopmentS%iE%i%s",s,e,title)=]@@
@@[=end=]@@
\\
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= =][= =][=return tvtropes.post(=]@@
@@[= =][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= =][= =][= =][= =][=string.format(=]@@
@@[= =][= =][= =][= =][= =][= =][="\n\n%s\n!The ''ArrestedDevelopment'' episode \"%s\" provides examples of:\n\n",=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s][e]),=]@@
@@[= =][= =][= =][= =][="STUART",=]@@
@@[= =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
\\
@@[=local function update_links(reason)=]@@
@@[= =][= =][=return function(s,e)=]@@
@@[= =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= =][= =][= =][= =][=if s==2 and e==3 then=]@@
@@[= =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= =][= =][= =][= =][=else=]@@
@@[= =][= =][= =][= =][= =][= =][=local pagename=recap_pagename(s,e)=]@@
@@[= =][= =][= =][= =][= =][= =][=local pageasis=tvtropes.get(pagename)=]@@
@@[= =][= =][= =][= =][= =][= =][=local gsubsafelinks = string.gsub(ad_ep_links(s,e),"%%","%%%%")=]@@
@@[= =][= =][= =][= =][= =][= =][=local success=]@@
@@[= =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=success, code = tvtropes.post(pagename,=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"%%%%STARTLINKS%%%%.-%%%%ENDLINKS%%%%",gsubsafelinks),=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= =][= =][= =][= =][= =][= =][=end=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
\\
@@[=local function for_all_eps(f)=]@@
@@[= =][= =][=for s=1,#adeps do=]@@
@@[= =][= =][= =][= =][=for e=1,#adeps[s] do=]@@
@@[= =][= =][= =][= =][= =][= =][=print(string.format('Doing Season %i Episode %i, "%s"...',s,e,adeps[s][e]))=]@@
@@[= =][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= =][= =][= =][= =][=end=]@@
@@[= =][= =][=end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
\\
@@[=--Okay, put your executing commands down here.=]@@
[[/folder]]

Added: 580

Changed: 7099

Removed: 13

Is there an issue? Send a MessageReason:
bloody spaces


@@[=local urlencode=]=[={}=]@@

to:

@@[=local urlencode=]=[={}=]@@urlencode={}=]@@



@@[= --Ensure all newlines are in CRLF form=]@@
@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= --Percent-encode all non-unreserved characters=]@@
@@[= --as per RFC 3986, Section 2.3=]@@
@@[= --(except for space, which gets plus-encoded)=]@@
@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= --Convert spaces to plus signs=]@@
@@[= return string.gsub (str, " ", "+ ")=]@@

to:

@@[= --Ensure =][= =][=--Ensure all newlines are in CRLF form=]@@
@@[= str =]=[= =][= =][=str = string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= --Percent-encode =][= =][=--Percent-encode all non-unreserved characters=]@@
@@[= --as =][= =][=--as per RFC 3986, Section 2.3=]@@
@@[= --(except =][= =][=--(except for space, which gets plus-encoded)=]@@
@@[= str =]=[= =][= =][=str = string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
"([^%w%-%.%_%~ ])",=]@@
@@[= function =][= =][= =][= =][= =][= =][=function (c) return string.format ("=]%[==]%[==]%[=02X", ("%%%02X", string.byte(c)) end)=]@@
@@[= --Convert =][= =][=--Convert spaces to plus signs=]@@
@@[= return =][= =][=return string.gsub (str, " ", "+ ")=]@@"+")=]@@



@@[=urlencode.string =]=[= encode=]@@

to:

@@[=urlencode.string =]=[= = encode=]@@



@@[= --table of argument strings=]@@
@@[= local argts, i=]=[= {}, 1=]@@
@@[= for k, v in pairs(t) do=]@@
@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+ 1=]@@
@@[= end=]@@
@@[= return table.concat(argts,'&')=]@@

to:

@@[= --table =][= =][=--table of argument strings=]@@
@@[= local =][= =][=local argts, i=]=[= i= {}, 1=]@@
@@[= for =][= =][=for k, v in pairs(t) do=]@@
@@[= argts[i=]][==]=[=encode(k).."=]=[="..=][= =][= =][= =][=argts[i]=encode(k).."="..encode(v)=]@@
@@[= i=]=[=i+ 1=]@@
=][= =][= =][= =][=i=i+1=]@@
@@[= end=]@@
=][= =][=end=]@@
@@[= return =][= =][=return table.concat(argts,'&')=]@@



@@[=local http =]=[= require"socket.http"=]@@

to:

@@[=local http =]=[= = require"socket.http"=]@@



@@[=local urlencode =]=[= require "urlencode"=]@@

to:

@@[=local urlencode =]=[= = require "urlencode"=]@@



@@[=local tvtropes=]=[={}=]@@

to:

@@[=local tvtropes=]=[={}=]@@tvtropes={}=]@@



@@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@

to:

@@[= return =][= =][=return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@



@@[= --Require pagename=]@@
@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= --If no namespace specified, assume Main=]@@
@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@

to:

@@[= --Require =][= =][=--Require pagename=]@@
@@[= assert(type(page)=]=[==]=[="string","Destination =][= =][=assert(type(page)=="string","Destination page name required")=]@@
@@[= --If =][= =][=--If no namespace specified, assume Main=]@@
@@[= if =][= =][=if not string.find(page,'/') then page=]=[="Main/"..page="Main/"..page end=]@@



@@[= return page=]@@

to:

@@[= return =][= =][=return page=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= page=]=[=fullname(page)=]@@=][= =][=page=fullname(page)=]@@



@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@

to:

@@[= assert(type(body)=]=[==]=[="string","Page =][= =][=assert(type(body)=="string","Page body required")=]@@



@@[= local response =]=[==]@@
@@[= {http.request(authpageurl(page),=]@@
@@[= urlencode.table{=]@@
@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@
@@[= })}=]@@

to:

@@[= local =][= =][=local response =]=[==]@@
==]@@
@@[= {http.=][= =][= =][= =][={http.request(authpageurl(page),=]@@
@@[= urlencode.=][= =][= =][= =][= =][= =][=urlencode.table{=]@@
@@[= action=]=[="post", post=]=[="save",=]@@
=][= =][= =][= =][= =][= =][= =][= =][=action="post", post="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
=][= =][= =][= =][= =][= =][= =][= =][=pagename=page, text=body,=]@@
@@[= author=]=[=author =][= =][= =][= =][= =][= =][= =][= =][=author=author or "Anonymous",=]@@
@@[= reason=]=[=reason =][= =][= =][= =][= =][= =][= =][= =][=reason=reason or ""=]@@
@@[= })}=]@@=][= =][= =][= =][= =][= =][=})}=]@@



@@[= --Error on any socket errors=]@@
@@[= assert(response[1=]][=,response[2=]][=)=]@@

to:

@@[= --Error =][= =][=--Error on any socket errors=]@@
@@[= assert(response[1=]][=,response[2=]][=)=]@@=][= =][=assert(response[1],response[2])=]@@



@@[= --If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= --sometimes it just rejects the password for some reason.=]@@
@@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@
@@[= else return true=]@@
@@[= end=]@@

to:

@@[= --If =][= =][=--If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= --sometimes =][= =][=--sometimes it just rejects the password for some reason.=]@@
@@[= if tonumber(response[2=]][=)=]~[==]=[=302 =][= =][=if tonumber(response[2])~=302 then=]@@
@@[= return =][= =][= =][= =][=return nil, response[2=]][=, response[1=]][==]@@
response[2], response[1]=]@@
@@[= else =][= =][=else return true=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@

to:

@@[= local =][= =][=local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@= {quot='"', amp='&', lt='<', gt='>'}=]@@



@@[= function html2plain(src)=]@@
@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= return src=]@@
@@[= end=]@@

to:

@@[= function =][= =][=function html2plain(src)=]@@
@@[= src=]=[=string.=][= =][= =][= =][=src=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
=][= =][= =][= =][=src=string.gsub(src,"&(%w-);",ents)=]@@
@@[= return =][= =][= =][= =][=return src=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= page=]=[=fullname(page)=]@@=][= =][=page=fullname(page)=]@@



@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@

to:

@@[= local =][= =][=local body, code =]=[= = http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@=][= =][= =][= =][=authpageurl(page)..'?action=source')=]@@



@@[= --Trigger error on socket failure=]@@
@@[= assert(body,code)=]@@

to:

@@[= --Trigger =][= =][=--Trigger error on socket failure=]@@
@@[= assert(body,code)=]@@=][= =][=assert(body,code)=]@@



@@[= --Return the source converted back from the HTML conversion=]@@
@@[= return html2plain(body)=]@@

to:

@@[= --Return =][= =][=--Return the source converted back from the HTML conversion=]@@
@@[= return =][= =][=return html2plain(body)=]@@



@@[=local tvtropes =]=[= require "tvtropes"=]@@

to:

@@[=local tvtropes =]=[= = require "tvtropes"=]@@



@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@

to:

@@[=local target =]=[= = "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@user="STUART"=]@@



@@[=local scripts=]=[={=]@@
@@[= "urlencode.lua",=]@@
@@[= "tvtropes.lua",=]@@
@@[= "tropersrepo.lua",=]@@
@@[= "arrdev_recap.lua",=]@@

to:

@@[=local scripts=]=[={=]@@
scripts={=]@@
@@[= "urlencode.=][= =][="urlencode.lua",=]@@
@@[= "tvtropes.=][= =][="tvtropes.lua",=]@@
@@[= "tropersrepo.=][= =][="tropersrepo.lua",=]@@
@@[= "arrdev_recap.=][= =][="arrdev_recap.lua",=]@@



@@[= return string.format(=]@@
@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= name,script)=]@@

to:

@@[= return =][= =][=return string.format(=]@@
@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
=][= =][= =][= =][="[[folder:%s]]\n%s\n[[/folder]]",=]@@
@@[= name,script)=]@@=][= =][= =][= =][=name,script)=]@@



@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@
@@[= }=]@@
@@[= local headers=]=[=#folders=]@@

to:

@@[= local folders=]=[={=]@@
=][= =][=local folders={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
=][= =][= =][= =][="%%STARTSCRIPTS%%",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@
=][= =][= =][= =][="[[foldercontrol]]"=]@@
@@[= }=]@@
=][= =][=}=]@@
@@[= local headers=]=[=#folders=]@@=][= =][=local headers=#folders=]@@



@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@

to:

@@[= for i=]=[=1, =][= =][=for i=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
=][= =][= =][= =][=local slines={}=]@@
@@[= for =][= =][= =][= =][=for line in io.lines(scripts[i=]][=) lines(scripts[i]) do=]@@



@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+ 1=]][==]=[='\\\\'=]@@
@@[= else=]@@
@@[= --escape all equals signs and percents=]@@
@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@

to:

@@[= if line=]=[==]=[="" =][= =][= =][= =][= =][= =][=if line=="" then=]@@
@@[= slines[#slines+ 1=]][==]=[='\\\\'=]@@
=][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1]='\\\\'=]@@
@@[= else=]@@
=][= =][= =][= =][= =][= =][=else=]@@
@@[= --escape =][= =][= =][= =][= =][= =][= =][= =][=--escape all equals signs and percents=]@@
@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
=][= =][= =][= =][= =][= =][= =][= =][=local escaped=string.gsub(line,"[%~%=%]%%]",=]@@
@@[= function(char) return =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=function(char)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return
string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@format("=]&#%i;[=",string.byte(char))=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@



@@[= slines[#slines+ 1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= slines[#slines+ 1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
=][= =][= =][= =][= =][= =][= =][= =][=--do I hate this? yes, I do.=]@@
@@[= end=]@@
=][= =][= =][= =][= =][= =][= =][= =][=--escape _every_ _single_ _space_ at the start of a line=]@@
@@[= end=]@@=][= =][= =][= =][= =][= =][= =][= =][=--to keep them from being folded on commit=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=escaped=string.gsub(line,"^ *",function(s)=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][= =][= =][=return string.gsub(s," "," =][=")=]@@
@@[= =][= =][= =][= =][= =][= =][= =][= =][=end)=]@@



@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+ headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= end=]@@

to:

@@[= local content=]=[=table.concat(slines,'\n')=]@@
=][= =][= =][= =][= =][= =][= =][= =][=slines[#slines+1]=string.format("@@[=%s=]@@",escaped)=]@@
@@[= folders[i+ headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
=][= =][= =][= =][= =][= =][=end=]@@
@@[= end=]@@=][= =][= =][= =][=end=]@@



@@[= folders[#folders+ 1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@

to:

@@[= folders[#folders+ 1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@=][= =][= =][= =][=local content=table.concat(slines,'\n')=]@@
@@[= =][= =][= =][= =][=folders[i+headers]=scriptfolder(scripts[i],content)=]@@
@@[= =][= =][=end=]@@



@@[= return table.concat(folders,"\n\n")=]@@
@@[=end=]@@

to:

@@[= return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
=][= =][=folders[#folders+1]="%%ENDSCRIPTS%%"=]@@



@@[= =][= =][=return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
\\



@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@=][= =][=local gssscripts=string.gsub(revsection(),"%%","%%%%")=]@@



@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@

to:

@@[= print(string.=][= =][=print(string.format("Getting current version of =]%[=s...%s...",target))=]@@



@@[= local current=]=[=tvtropes.get(target)=]@@

to:

@@[= local current=]=[=tvtropes.=][= =][=local current=tvtropes.get(target)=]@@



@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= gssscripts)=]@@

to:

@@[= local updated=]=[=string.=][= =][=local updated=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
=][= =][= =][= =][="%%%%STARTSCRIPTS%%%%.-%%%%ENDSCRIPTS%%%%",=]@@
@@[= gssscripts)=]@@=][= =][= =][= =][=gssscripts)=]@@



@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@

to:

@@[= print(string.=][= =][=print(string.format("Posting new version of =]%[=s...%s...",target))=]@@



@@[= local posted=]@@
@@[= while not posted do=]@@
@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= if not posted then print" Retrying..." end=]@@
@@[= end=]@@

to:

@@[= local =][= =][=local posted=]@@
@@[= while =][= =][=while not posted do=]@@
@@[= posted=]=[=tvtropes.=][= =][= =][= =][=posted=tvtropes.post(target,updated,user,notes)=]@@
@@[= if =][= =][= =][= =][=if not posted then print" print" Retrying..." end=]@@
@@[= end=]@@=][= =][=end=]@@



@@[=push "OK, think I got it now"=]@@

to:

@@[=push "OK, think I got it now"=]@@"bloody spaces"=]@@



\\



@@[=local tvtropes=]=[=require "tvtropes"=]@@

to:

@@[=local tvtropes=]=[=require tvtropes=require "tvtropes"=]@@



@@[=local urlencode=]=[=require "urlencode"=]@@

to:

@@[=local urlencode=]=[=require urlencode=require "urlencode"=]@@



@@[=adeps=]=[={=]@@
@@[= {=]@@
@@[= "Pilot",=]@@
@@[= "Top Banana",=]@@
@@[= "Bringing Up Buster",=]@@
@@[= "Key Decisions",=]@@
@@[= "Visiting Ours",=]@@
@@[= "Charity Drive",=]@@
@@[= "My Mother, The Car",=]@@
@@[= "In God We Trust",=]@@
@@[= "Storming the Castle",=]@@
@@[= "Pier Pressure",=]@@
@@[= "Public Relations",=]@@
@@[= "Marta Complex",=]@@
@@[= "Beef Consommé",=]@@
@@[= "Shock and Aww",=]@@
@@[= "Staff Infection",=]@@
@@[= "Missing Kitty",=]@@
@@[= "Altar Egos",=]@@
@@[= "Justice Is Blind",=]@@
@@[= "Best Man for the GOB",=]@@
@@[= "Whistler's Mother",=]@@
@@[= "Not Without My Daughter",=]@@
@@[= "Let 'Em Eat Cake"=]@@
@@[= },=]@@
@@[= {=]@@
@@[= "The One Where Michael Leaves",=]@@
@@[= "The One Where They Build a House",=]@@
@@[= "¡Amigos!",=]@@
@@[= "Good Grief",=]@@
@@[= "Sad Sack",=]@@
@@[= "Afternoon Delight",=]@@
@@[= "Switch Hitter",=]@@
@@[= "Queen for a Day",=]@@
@@[= "Burning Love",=]@@
@@[= "Ready, Aim, Marry Me",=]@@
@@[= "Out on a Limb",=]@@
@@[= "Hand to God",=]@@
@@[= "Motherboy XXX",=]@@
@@[= "The Immaculate Election",=]@@
@@[= "Sword of Destiny",=]@@
@@[= "Meat the Veals",=]@@
@@[= "Spring Breakout",=]@@
@@[= "Righteous Brothers",=]@@
@@[= },=]@@
@@[= {=]@@
@@[= "The Cabin Show",=]@@
@@[= "For British Eyes Only",=]@@
@@[= "Forget-Me-Now",=]@@
@@[= "Notapusy",=]@@
@@[= "Mr. F",=]@@
@@[= "The Ocean Walker",=]@@
@@[= "Prison Break-In",=]@@
@@[= "Making a Stand",=]@@
@@[= "S.O.B.s",=]@@
@@[= "Fakin' It",=]@@
@@[= "Family Ties",=]@@
@@[= "Exit Strategy",=]@@
@@[= "Development Arrested"=]@@
@@[= },=]@@

to:

@@[=adeps=]=[={=]@@
@@[=adeps={=]@@
@@[= {=]@@
=][= =][={=]@@
@@[= "Pilot",=]@@
=][= =][= =][= =][="Pilot",=]@@
@@[= "Top =][= =][= =][= =][="Top Banana",=]@@
@@[= "Bringing =][= =][= =][= =][="Bringing Up Buster",=]@@
@@[= "Key =][= =][= =][= =][="Key Decisions",=]@@
@@[= "Visiting =][= =][= =][= =][="Visiting Ours",=]@@
@@[= "Charity =][= =][= =][= =][="Charity Drive",=]@@
@@[= "My =][= =][= =][= =][="My Mother, The Car",=]@@
@@[= "In =][= =][= =][= =][="In God We Trust",=]@@
@@[= "Storming =][= =][= =][= =][="Storming the Castle",=]@@
@@[= "Pier =][= =][= =][= =][="Pier Pressure",=]@@
@@[= "Public =][= =][= =][= =][="Public Relations",=]@@
@@[= "Marta =][= =][= =][= =][="Marta Complex",=]@@
@@[= "Beef =][= =][= =][= =][="Beef Consommé",=]@@
@@[= "Shock =][= =][= =][= =][="Shock and Aww",=]@@
@@[= "Staff =][= =][= =][= =][="Staff Infection",=]@@
@@[= "Missing =][= =][= =][= =][="Missing Kitty",=]@@
@@[= "Altar =][= =][= =][= =][="Altar Egos",=]@@
@@[= "Justice =][= =][= =][= =][="Justice Is Blind",=]@@
@@[= "Best =][= =][= =][= =][="Best Man for the GOB",=]@@
@@[= "Whistler's =][= =][= =][= =][="Whistler's Mother",=]@@
@@[= "Not =][= =][= =][= =][="Not Without My Daughter",=]@@
@@[= "Let =][= =][= =][= =][="Let 'Em Eat Cake"=]@@
@@[= },=]@@
=][= =][=},=]@@
@@[= {=]@@
=][= =][={=]@@
@@[= "The =][= =][= =][= =][="The One Where Michael Leaves",=]@@
@@[= "The =][= =][= =][= =][="The One Where They Build a House",=]@@
@@[= "¡Amigos!",=]@@
=][= =][= =][= =][="¡Amigos!",=]@@
@@[= "Good =][= =][= =][= =][="Good Grief",=]@@
@@[= "Sad =][= =][= =][= =][="Sad Sack",=]@@
@@[= "Afternoon =][= =][= =][= =][="Afternoon Delight",=]@@
@@[= "Switch =][= =][= =][= =][="Switch Hitter",=]@@
@@[= "Queen =][= =][= =][= =][="Queen for a Day",=]@@
@@[= "Burning =][= =][= =][= =][="Burning Love",=]@@
@@[= "Ready, =][= =][= =][= =][="Ready, Aim, Marry Me",=]@@
@@[= "Out =][= =][= =][= =][="Out on a Limb",=]@@
@@[= "Hand =][= =][= =][= =][="Hand to God",=]@@
@@[= "Motherboy =][= =][= =][= =][="Motherboy XXX",=]@@
@@[= "The =][= =][= =][= =][="The Immaculate Election",=]@@
@@[= "Sword =][= =][= =][= =][="Sword of Destiny",=]@@
@@[= "Meat =][= =][= =][= =][="Meat the Veals",=]@@
@@[= "Spring =][= =][= =][= =][="Spring Breakout",=]@@
@@[= "Righteous =][= =][= =][= =][="Righteous Brothers",=]@@
@@[= },=]@@
=][= =][=},=]@@
@@[= {=]@@
=][= =][={=]@@
@@[= "The =][= =][= =][= =][="The Cabin Show",=]@@
@@[= "For =][= =][= =][= =][="For British Eyes Only",=]@@
@@[= "Forget-Me-Now",=]@@
=][= =][= =][= =][="Forget-Me-Now",=]@@
@@[= "Notapusy",=]@@
=][= =][= =][= =][="Notapusy",=]@@
@@[= "Mr.=][= =][= =][= =][="Mr. F",=]@@
@@[= "The =][= =][= =][= =][="The Ocean Walker",=]@@
@@[= "Prison =][= =][= =][= =][="Prison Break-In",=]@@
@@[= "Making =][= =][= =][= =][="Making a Stand",=]@@
@@[= "S.=][= =][= =][= =][="S.O.B.s",=]@@
@@[= "Fakin' =][= =][= =][= =][="Fakin' It",=]@@
@@[= "Family =][= =][= =][= =][="Family Ties",=]@@
@@[= "Exit =][= =][= =][= =][="Exit Strategy",=]@@
@@[= "Development =][= =][= =][= =][="Development Arrested"=]@@
@@[= },=]@@=][= =][=},=]@@



@@[=local tokens=]=[={}=]@@

to:

@@[=local tokens=]=[={}=]@@tokens={}=]@@



@@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= --whose article titles end with "(Arrested Development)"=]@@
@@[= local disambigeps=]=[={=]@@
@@[= {1,2,8,11,20,21,22}, --Season 1=]@@
@@[= {5,6,8,9,11,12,18}, --Season 2=]@@
@@[= {10,11,12} --Season 3=]@@
@@[= }=]@@

to:

@@[= --Numbers =][= =][=--Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= --whose =][= =][=--whose article titles end with "(Arrested Development)"=]@@
@@[= local disambigeps=]=[={=]@@
=][= =][=local disambigeps={=]@@
@@[= {1,2,8,11,20,21,22}, =][= =][= =][= =][={1,2,8,11,20,21,22}, --Season 1=]@@
@@[= {5,6,8,9,11,12,18}, =][= =][= =][= =][={5,6,8,9,11,12,18}, --Season 2=]@@
@@[= {10,11,12} =][= =][= =][= =][={10,11,12} --Season 3=]@@
@@[= }=]@@=][= =][=}=]@@



@@[= --construct lookup table=]@@
@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= --construct =][= =][=--construct lookup table=]@@
@@[= local disambiguated=]=[={}=]@@
=][= =][=local disambiguated={}=]@@
@@[= for s=]=[=1,#disambigeps =][= =][=for s=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
=][= =][= =][= =][=disambiguated[s]={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= =][= =][= =][= =][=for i=1,#disambigeps[s] do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
=][= =][= =][= =][= =][= =][=disambiguated[s][disambigeps[s][i]]=true=]@@
@@[= end=]@@
=][= =][= =][= =][=end=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= --Function that returns the Wikipedia URL=]@@
@@[= function tokens.wikipedia(s,e)=]@@
@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@
@@[= --Technically, parentheses don't have to be percent-encoded=]@@
@@[= --for HTTP URIs because they're unused sub-delims=]@@
@@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= --the function that percent-encodes all sub-delims=]@@
@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= end=]@@

to:

@@[= --Function =][= =][=--Function that returns the Wikipedia URL=]@@
@@[= function =][= =][=function tokens.wikipedia(s,e)=]@@
@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
=][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= pagename=]=[=string.=][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.=][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= =][= =][= =][= =][=if disambiguated[s][e] then=]@@
@@[= --Technically, =][= =][= =][= =][= =][= =][=--Technically, parentheses don't have to be percent-encoded=]@@
@@[= --for =][= =][= =][= =][= =][= =][=--for HTTP URIs because they're unused sub-delims=]@@
@@[= --per =][= =][= =][= =][= =][= =][=--per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= --the =][= =][= =][= =][= =][= =][=--the function that percent-encodes all sub-delims=]@@
@@[= pagename=]=[=pagename..=][= =][= =][= =][= =][= =][=pagename=pagename.."_(Arrested_Development)"=]@@
@@[= end=]@@=][= =][= =][= =][=end=]@@



@@[= return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= end=]@@

to:

@@[= return =][= =][= =][= =][=return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@

to:

@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
=][= =][= =][= =][=local pagename=adeps[s][e]=]@@
@@[= pagename=]=[=string.=][= =][= =][= =][=pagename=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.=][= =][= =][= =][=pagename=urlencode.string(pagename)=]@@
@@[= return =][= =][= =][= =][=return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@



@@[= --Season 1 episodes that are listed at different numbers=]@@
@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@

to:

@@[= --Season =][= =][=--Season 1 episodes that are listed at different numbers=]@@
@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 =][= =][=local s1flips={ [5]=6, [6]=5, [7]=8, [8]=7, [16]=18, [17]=16, [18]=17 }=]@@



@@[= --Function the returns the URL of the episode's page on the-op.com=]@@
@@[= function tokens.theop(s,e)=]@@
@@[= --correct OutOfOrder Season 1 episodes=]@@
@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= end=]@@

to:

@@[= --Function =][= =][=--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= function =][= =][=function tokens.theop(s,e)=]@@
@@[= --correct =][= =][= =][= =][=--correct OutOfOrder Season 1 episodes=]@@
@@[= if s=]=[==]=[=1 =][= =][= =][= =][=if s==1 then e =]=[= s1flips[e=]][= = s1flips[e] or e end=]@@
@@[= return =][= =][= =][= =][=return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
com/episode/%i%02i",s,e)=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= --that I have to use you=]@@
@@[= local ttnums=]=[={=]@@
@@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= 0515232, 0515224, },=]@@
@@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= 0515227, 0515245, 0515241, },=]@@
@@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= 0515217, 0515215, 0757386, }=]@@
@@[= }=]@@

to:

@@[= --why =][= =][=--why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= --that =][= =][=--that I have to use you=]@@
@@[= local ttnums=]=[={=]@@
=][= =][=local ttnums={=]@@
@@[= { =][= =][= =][= =][={ 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= 0515214, =][= =][= =][= =][= =][= =][=0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= 0515238, =][= =][= =][= =][= =][= =][=0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= 0515228, =][= =][= =][= =][= =][= =][=0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= 0515232, =][= =][= =][= =][= =][= =][=0515232, 0515224, },=]@@
@@[= { =][= =][= =][= =][={ 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= 0515207, =][= =][= =][= =][= =][= =][=0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= 0515234, =][= =][= =][= =][= =][= =][=0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= 0515227, =][= =][= =][= =][= =][= =][=0515227, 0515245, 0515241, },=]@@
@@[= { =][= =][= =][= =][={ 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= 0515252, =][= =][= =][= =][= =][= =][=0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= 0515217, =][= =][= =][= =][= =][= =][=0515217, 0515215, 0757386, }=]@@
@@[= }=]@@=][= =][=}=]@@



@@[= --Function that returns the URL for the episode's IMDB page=]@@
@@[= function tokens.imdb(s,e)=]@@
@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= end=]@@

to:

@@[= --Function =][= =][=--Function that returns the URL for the episode's IMDB page=]@@
@@[= function =][= =][=function tokens.imdb(s,e)=]@@
@@[= return =][= =][= =][= =][=return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
com/title/tt%07i/",ttnums[s][e])=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= local watchnums=]=[={=]@@
@@[= { 589, 1786, 585, 1781, 1785,=]@@
@@[= 580, 590, 588, 586, 575,=]@@
@@[= 576, 579, 577, 644, 1783,=]@@
@@[= 591, 582, 584, 578, 581,=]@@
@@[= 583, 587},=]@@
@@[= { 6641, 6644, 6643, 6638, 6639,=]@@
@@[= 12883, 13226, 12561, 12609, 12298,=]@@
@@[= 12271, 12901, 13248, 13267, 13276,=]@@
@@[= 13206, 12232, 12532},=]@@
@@[= { 6640, 6642, 6635, 6636, 6637,=]@@
@@[= 12497, 17189, 12523, 13139, 12225,=]@@
@@[= 12317, 12194, 12215},=]@@
@@[= }=]@@

to:

@@[= local watchnums=]=[={=]@@
=][= =][=local watchnums={=]@@
@@[= { 589, 1786, 585, 1781, =][= =][= =][= =][={ 589, 1786, 585, 1781, 1785,=]@@
@@[= 580, 590, 588, 586, =][= =][= =][= =][= =][= =][= =][= =][= =][=580, 590, 588, 586, 575,=]@@
@@[= 576, 579, 577, 644, =][= =][= =][= =][= =][= =][= =][= =][= =][=576, 579, 577, 644, 1783,=]@@
@@[= 591, 582, 584, 578, =][= =][= =][= =][= =][= =][= =][= =][= =][=591, 582, 584, 578, 581,=]@@
@@[= 583, =][= =][= =][= =][= =][= =][= =][= =][= =][=583, 587},=]@@
@@[= { 6641, 6644, 6643, 6638, =][= =][= =][= =][={ 6641, 6644, 6643, 6638, 6639,=]@@
@@[= 12883, =][= =][= =][= =][= =][= =][= =][=12883, 13226, 12561, 12609, 12298,=]@@
@@[= 12271, =][= =][= =][= =][= =][= =][= =][=12271, 12901, 13248, 13267, 13276,=]@@
@@[= 13206, =][= =][= =][= =][= =][= =][= =][=13206, 12232, 12532},=]@@
@@[= { 6640, 6642, 6635, 6636, =][= =][= =][= =][={ 6640, 6642, 6635, 6636, 6637,=]@@
@@[= 12497, =][= =][= =][= =][= =][= =][= =][=12497, 17189, 12523, 13139, 12225,=]@@
@@[= 12317, =][= =][= =][= =][= =][= =][= =][=12317, 12194, 12215},=]@@
@@[= }=]@@=][= =][=}=]@@



@@[= function tokens.hulu(s,e)=]@@
@@[= return string.format(=]@@
@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= end=]@@

to:

@@[= function =][= =][=function tokens.hulu(s,e)=]@@
@@[= return =][= =][= =][= =][=return string.format(=]@@
@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
=][= =][= =][= =][= =][= =][="http://hulu.com/watch/%i", watchnums[s][e])=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= --It's largely sequential, but not quite.=]@@
@@[= --I printed out all the numbers and moved them around=]@@
@@[= --to fit the correct order (which is both inconsistent=]@@
@@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= local movieids=]=[={=]@@
@@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= 70133693, 70133694, },=]@@
@@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= 70133709, 70133710, 70133712, },=]@@
@@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= 70133723, 70133724, 70133725, }=]@@
@@[= }=]@@

to:

@@[= --It's =][= =][=--It's largely sequential, but not quite.=]@@
@@[= --I =][= =][=--I printed out all the numbers and moved them around=]@@
@@[= --to =][= =][=--to fit the correct order (which is both inconsistent=]@@
@@[= --in =][= =][=--in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= local movieids=]=[={=]@@
=][= =][=local movieids={=]@@
@@[= { =][= =][= =][= =][={ 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= 70133678, =][= =][= =][= =][= =][= =][=70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= 70133683, =][= =][= =][= =][= =][= =][=70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= 70133688, =][= =][= =][= =][= =][= =][=70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= 70133693, =][= =][= =][= =][= =][= =][=70133693, 70133694, },=]@@
@@[= { =][= =][= =][= =][={ 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= 70133700, =][= =][= =][= =][= =][= =][=70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= 70133705, =][= =][= =][= =][= =][= =][=70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= 70133709, =][= =][= =][= =][= =][= =][=70133709, 70133710, 70133712, },=]@@
@@[= { =][= =][= =][= =][={ 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= 70133718, =][= =][= =][= =][= =][= =][=70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= 70133723, =][= =][= =][= =][= =][= =][=70133723, 70133724, 70133725, }=]@@
@@[= }=]@@=][= =][=}=]@@



@@[= function tokens.netflix(s,e)=]@@
@@[= return string.format(=]@@
@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= end=]@@

to:

@@[= function =][= =][=function tokens.netflix(s,e)=]@@
@@[= return =][= =][= =][= =][=return string.format(=]@@
@@[= "http://www.=][= =][= =][= =][= =][= =][="http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
com/WiPlayer?movieid=%i",movieids[s][e])=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@

to:

@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
=][= =][=local template=[=[=]@@
@@[=%%STARTLINKS%%=]@@



@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@

to:

@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= Wikipedia]] -- [[$wikia Wikia=]][==]][= Wikia]] -- [[$theop Balboa Observer-Picayune=]][==]][= Observer-Picayune]] -- [[$imdb IMDB=]][==]][==]@@IMDB]]=]@@



@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@

to:

@@[=Watch now: [[$hulu Hulu=]][==]][= Hulu]] -- [[$netflix Netflix=]][==]][==]@@Netflix]]=]@@



@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= function ad_ep_links(s,e)=]@@
@@[= return (string.gsub(template,"=]%[=$(=]%[=w+ )",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= end=]@@

to:

@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[=%%ENDLINKS%%=]@@
@@[=]=]=]@@
@@[= function =][= =][=function ad_ep_links(s,e)=]@@
@@[= return =][= =][= =][= =][=return (string.gsub(template,"=]%[=$(=]%[=w+ )",function(token) gsub(template,"%$(%w+)",function(token) return tokens[token=]][=(s,e) tokens[token](s,e) end))=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= --get the ep title=]@@
@@[= local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= --replace the é in Beef Consommé=]@@
@@[= title=]=[=string.gsub(title,'é','e')=]@@
@@[= --transform to CamelCased WikiWord=]@@
@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= --Remove all non-alphanumeric characters=]@@
@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@

to:

@@[= --get =][= =][=--get the ep title=]@@
@@[= local title=]=[=adeps[s=]][=[e=]][==]@@
=][= =][=local title=adeps[s][e]=]@@
@@[= --replace =][= =][=--replace the é in Beef Consommé=]@@
@@[= title=]=[=string.=][= =][=title=string.gsub(title,'é','e')=]@@
@@[= --transform =][= =][=--transform to CamelCased WikiWord=]@@
@@[= title=]=[=string.=][= =][=title=string.gsub(title,' (=]%[=l?)',string.(%l?)',string.upper)=]@@
@@[= --Remove =][= =][=--Remove all non-alphanumeric characters=]@@
@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@=][= =][=title=string.gsub(title,'%W','')=]@@



@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@

to:

@@[= return =][= =][=return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@format("Recap/ArrestedDevelopmentS%iE%i%s",s,e,title)=]@@



@@[= return tvtropes.post(=]@@
@@[= recap_pagename(s,e),=]@@
@@[= string.format(=]@@
@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= "STUART",=]@@
@@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@

to:

@@[= return =][= =][=return tvtropes.post(=]@@
@@[= recap_pagename(s,e),=]@@
=][= =][= =][= =][=recap_pagename(s,e),=]@@
@@[= string.=][= =][= =][= =][=string.format(=]@@
@@[= "\n\n=]%[=s\n!The =][= =][= =][= =][= =][= =][="\n\n%s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" \"%s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
=][= =][= =][= =][= =][= =][= =][= =][=ad_ep_links(s,e),adeps[s][e]),=]@@
@@[= "STUART",=]@@
=][= =][= =][= =][="STUART",=]@@
@@[= "Adding =][= =][= =][= =][="Adding interwiki links and example header automatically (Ask me about Lua)")=]@@



@@[= return function(s,e)=]@@
@@[= --until comment syntax is changed, Amigos is manual-only=]@@
@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= else=]@@
@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= local success=]@@
@@[= while not success do=]@@
@@[= local code=]@@
@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= "STUART",reason)=]@@
@@[= if not success then print("Retrying... "..code) end=]@@
@@[= end=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= return =][= =][=return function(s,e)=]@@
@@[= --until =][= =][= =][= =][=--until comment syntax is changed, Amigos is manual-only=]@@
@@[= if s=]=[==]=[=2 =][= =][= =][= =][=if s==2 and e=]=[==]=[=3 e==3 then=]@@
@@[= print =][= =][= =][= =][= =][= =][=print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= else=]@@
=][= =][= =][= =][=else=]@@
@@[= local pagename=]=[=recap_pagename(s,e)=]@@
=][= =][= =][= =][= =][= =][=local pagename=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.=][= =][= =][= =][= =][= =][=local pageasis=tvtropes.get(pagename)=]@@
@@[= local =][= =][= =][= =][= =][= =][=local gsubsafelinks =]=[= = string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
gsub(ad_ep_links(s,e),"%%","%%%%")=]@@
@@[= local =][= =][= =][= =][= =][= =][=local success=]@@
@@[= while =][= =][= =][= =][= =][= =][=while not success do=]@@
@@[= local =][= =][= =][= =][= =][= =][= =][= =][=local code=]@@
@@[= success, =][= =][= =][= =][= =][= =][= =][= =][=success, code =]=[= = tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
=][= =][= =][= =][= =][= =][= =][= =][= =][= =][=string.gsub(pageasis,"%%%%STARTLINKS%%%%.-%%%%ENDLINKS%%%%",gsubsafelinks),=]@@
@@[= "STUART",reason)=]@@
=][= =][= =][= =][= =][= =][= =][= =][= =][= =][="STUART",reason)=]@@
@@[= if =][= =][= =][= =][= =][= =][= =][= =][=if not success then print("Retrying... "..code) end=]@@
@@[= end=]@@
=][= =][= =][= =][= =][= =][=end=]@@
@@[= end=]@@
=][= =][= =][= =][=end=]@@
@@[= end=]@@=][= =][=end=]@@



@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= f(s,e)=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= for s=]=[=1,#adeps =][= =][=for s=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= =][= =][= =][= =][=for e=1,#adeps[s] do=]@@
@@[= print(string.=][= =][= =][= =][= =][= =][=print(string.format('Doing Season =]%[=i %i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
%i, "%s"...',s,e,adeps[s][e]))=]@@
@@[= f(s,e)=]@@
=][= =][= =][= =][= =][= =][=f(s,e)=]@@
@@[= end=]@@
=][= =][= =][= =][=end=]@@
@@[= end=]@@=][= =][=end=]@@
Is there an issue? Send a MessageReason:
None


@@[= --(except for space, which gets plus-encoded)=]@@

to:

@@[= --(except for space, which gets gets plus-encoded)=]@@
Is there an issue? Send a MessageReason:
None


@@[= --(except for space, which gets plus-encoded)=]@@

to:

@@[= --(except for space, which gets gets plus-encoded)=]@@
Is there an issue? Send a MessageReason:
None


@@[= =][=--Ensure all newlines are in CRLF form=]@@

to:

@@[= =][=--Ensure --Ensure all newlines are in CRLF form=]@@
Is there an issue? Send a MessageReason:
None


@@[= =][= =][=--Ensure all newlines are in CRLF form=]@@

to:

@@[= =][= @@[= =][=--Ensure all newlines are in CRLF form=]@@
Is there an issue? Send a MessageReason:
None


@@[= =][= =]--Ensure all newlines are in CRLF form=]@@

to:

@@[= =][= =]--Ensure =][=--Ensure all newlines are in CRLF form=]@@
Is there an issue? Send a MessageReason:
None


@@[= --Ensure all newlines are in CRLF form=]@@

to:

@@[= --Ensure =][= =]--Ensure all newlines are in CRLF form=]@@
Is there an issue? Send a MessageReason:
None


* ArrestedDevelopment
* {{Blackadder}} (including ''Back and Forth'')
* TheCritic
* DeadLikeMe (not including ''Life After Death'')
* {{Dollhouse}}
* {{Firefly}}
* [[{{Freakazoid}} Freakazoid!]]
* {{Futurama}} (up through the four movies)
* GilligansIsland
* LifeOnMars (the British one, obviously)
* LookAroundYou
* PeepShow
* PoliceSquad
* PushingDaisies
* {{Spaced}}
* TheWire

to:

* * ArrestedDevelopment
* * {{Blackadder}} (including ''Back and Forth'')
* * TheCritic
* * DeadLikeMe (not including ''Life After Death'')
* * {{Dollhouse}}
* * {{Firefly}}
* * [[{{Freakazoid}} Freakazoid!]]
* * {{Futurama}} (up through the four movies)
* * GilligansIsland
* * LifeOnMars (the British one, obviously)
* * LookAroundYou
* * PeepShow
* * PoliceSquad
* * PushingDaisies
* * {{Spaced}}
* * {{Stella}}
*
TheWire



* TheATeam (through season one)
* {{Reaper}} (through season one)

to:

* * TheATeam (through season one)
* * {{Reaper}} (through season one)
* [[{{Reno911}} Reno 911!]]



* {{Community}} (one season)
* {{Archer}} (one season)

to:

* * {{Community}} (one season)
* * {{Archer}} (one season)
Is there an issue? Send a MessageReason:
None


Use Tropers/STUARTDiscussion to talk to me, and maybe [[http://tvtropes.org/pmwiki/wiki_pm.php send a PM]] to notify.

to:

Use Tropers/STUARTDiscussion to talk to me, and maybe [[http://tvtropes.org/pmwiki/wiki_pm.php send a PM]] PM (that little envelope icon next to notify.
"Contributor's Page") to notify so I know you did.



@@[=local urlencode=]=[={}=]@@

to:

@@[=local urlencode=]=[={}=]@@



@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@

to:

@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@



@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@

to:

@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@



@@[=urlencode.string =]=[= encode=]@@

to:

@@[=urlencode.string =]=[= encode=]@@



@@[= local argts, i=]=[= {}, 1=]@@

to:

@@[= local argts, i=]=[= {}, 1=]@@



@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+ 1=]@@

to:

@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+ 1=]@@



@@[=local http =]=[= require"socket.http"=]@@

to:

@@[=local http =]=[= require"socket.http"=]@@



@@[=local urlencode =]=[= require "urlencode"=]@@

to:

@@[=local urlencode =]=[= require "urlencode"=]@@



@@[=local tvtropes=]=[={}=]@@

to:

@@[=local tvtropes=]=[={}=]@@



@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@

to:

@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@



@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@

to:

@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= page=]=[=fullname(page)=]@@



@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@

to:

@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@



@@[= local response =]=[==]@@

to:

@@[= local response =]=[==]@@



@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@

to:

@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@



@@[= assert(response[1=]][=,response[2=]][=)=]@@

to:

@@[= assert(response[1=]][=,response[2=]][=)=]@@



@@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@

to:

@@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@



@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@

to:

@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@



@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@

to:

@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= page=]=[=fullname(page)=]@@



@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@

to:

@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@



@@[=local tvtropes =]=[= require "tvtropes"=]@@

to:

@@[=local tvtropes =]=[= require "tvtropes"=]@@



@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@

to:

@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@



@@[=local scripts=]=[={=]@@

to:

@@[=local scripts=]=[={=]@@



@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@

to:

@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@



@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@

to:

@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@



@@[= local headers=]=[=#folders=]@@

to:

@@[= local headers=]=[=#folders=]@@



@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@

to:

@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@



@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+ 1=]][==]=[='\\\\'=]@@

to:

@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+ 1=]][==]=[='\\\\'=]@@



@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@

to:

@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@



@@[= slines[#slines+ 1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@

to:

@@[= slines[#slines+ 1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@



@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+ headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@

to:

@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+ headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@



@@[= folders[#folders+ 1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@

to:

@@[= folders[#folders+ 1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@



@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@

to:

@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@



@@[= local current=]=[=tvtropes.get(target)=]@@

to:

@@[= local current=]=[=tvtropes.get(target)=]@@



@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@

to:

@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@



@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@

to:

@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@



@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@

to:

@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@



@@[=local tvtropes=]=[=require "tvtropes"=]@@

to:

@@[=local tvtropes=]=[=require "tvtropes"=]@@



@@[=local urlencode=]=[=require "urlencode"=]@@

to:

@@[=local urlencode=]=[=require "urlencode"=]@@



@@[=adeps=]=[={=]@@

to:

@@[=adeps=]=[={=]@@



@@[=local tokens=]=[={}=]@@

to:

@@[=local tokens=]=[={}=]@@



@@[= local disambigeps=]=[={=]@@

to:

@@[= local disambigeps=]=[={=]@@



@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@

to:

@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@



@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@

to:

@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@



@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@

to:

@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@



@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@

to:

@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@



@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@

to:

@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@



@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@

to:

@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@



@@[= local ttnums=]=[={=]@@

to:

@@[= local ttnums=]=[={=]@@



@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@

to:

@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@



@@[= local watchnums=]=[={=]@@

to:

@@[= local watchnums=]=[={=]@@



@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@

to:

@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@



@@[= local movieids=]=[={=]@@

to:

@@[= local movieids=]=[={=]@@



@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@

to:

@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@



@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@

to:

@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@



@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@

to:

@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@



@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@

to:

@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@



@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@

to:

@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@



@@[= return (string.gsub(template,"=]%[=$(=]%[=w+ )",function(token) return tokens[token=]][=(s,e) end))=]@@

to:

@@[= return (string.gsub(template,"=]%[=$(=]%[=w+ )",function(token) return tokens[token=]][=(s,e) end))=]@@



@@[= local title=]=[=adeps[s=]][=[e=]][==]@@

to:

@@[= local title=]=[=adeps[s=]][=[e=]][==]@@



@@[= title=]=[=string.gsub(title,'é','e')=]@@

to:

@@[= title=]=[=string.gsub(title,'é','e')=]@@



@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@

to:

@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@



@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@

to:

@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@



@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@

to:

@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@



@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@

to:

@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@



@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@

to:

@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@



@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@

to:

@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@



@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@

to:

@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@

Added: 776

Changed: 2971

Removed: 512

Is there an issue? Send a MessageReason:
OK, think I got it now


@@[=local urlencode=]=[={}=]@@

to:

@@[=local urlencode=]=[={}=]@@



@@[= --Ensure all newlines are in CRLF form=]@@
@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= --Percent-encode all non-unreserved characters=]@@
@@[= --as per RFC 3986, Section 2.3=]@@
@@[= --(except for space, which gets plus-encoded)=]@@
@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= --Convert spaces to plus signs=]@@
@@[= return string.gsub (str, " ", "+ ")=]@@

to:

@@[= @@[= --Ensure all newlines are in CRLF form=]@@
@@[= @@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= @@[= --Percent-encode all non-unreserved characters=]@@
@@[= @@[= --as per RFC 3986, Section 2.3=]@@
@@[= @@[= --(except for space, which gets plus-encoded)=]@@
@@[= @@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= @@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= @@[= --Convert spaces to plus signs=]@@
@@[= @@[= return string.gsub (str, " ", "+ ")=]@@"+")=]@@



@@[=urlencode.string =]=[= encode=]@@

to:

@@[=urlencode.string =]=[= encode=]@@



@@[= --table of argument strings=]@@
@@[= local argts, i=]=[= {}, 1=]@@
@@[= for k, v in pairs(t) do=]@@
@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+ 1=]@@
@@[= end=]@@
@@[= return table.concat(argts,'&')=]@@

to:

@@[= @@[= --table of argument strings=]@@
@@[= @@[= local argts, i=]=[= {}, 1=]@@
@@[= @@[= for k, v in pairs(t) do=]@@
@@[= @@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+ 1=]@@
@@[=
@@[= i=]=[=i+1=]@@
@@[=
end=]@@
@@[= @@[= return table.concat(argts,'&')=]@@



@@[=local http =]=[= require"socket.http"=]@@

to:

@@[=local http =]=[= require"socket.http"=]@@



@@[=local urlencode =]=[= require "urlencode"=]@@

to:

@@[=local urlencode =]=[= require "urlencode"=]@@



@@[=local tvtropes=]=[={}=]@@

to:

@@[=local tvtropes=]=[={}=]@@



@@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@

to:

@@[= @@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@



@@[= --Require pagename=]@@
@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= --If no namespace specified, assume Main=]@@
@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@

to:

@@[= @@[= --Require pagename=]@@
@@[= @@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= @@[= --If no namespace specified, assume Main=]@@
@@[= @@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@



@@[= return page=]@@

to:

@@[= @@[= return page=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= @@[= page=]=[=fullname(page)=]@@



@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@

to:

@@[= @@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@



@@[= local response =]=[==]@@
@@[= {http.request(authpageurl(page),=]@@
@@[= urlencode.table{=]@@
@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@
@@[= })}=]@@

to:

@@[= @@[= local response =]=[==]@@
@@[= @@[= {http.request(authpageurl(page),=]@@
@@[= @@[= urlencode.table{=]@@
@@[= @@[= action=]=[="post", post=]=[="save",=]@@
@@[= @@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= @@[= author=]=[=author or "Anonymous",=]@@
@@[= @@[= reason=]=[=reason or ""=]@@
@@[= @@[= })}=]@@



@@[= --Error on any socket errors=]@@
@@[= assert(response[1=]][=,response[2=]][=)=]@@

to:

@@[= @@[= --Error on any socket errors=]@@
@@[= @@[= assert(response[1=]][=,response[2=]][=)=]@@



@@[= --If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= --sometimes it just rejects the password for some reason.=]@@
@@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@
@@[= else return true=]@@
@@[= end=]@@

to:

@@[= @@[= --If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= @@[= --sometimes it just rejects the password for some reason.=]@@
@@[= @@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= @@[= return nil, response[2=]][=, response[1=]][==]@@
@@[= @@[= else return true=]@@
@@[= @@[= end=]@@



@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@

to:

@@[= @@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@



@@[= function html2plain(src)=]@@
@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= return src=]@@
@@[= end=]@@

to:

@@[= @@[= function html2plain(src)=]@@
@@[= @@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= @@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= @@[= return src=]@@
@@[= @@[= end=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= @@[= page=]=[=fullname(page)=]@@



@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@

to:

@@[= @@[= local body, code =]=[= http.request(=]@@
@@[= @@[= authpageurl(page)..'?action=]=[=source')=]@@



@@[= --Trigger error on socket failure=]@@
@@[= assert(body,code)=]@@

to:

@@[= @@[= --Trigger error on socket failure=]@@
@@[= @@[= assert(body,code)=]@@



@@[= --Return the source converted back from the HTML conversion=]@@
@@[= return html2plain(body)=]@@

to:

@@[= @@[= --Return the source converted back from the HTML conversion=]@@
@@[= @@[= return html2plain(body)=]@@



@@[=local tvtropes =]=[= require "tvtropes"=]@@

to:

@@[=local tvtropes =]=[= require "tvtropes"=]@@@@[=--Script that posts the latest version of the TV Tropes=]@@
@@[=--scripts to my contributor page.=]@@



@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@

to:

@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@
@@[=--Any edit to the functionality of this script tends to generate=]@@
@@[=--about fifteen or 20 edits to the page: see ProximalErrorProbability.=]@@



@@[=local scripts=]=[={=]@@
@@[= "urlencode.lua",=]@@
@@[= "tvtropes.lua",=]@@
@@[= "tropersrepo.lua",=]@@
@@[= "arrdev_recap.lua",=]@@
@@[=}=]@@

to:

@@[=local scripts=]=[={=]@@
@@[= "urlencode.lua",=]@@
@@[= "tvtropes.lua",=]@@
@@[= "tropersrepo.lua",=]@@
@@[= "arrdev_recap.lua",=]@@
@@[=}=]@@
tvtropes =]=[= require "tvtropes"=]@@



@@[=local function scriptfolder(name,script)=]@@
@@[= return string.format(=]@@
@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= name,script)=]@@
@@[=end=]@@

to:

@@[=local function scriptfolder(name,script)=]@@
@@[= return string.format(=]@@
@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= name,script)=]@@
@@[=end=]@@
target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@



@@[=local function revsection()=]@@
@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@
@@[= }=]@@
@@[= local headers=]=[=#folders=]@@

to:

@@[=local function revsection()=]@@
@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@
@@[= }=]@@
@@[= local headers=]=[=#folders=]@@
scripts=]=[={=]@@
@@[= "urlencode.lua",=]@@
@@[= "tvtropes.lua",=]@@
@@[= "tropersrepo.lua",=]@@
@@[= "arrdev_recap.lua",=]@@
@@[=}=]@@



@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@

to:

@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@
@@[=local function scriptfolder(name,script)=]@@
@@[= return string.format(=]@@
@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= name,script)=]@@
@@[=end=]@@



@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+ 1=]][==]=[='\\\\'=]@@
@@[= else=]@@
@@[= --escape all equals signs and percents=]@@
@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@

to:

@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+ 1=]][==]=[='\\\\'=]@@
@@[= else=]@@
@@[= --escape all equals signs and percents=]@@
@@[=
@@[=local function revsection()=]@@
@@[=
local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@
folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@
@@[= }=]@@
@@[= local headers=]=[=#folders=]@@



@@[= slines[#slines+ 1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= slines[#slines+ 1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= end=]@@
@@[= end=]@@
@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@



@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+ headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= end=]@@

to:

@@[= @@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+1=]][==]=[='\\\\'=]@@
@@[= else=]@@
@@[= --escape all equals signs and percents=]@@
@@[=
local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+ headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= end=]@@
escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@



@@[= folders[#folders+ 1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@

to:

@@[= folders[#folders+ 1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@@@[= slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= end=]@@
@@[= end=]@@



@@[= return table.concat(folders,"\n\n")=]@@
@@[=end=]@@

to:

@@[= return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= end=]@@



@@[=local function push(notes)=]@@
@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[=local function push(notes)=]@@
@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@



@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@

to:

@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@@@[= return table.concat(folders,"\n\n")=]@@
@@[=end=]@@



@@[= local current=]=[=tvtropes.get(target)=]@@

to:

@@[= @@[=local function push(notes)=]@@
@@[=
local current=]=[=tvtropes.get(target)=]@@gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= gssscripts)=]@@

to:

@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= gssscripts)=]@@
@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@



@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@

to:

@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@@@[= local current=]=[=tvtropes.get(target)=]@@



@@[= local posted=]@@
@@[= while not posted do=]@@
@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= if not posted then print" Retrying..." end=]@@
@@[= end=]@@
@@[=end=]@@

to:

@@[= @@[= local posted=]@@
@@[= while not posted do=]@@
@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= if not posted then print" Retrying..." end=]@@
@@[= end=]@@
@@[=end=]@@
updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= gssscripts)=]@@



@@[=--Executing code---------------------------------------------------------------=]@@

to:

@@[=--Executing code---------------------------------------------------------------=]@@@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@



@@[=push "OK, think I got it now"=]@@

to:

@@[=push "OK, think I got it now"=]@@@@[= local posted=]@@
@@[= while not posted do=]@@
@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= if not posted then print" Retrying..." end=]@@
@@[= end=]@@
@@[=end=]@@



@@[=--Executing code---------------------------------------------------------------=]@@



@@[=push "OK, think I got it now"=]@@
\\
\\



@@[=local tvtropes=]=[=require "tvtropes"=]@@

to:

@@[=local tvtropes=]=[=require "tvtropes"=]@@



@@[=local urlencode=]=[=require "urlencode"=]@@

to:

@@[=local urlencode=]=[=require "urlencode"=]@@



@@[=adeps=]=[={=]@@
@@[= {=]@@
@@[= "Pilot",=]@@
@@[= "Top Banana",=]@@
@@[= "Bringing Up Buster",=]@@
@@[= "Key Decisions",=]@@
@@[= "Visiting Ours",=]@@
@@[= "Charity Drive",=]@@
@@[= "My Mother, The Car",=]@@
@@[= "In God We Trust",=]@@
@@[= "Storming the Castle",=]@@
@@[= "Pier Pressure",=]@@
@@[= "Public Relations",=]@@
@@[= "Marta Complex",=]@@
@@[= "Beef Consommé",=]@@
@@[= "Shock and Aww",=]@@
@@[= "Staff Infection",=]@@
@@[= "Missing Kitty",=]@@
@@[= "Altar Egos",=]@@
@@[= "Justice Is Blind",=]@@
@@[= "Best Man for the GOB",=]@@
@@[= "Whistler's Mother",=]@@
@@[= "Not Without My Daughter",=]@@
@@[= "Let 'Em Eat Cake"=]@@
@@[= },=]@@
@@[= {=]@@
@@[= "The One Where Michael Leaves",=]@@
@@[= "The One Where They Build a House",=]@@
@@[= "¡Amigos!",=]@@
@@[= "Good Grief",=]@@
@@[= "Sad Sack",=]@@
@@[= "Afternoon Delight",=]@@
@@[= "Switch Hitter",=]@@
@@[= "Queen for a Day",=]@@
@@[= "Burning Love",=]@@
@@[= "Ready, Aim, Marry Me",=]@@
@@[= "Out on a Limb",=]@@
@@[= "Hand to God",=]@@
@@[= "Motherboy XXX",=]@@
@@[= "The Immaculate Election",=]@@
@@[= "Sword of Destiny",=]@@
@@[= "Meat the Veals",=]@@
@@[= "Spring Breakout",=]@@
@@[= "Righteous Brothers",=]@@
@@[= },=]@@
@@[= {=]@@
@@[= "The Cabin Show",=]@@
@@[= "For British Eyes Only",=]@@
@@[= "Forget-Me-Now",=]@@
@@[= "Notapusy",=]@@
@@[= "Mr. F",=]@@
@@[= "The Ocean Walker",=]@@
@@[= "Prison Break-In",=]@@
@@[= "Making a Stand",=]@@
@@[= "S.O.B.s",=]@@
@@[= "Fakin' It",=]@@
@@[= "Family Ties",=]@@
@@[= "Exit Strategy",=]@@
@@[= "Development Arrested"=]@@
@@[= },=]@@

to:

@@[=adeps=]=[={=]@@
@@[= @@[= {=]@@
@@[= @@[= "Pilot",=]@@
@@[= @@[= "Top Banana",=]@@
@@[= @@[= "Bringing Up Buster",=]@@
@@[= @@[= "Key Decisions",=]@@
@@[= @@[= "Visiting Ours",=]@@
@@[= @@[= "Charity Drive",=]@@
@@[= @@[= "My Mother, The Car",=]@@
@@[= @@[= "In God We Trust",=]@@
@@[= @@[= "Storming the Castle",=]@@
@@[= @@[= "Pier Pressure",=]@@
@@[= @@[= "Public Relations",=]@@
@@[= @@[= "Marta Complex",=]@@
@@[= @@[= "Beef Consommé",=]@@
@@[= @@[= "Shock and Aww",=]@@
@@[= @@[= "Staff Infection",=]@@
@@[= @@[= "Missing Kitty",=]@@
@@[= @@[= "Altar Egos",=]@@
@@[= @@[= "Justice Is Blind",=]@@
@@[= @@[= "Best Man for the GOB",=]@@
@@[= @@[= "Whistler's Mother",=]@@
@@[= @@[= "Not Without My Daughter",=]@@
@@[= @@[= "Let 'Em Eat Cake"=]@@
@@[= @@[= },=]@@
@@[= @@[= {=]@@
@@[= @@[= "The One Where Michael Leaves",=]@@
@@[= @@[= "The One Where They Build a House",=]@@
@@[= @@[= "¡Amigos!",=]@@
@@[= @@[= "Good Grief",=]@@
@@[= @@[= "Sad Sack",=]@@
@@[= @@[= "Afternoon Delight",=]@@
@@[= @@[= "Switch Hitter",=]@@
@@[= @@[= "Queen for a Day",=]@@
@@[= @@[= "Burning Love",=]@@
@@[= @@[= "Ready, Aim, Marry Me",=]@@
@@[= @@[= "Out on a Limb",=]@@
@@[= @@[= "Hand to God",=]@@
@@[= @@[= "Motherboy XXX",=]@@
@@[= @@[= "The Immaculate Election",=]@@
@@[= @@[= "Sword of Destiny",=]@@
@@[= @@[= "Meat the Veals",=]@@
@@[= @@[= "Spring Breakout",=]@@
@@[= @@[= "Righteous Brothers",=]@@
@@[= @@[= },=]@@
@@[= @@[= {=]@@
@@[= @@[= "The Cabin Show",=]@@
@@[= @@[= "For British Eyes Only",=]@@
@@[= @@[= "Forget-Me-Now",=]@@
@@[= @@[= "Notapusy",=]@@
@@[= @@[= "Mr. F",=]@@
@@[= @@[= "The Ocean Walker",=]@@
@@[= @@[= "Prison Break-In",=]@@
@@[= @@[= "Making a Stand",=]@@
@@[= @@[= "S.O.B.s",=]@@
@@[= @@[= "Fakin' It",=]@@
@@[= @@[= "Family Ties",=]@@
@@[= @@[= "Exit Strategy",=]@@
@@[= @@[= "Development Arrested"=]@@
@@[= @@[= },=]@@



@@[=local tokens=]=[={}=]@@

to:

@@[=local tokens=]=[={}=]@@



@@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= --whose article titles end with "(Arrested Development)"=]@@
@@[= local disambigeps=]=[={=]@@
@@[= {1,2,8,11,20,21,22}, --Season 1=]@@
@@[= {5,6,8,9,11,12,18}, --Season 2=]@@
@@[= {10,11,12} --Season 3=]@@
@@[= }=]@@

to:

@@[= @@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= @@[= --whose article titles end with "(Arrested Development)"=]@@
@@[= @@[= local disambigeps=]=[={=]@@
@@[= @@[= {1,2,8,11,20,21,22}, --Season 1=]@@
@@[= @@[= {5,6,8,9,11,12,18}, --Season 2=]@@
@@[= @@[= {10,11,12} --Season 3=]@@
@@[= @@[= }=]@@



@@[= --construct lookup table=]@@
@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= @@[= --construct lookup table=]@@
@@[= @@[= local disambiguated=]=[={}=]@@
@@[= @@[= for s=]=[=1,#disambigeps do=]@@
@@[= @@[= disambiguated[s=]][==]=[={}=]@@
@@[= @@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= @@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= @@[= end=]@@
@@[= @@[= end=]@@



@@[= --Function that returns the Wikipedia URL=]@@
@@[= function tokens.wikipedia(s,e)=]@@
@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@
@@[= --Technically, parentheses don't have to be percent-encoded=]@@
@@[= --for HTTP URIs because they're unused sub-delims=]@@
@@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= --the function that percent-encodes all sub-delims=]@@
@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= end=]@@

to:

@@[= @@[= --Function that returns the Wikipedia URL=]@@
@@[= @@[= function tokens.wikipedia(s,e)=]@@
@@[= @@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= @@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= @@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= @@[= if disambiguated[s=]][=[e=]][= then=]@@
@@[= @@[= --Technically, parentheses don't have to be percent-encoded=]@@
@@[= @@[= --for HTTP URIs because they're unused sub-delims=]@@
@@[= @@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= @@[= --the function that percent-encodes all sub-delims=]@@
@@[= @@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= @@[= end=]@@



@@[= return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= end=]@@

to:

@@[= @@[= return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= @@[= end=]@@



@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@

to:

@@[= @@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= @@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= @@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= @@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@



@@[= --Season 1 episodes that are listed at different numbers=]@@
@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@

to:

@@[= @@[= --Season 1 episodes that are listed at different numbers=]@@
@@[= @@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@



@@[= --Function the returns the URL of the episode's page on the-op.com=]@@
@@[= function tokens.theop(s,e)=]@@
@@[= --correct OutOfOrder Season 1 episodes=]@@
@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= end=]@@

to:

@@[= @@[= --Function the returns the URL of the episode's page on the-op.com=]@@
@@[= @@[= function tokens.theop(s,e)=]@@
@@[= @@[= --correct OutOfOrder Season 1 episodes=]@@
@@[= @@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= @@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= @@[= end=]@@



@@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= --that I have to use you=]@@
@@[= local ttnums=]=[={=]@@
@@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= 0515232, 0515224, },=]@@
@@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= 0515227, 0515245, 0515241, },=]@@
@@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= 0515217, 0515215, 0757386, }=]@@
@@[= }=]@@

to:

@@[= @@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= @@[= --that I have to use you=]@@
@@[= @@[= local ttnums=]=[={=]@@
@@[= @@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= @@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= @@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= @@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= @@[= 0515232, 0515224, },=]@@
@@[= @@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= @@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= @@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= @@[= 0515227, 0515245, 0515241, },=]@@
@@[= @@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= @@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= @@[= 0515217, 0515215, 0757386, }=]@@
@@[= @@[= }=]@@



@@[= --Function that returns the URL for the episode's IMDB page=]@@
@@[= function tokens.imdb(s,e)=]@@
@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= end=]@@

to:

@@[= @@[= --Function that returns the URL for the episode's IMDB page=]@@
@@[= @@[= function tokens.imdb(s,e)=]@@
@@[= @@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= @@[= end=]@@



@@[= local watchnums=]=[={=]@@
@@[= { 589, 1786, 585, 1781, 1785,=]@@
@@[= 580, 590, 588, 586, 575,=]@@
@@[= 576, 579, 577, 644, 1783,=]@@
@@[= 591, 582, 584, 578, 581,=]@@
@@[= 583, 587},=]@@
@@[= { 6641, 6644, 6643, 6638, 6639,=]@@
@@[= 12883, 13226, 12561, 12609, 12298,=]@@
@@[= 12271, 12901, 13248, 13267, 13276,=]@@
@@[= 13206, 12232, 12532},=]@@
@@[= { 6640, 6642, 6635, 6636, 6637,=]@@
@@[= 12497, 17189, 12523, 13139, 12225,=]@@
@@[= 12317, 12194, 12215},=]@@
@@[= }=]@@

to:

@@[= @@[= local watchnums=]=[={=]@@
@@[= { 589, 1786, 585, 1781, @@[= { 589, 1786, 585, 1781, 1785,=]@@
@@[= 580, 590, 588, 586, @@[= 580, 590, 588, 586, 575,=]@@
@@[= 576, 579, 577, 644, @@[= 576, 579, 577, 644, 1783,=]@@
@@[= 591, 582, 584, 578, @@[= 591, 582, 584, 578, 581,=]@@
@@[= 583, @@[= 583, 587},=]@@
@@[= { 6641, 6644, 6643, 6638, @@[= { 6641, 6644, 6643, 6638, 6639,=]@@
@@[= @@[= 12883, 13226, 12561, 12609, 12298,=]@@
@@[= @@[= 12271, 12901, 13248, 13267, 13276,=]@@
@@[= @@[= 13206, 12232, 12532},=]@@
@@[= { 6640, 6642, 6635, 6636, @@[= { 6640, 6642, 6635, 6636, 6637,=]@@
@@[= @@[= 12497, 17189, 12523, 13139, 12225,=]@@
@@[= @@[= 12317, 12194, 12215},=]@@
@@[= @@[= }=]@@



@@[= function tokens.hulu(s,e)=]@@
@@[= return string.format(=]@@
@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= end=]@@

to:

@@[= @@[= function tokens.hulu(s,e)=]@@
@@[= @@[= return string.format(=]@@
@@[= @@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= @@[= end=]@@



@@[= --It's largely sequential, but not quite.=]@@
@@[= --I printed out all the numbers and moved them around=]@@
@@[= --to fit the correct order (which is both inconsistent=]@@
@@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= local movieids=]=[={=]@@
@@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= 70133693, 70133694, },=]@@
@@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= 70133709, 70133710, 70133712, },=]@@
@@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= 70133723, 70133724, 70133725, }=]@@
@@[= }=]@@

to:

@@[= @@[= --It's largely sequential, but not quite.=]@@
@@[= @@[= --I printed out all the numbers and moved them around=]@@
@@[= @@[= --to fit the correct order (which is both inconsistent=]@@
@@[= @@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= @@[= local movieids=]=[={=]@@
@@[= @@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= @@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= @@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= @@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= @@[= 70133693, 70133694, },=]@@
@@[= @@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= @@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= @@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= @@[= 70133709, 70133710, 70133712, },=]@@
@@[= @@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= @@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= @@[= 70133723, 70133724, 70133725, }=]@@
@@[= @@[= }=]@@



@@[= function tokens.netflix(s,e)=]@@
@@[= return string.format(=]@@
@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= end=]@@

to:

@@[= @@[= function tokens.netflix(s,e)=]@@
@@[= @@[= return string.format(=]@@
@@[= @@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= @@[= end=]@@



@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@

to:

@@[= @@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@



@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@

to:

@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@



@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@

to:

@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@



@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= function ad_ep_links(s,e)=]@@
@@[= return (string.gsub(template,"=]%[=$(=]%[=w+ )",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= end=]@@

to:

@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= @@[= function ad_ep_links(s,e)=]@@
@@[= @@[= return (string.gsub(template,"=]%[=$(=]%[=w+ )",function(token) gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= @@[= end=]@@



@@[= --get the ep title=]@@
@@[= local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= --replace the é in Beef Consommé=]@@
@@[= title=]=[=string.gsub(title,'é','e')=]@@
@@[= --transform to CamelCased WikiWord=]@@
@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= --Remove all non-alphanumeric characters=]@@
@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@

to:

@@[= @@[= --get the ep title=]@@
@@[= @@[= local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= @@[= --replace the é in Beef Consommé=]@@
@@[= @@[= title=]=[=string.gsub(title,'é','e')=]@@
@@[= @@[= --transform to CamelCased WikiWord=]@@
@@[= @@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= @@[= --Remove all non-alphanumeric characters=]@@
@@[= @@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@



@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@

to:

@@[= @@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@



@@[= return tvtropes.post(=]@@
@@[= recap_pagename(s,e),=]@@
@@[= string.format(=]@@
@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= "STUART",=]@@
@@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@

to:

@@[= @@[= return tvtropes.post(=]@@
@@[= @@[= recap_pagename(s,e),=]@@
@@[= @@[= string.format(=]@@
@@[= @@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= @@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= @@[= "STUART",=]@@
@@[= @@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@



@@[= return function(s,e)=]@@
@@[= --until comment syntax is changed, Amigos is manual-only=]@@
@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= else=]@@
@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= local success=]@@
@@[= while not success do=]@@
@@[= local code=]@@
@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= "STUART",reason)=]@@
@@[= if not success then print("Retrying... "..code) end=]@@
@@[= end=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= @@[= return function(s,e)=]@@
@@[= @@[= --until comment syntax is changed, Amigos is manual-only=]@@
@@[= @@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= @@[= print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= @@[= else=]@@
@@[= @@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= @@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= @@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= @@[= local success=]@@
@@[= @@[= while not success do=]@@
@@[= @@[= local code=]@@
@@[= @@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= @@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= @@[= "STUART",reason)=]@@
@@[= @@[= if not success then print("Retrying... "..code) end=]@@
@@[= @@[= end=]@@
@@[= @@[= end=]@@
@@[= @@[= end=]@@



@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= f(s,e)=]@@
@@[= end=]@@
@@[= end=]@@

to:

@@[= @@[= for s=]=[=1,#adeps do=]@@
@@[= @@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= @@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= @@[= f(s,e)=]@@
@@[= @@[= end=]@@
@@[= @@[= end=]@@
Is there an issue? Send a MessageReason:
None

Added DiffLines:

* DeadLikeMe (not including ''Life After Death'')

Added: 662

Removed: 662

Is there an issue? Send a MessageReason:
None


!TV shows I've seen every episode of:

(This doesn't necessarily reflect my opinion on a show. I just like to finish what I start, media-wise.)

* ArrestedDevelopment
* {{Blackadder}} (including ''Back and Forth'')
* TheCritic
* {{Dollhouse}}
* {{Firefly}}
* [[{{Freakazoid}} Freakazoid!]]
* {{Futurama}} (up through the four movies)
* GilligansIsland
* LifeOnMars (the British one, obviously)
* LookAroundYou
* PeepShow
* PoliceSquad
* PushingDaisies
* {{Spaced}}
* TheWire

!!Ones that I'm up to a certain point in:
* TheATeam (through season one)
* {{Reaper}} (through season one)

!!!Shows still in production:
* {{Community}} (one season)
* {{Archer}} (one season)



%%ENDSCRIPTS%%

to:

%%ENDSCRIPTS%%%%ENDSCRIPTS%%

!TV shows I've seen every episode of:

(This doesn't necessarily reflect my opinion on a show. I just like to finish what I start, media-wise.)

* ArrestedDevelopment
* {{Blackadder}} (including ''Back and Forth'')
* TheCritic
* {{Dollhouse}}
* {{Firefly}}
* [[{{Freakazoid}} Freakazoid!]]
* {{Futurama}} (up through the four movies)
* GilligansIsland
* LifeOnMars (the British one, obviously)
* LookAroundYou
* PeepShow
* PoliceSquad
* PushingDaisies
* {{Spaced}}
* TheWire

!!Ones that I'm up to a certain point in:
* TheATeam (through season one)
* {{Reaper}} (through season one)

!!!Shows still in production:
* {{Community}} (one season)
* {{Archer}} (one season)
Is there an issue? Send a MessageReason:
None


Northwestern 21-year old nerd kid in the games industry. Programs in UsefulNotes/Lua.

to:

Northwestern 21-year old nerd kid in the games industry. Programs in UsefulNotes/Lua.
{{Lua}}.
Is there an issue? Send a MessageReason:
None


Northwestern 21-year old nerd kid in the games industry.

to:

Northwestern 21-year old nerd kid in the games industry.
industry. Programs in UsefulNotes/Lua.

Added: 13

Changed: -4

Is there an issue? Send a MessageReason:
None


!Lua scripts:



@@[=local urlencode=]=[={}=]@@

to:

@@[=local urlencode=]=[={}=]@@



@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@

to:

@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@



@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@

to:

@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[==]~[= =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@



@@[=urlencode.string =]=[= encode=]@@

to:

@@[=urlencode.string =]=[= encode=]@@



@@[= local argts, i=]=[= {}, 1=]@@

to:

@@[= local argts, i=]=[= {}, 1=]@@



@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+1=]@@

to:

@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+1=]@@



@@[=local http =]=[= require"socket.http"=]@@

to:

@@[=local http =]=[= require"socket.http"=]@@



@@[=local urlencode =]=[= require "urlencode"=]@@

to:

@@[=local urlencode =]=[= require "urlencode"=]@@



@@[=local tvtropes=]=[={}=]@@

to:

@@[=local tvtropes=]=[={}=]@@



@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@

to:

@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@



@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@

to:

@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= page=]=[=fullname(page)=]@@



@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@

to:

@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@



@@[= local response =]=[==]@@

to:

@@[= local response =]=[==]@@



@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@

to:

@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@



@@[= assert(response[1=]][=,response[2=]][=)=]@@

to:

@@[= assert(response[1=]][=,response[2=]][=)=]@@



@@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@

to:

@@[= if tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@



@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@

to:

@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@



@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@

to:

@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@



@@[= page=]=[=fullname(page)=]@@

to:

@@[= page=]=[=fullname(page)=]@@



@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@

to:

@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@



@@[=local tvtropes =]=[= require "tvtropes"=]@@

to:

@@[=local tvtropes =]=[= require "tvtropes"=]@@



@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@

to:

@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@



@@[=local scripts=]=[={=]@@

to:

@@[=local scripts=]=[={=]@@



@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@

to:

@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@



@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@

to:

@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@



@@[= local headers=]=[=#folders=]@@

to:

@@[= local headers=]=[=#folders=]@@



@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@

to:

@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@



@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+1=]][==]=[='\\\\'=]@@

to:

@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+1=]][==]=[='\\\\'=]@@



@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@

to:

@@[= local escaped=]=[=string.gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@



@@[= slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@

to:

@@[= slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@



@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@

to:

@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@



@@[= folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@

to:

@@[= folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@



@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@

to:

@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@



@@[= local current=]=[=tvtropes.get(target)=]@@

to:

@@[= local current=]=[=tvtropes.get(target)=]@@



@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@

to:

@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@



@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@

to:

@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@



@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@

to:

@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@



@@[=local tvtropes=]=[=require "tvtropes"=]@@

to:

@@[=local tvtropes=]=[=require "tvtropes"=]@@



@@[=local urlencode=]=[=require "urlencode"=]@@

to:

@@[=local urlencode=]=[=require "urlencode"=]@@



@@[=adeps=]=[={=]@@

to:

@@[=adeps=]=[={=]@@



@@[=local tokens=]=[={}=]@@

to:

@@[=local tokens=]=[={}=]@@



@@[= local disambigeps=]=[={=]@@

to:

@@[= local disambigeps=]=[={=]@@



@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@

to:

@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@



@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@

to:

@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@



@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@

to:

@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@



@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@

to:

@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@



@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@

to:

@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@



@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@

to:

@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@



@@[= local ttnums=]=[={=]@@

to:

@@[= local ttnums=]=[={=]@@



@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@

to:

@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@



@@[= local watchnums=]=[={=]@@

to:

@@[= local watchnums=]=[={=]@@



@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@

to:

@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@



@@[= local movieids=]=[={=]@@

to:

@@[= local movieids=]=[={=]@@



@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@

to:

@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@



@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@

to:

@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@



@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@

to:

@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@



@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@

to:

@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@



@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@

to:

@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@



@@[= return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@

to:

@@[= return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@



@@[= local title=]=[=adeps[s=]][=[e=]][==]@@

to:

@@[= local title=]=[=adeps[s=]][=[e=]][==]@@



@@[= title=]=[=string.gsub(title,'é','e')=]@@

to:

@@[= title=]=[=string.gsub(title,'é','e')=]@@



@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@

to:

@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@



@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@

to:

@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@



@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@

to:

@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@



@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@

to:

@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@



@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@

to:

@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@



@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@

to:

@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@



@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@

to:

@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@



@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@

to:

@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
Is there an issue? Send a MessageReason:
OK, think I got it now


@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@[= slines[#slines+1=]][==]=[='@@@@\\\\'=]@@

to:

@@[= slines[#slines+1=]][==]=[='@@@@\\\\'=]@@slines[#slines+1=]][==]=[='\\\\'=]@@



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\
@@[=push "oh god I'm never going to get it right"=]@@
@@@@\\
@@@@\\

to:

@@@@\\
\\
@@[=push "oh god I'm never going to get "OK, think I got it right"=]@@
@@@@\\
@@@@\\
now"=]@@
\\
\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\



@@@@\\

to:

@@@@\\\\
Is there an issue? Send a MessageReason:
oh god I'm never going to get it right


->@@[=local urlencode=]=[={}=]@@
->@@@@\\
->@@[=--URL encode a string.=]@@
->@@[=local function encode(str)=]@@
->@@[= --Ensure all newlines are in CRLF form=]@@
->@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
->@@[= --Percent-encode all non-unreserved characters=]@@
->@@[= --as per RFC 3986, Section 2.3=]@@
->@@[= --(except for space, which gets plus-encoded)=]@@
->@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[=~ =]][=)",=]@@
->@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
->@@[= --Convert spaces to plus signs=]@@
->@@[= return string.gsub (str, " ", "+")=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Make this function available as part of the module=]@@
->@@[=urlencode.string =]=[= encode=]@@
->@@@@\\
->@@[=--URL encode a table as a series of parameters.=]@@
->@@[=function urlencode.table(t)=]@@
->@@[= --table of argument strings=]@@
->@@[= local argts, i=]=[= {}, 1=]@@
->@@[= for k, v in pairs(t) do=]@@
->@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
->@@[= i=]=[=i+1=]@@
->@@[= end=]@@
->@@[= return table.concat(argts,'&')=]@@
->@@[=end=]@@
->@@@@\\
->@@[=return urlencode=]@@

to:

->@@[=local @@[=local urlencode=]=[={}=]@@
->@@@@\\
->@@[=--URL
@@@@\\
@@[=--URL
encode a string.=]@@
->@@[=local @@[=local function encode(str)=]@@
->@@[= @@[= --Ensure all newlines are in CRLF form=]@@
->@@[= @@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
->@@[= @@[= --Percent-encode all non-unreserved characters=]@@
->@@[= @@[= --as per RFC 3986, Section 2.3=]@@
->@@[= @@[= --(except for space, which gets plus-encoded)=]@@
->@@[= @@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[=~ =]%[=_=]%[==]~[= =]][=)",=]@@
->@@[= @@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
->@@[= @@[= --Convert spaces to plus signs=]@@
->@@[= @@[= return string.gsub (str, " ", "+")=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Make
@@[=end=]@@
@@@@\\
@@[=--Make
this function available as part of the module=]@@
->@@[=urlencode.@@[=urlencode.string =]=[= encode=]@@
->@@@@\\
->@@[=--URL
@@@@\\
@@[=--URL
encode a table as a series of parameters.=]@@
->@@[=function @@[=function urlencode.table(t)=]@@
->@@[= @@[= --table of argument strings=]@@
->@@[= @@[= local argts, i=]=[= {}, 1=]@@
->@@[= @@[= for k, v in pairs(t) do=]@@
->@@[= @@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
->@@[= @@[= i=]=[=i+1=]@@
->@@[= @@[= end=]@@
->@@[= @@[= return table.concat(argts,'&')=]@@
->@@[=end=]@@
->@@@@\\
->@@[=return
@@[=end=]@@
@@@@\\
@@[=return
urlencode=]@@



->@@[=--Required to send to TVTropes site.=]@@
->@@[=local http =]=[= require"socket.http"=]@@
->@@@@\\
->@@[=--Required to create page post data.=]@@
->@@[=local urlencode =]=[= require "urlencode"=]@@
->@@@@\\
->@@[=local tvtropes=]=[={}=]@@
->@@@@\\
->@@[=--Function that returns the authenticated TVTropes URL for the given page.=]@@
->@@[=local function authpageurl(page)=]@@
->@@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local function fullname(page)=]@@
->@@[= --Require pagename=]@@
->@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
->@@[= --If no namespace specified, assume Main=]@@
->@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
->@@@@\\
->@@[= return page=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function that posts the given page.=]@@
->@@[=function tvtropes.post(page, body, author, reason)=]@@
->@@@@\\
->@@[= page=]=[=fullname(page)=]@@
->@@@@\\
->@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@
->@@@@\\
->@@[= local response =]=[==]@@
->@@[= {http.request(authpageurl(page),=]@@
->@@[= urlencode.table{=]@@
->@@[= action=]=[="post", post=]=[="save",=]@@
->@@[= pagename=]=[=page, text=]=[=body,=]@@
->@@[= author=]=[=author or "Anonymous",=]@@
->@@[= reason=]=[=reason or ""=]@@
->@@[= })}=]@@
->@@@@\\
->@@[= --Error on any socket errors=]@@
->@@[= assert(response[1=]][=,response[2=]][=)=]@@
->@@@@\\
->@@[= --If it doesn't return Found, return nil, the status, and the body:=]@@
->@@[= --sometimes it just rejects the password for some reason.=]@@
->@@[= if tonumber(response[2=]][=)~=]=[=302 then=]@@
->@@[= return nil, response[2=]][=, response[1=]][==]@@
->@@[= else return true=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Technically, this is kind of a general function, but it's designed exclusively around=]@@
->@@[=--TVTropes' source converter, so it's kept in here.=]@@
->@@[=local html2plain=]@@
->@@[=do=]@@
->@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
->@@@@\\
->@@[= function html2plain(src)=]@@
->@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
->@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
->@@[= return src=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function that gets a given page source.=]@@
->@@[=function tvtropes.get(page)=]@@
->@@@@\\
->@@[= page=]=[=fullname(page)=]@@
->@@@@\\
->@@[= local body, code =]=[= http.request(=]@@
->@@[= authpageurl(page)..'?action=]=[=source')=]@@
->@@@@\\
->@@[= --Trigger error on socket failure=]@@
->@@[= assert(body,code)=]@@
->@@@@\\
->@@[= --Return the source converted back from the HTML conversion=]@@
->@@[= return html2plain(body)=]@@
->@@[=end=]@@
->@@@@\\
->@@[=return tvtropes=]@@

to:

->@@[=--Required @@[=--Required to send to TVTropes site.=]@@
->@@[=local @@[=local http =]=[= require"socket.http"=]@@
->@@@@\\
->@@[=--Required
@@@@\\
@@[=--Required
to create page post data.=]@@
->@@[=local @@[=local urlencode =]=[= require "urlencode"=]@@
->@@@@\\
->@@[=local
@@@@\\
@@[=local
tvtropes=]=[={}=]@@
->@@@@\\
->@@[=--Function
@@@@\\
@@[=--Function
that returns the authenticated TVTropes URL for the given page.=]@@
->@@[=local @@[=local function authpageurl(page)=]@@
->@@[= @@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local
@@[=end=]@@
@@@@\\
@@[=local
function fullname(page)=]@@
->@@[= @@[= --Require pagename=]@@
->@@[= @@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
->@@[= @@[= --If no namespace specified, assume Main=]@@
->@@[= @@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
return page=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function
@@[=end=]@@
@@@@\\
@@[=--Function
that posts the given page.=]@@
->@@[=function @@[=function tvtropes.post(page, body, author, reason)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
page=]=[=fullname(page)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
assert(type(body)=]=[==]=[="string","Page body required")=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
local response =]=[==]@@
->@@[= @@[= {http.request(authpageurl(page),=]@@
->@@[= @@[= urlencode.table{=]@@
->@@[= @@[= action=]=[="post", post=]=[="save",=]@@
->@@[= @@[= pagename=]=[=page, text=]=[=body,=]@@
->@@[= @@[= author=]=[=author or "Anonymous",=]@@
->@@[= @@[= reason=]=[=reason or ""=]@@
->@@[= @@[= })}=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--Error on any socket errors=]@@
->@@[= @@[= assert(response[1=]][=,response[2=]][=)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--If it doesn't return Found, return nil, the status, and the body:=]@@
->@@[= @@[= --sometimes it just rejects the password for some reason.=]@@
->@@[= @@[= if tonumber(response[2=]][=)~=]=[=302 tonumber(response[2=]][=)=]~[==]=[=302 then=]@@
->@@[= @@[= return nil, response[2=]][=, response[1=]][==]@@
->@@[= @@[= else return true=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Technically,
@@[=end=]@@
@@@@\\
@@[=--Technically,
this is kind of a general function, but it's designed exclusively around=]@@
->@@[=--TVTropes' @@[=--TVTropes' source converter, so it's kept in here.=]@@
->@@[=local @@[=local html2plain=]@@
->@@[=do=]@@
->@@[=
@@[=do=]@@
@@[=
local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
function html2plain(src)=]@@
->@@[= @@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
->@@[= @@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
->@@[= @@[= return src=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function
@@[=end=]@@
@@@@\\
@@[=--Function
that gets a given page source.=]@@
->@@[=function @@[=function tvtropes.get(page)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
page=]=[=fullname(page)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
local body, code =]=[= http.request(=]@@
->@@[= @@[= authpageurl(page)..'?action=]=[=source')=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--Trigger error on socket failure=]@@
->@@[= @@[= assert(body,code)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--Return the source converted back from the HTML conversion=]@@
->@@[= @@[= return html2plain(body)=]@@
->@@[=end=]@@
->@@@@\\
->@@[=return
@@[=end=]@@
@@@@\\
@@[=return
tvtropes=]@@



->@@[=local tvtropes =]=[= require "tvtropes"=]@@
->@@@@\\
->@@[=local target =]=[= "Tropers/STUART"=]@@
->@@[=local user=]=[="STUART"=]@@
->@@@@\\
->@@[=local scripts=]=[={=]@@
->@@[= "urlencode.lua",=]@@
->@@[= "tvtropes.lua",=]@@
->@@[= "tropersrepo.lua",=]@@
->@@[= "arrdev_recap.lua",=]@@
->@@[=}=]@@
->@@@@\\
->@@[=local function scriptfolder(name,script)=]@@
->@@[= return string.format(=]@@
->@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
->@@[= name,script)=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local function revsection()=]@@
->@@[= local folders=]=[={=]@@
->@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
->@@[= "[[foldercontrol=]][==]][="=]@@
->@@[= }=]@@
->@@[= local headers=]=[=#folders=]@@
->@@@@\\
->@@[= for i=]=[=1, #scripts do=]@@
->@@[= local slines=]=[={}=]@@
->@@[= for line in io.lines(scripts[i=]][=) do=]@@
->@@@@\\
->@@[= --escape all equals signs and percents=]@@
->@@[= if line=]=[==]=[="" then=]@@
->@@[= slines[#slines+1=]][==]=[='->@@@@\\\\'=]@@
->@@[= else=]@@
->@@[= local escaped=]=[=string.gsub(line,"[=]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
->@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@
->@@@@\\
->@@[= slines[#slines+1=]][==]=[=string.format("->@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
->@@[= end=]@@
->@@[= end=]@@
->@@@@\\
->@@[= local content=]=[=table.concat(slines,'\n')=]@@
->@@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
->@@[= end=]@@
->@@@@\\
->@@[= folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@
->@@@@\\
->@@[= return table.concat(folders,"\n\n")=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local function push(notes)=]@@
->@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
->@@@@\\
->@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@
->@@@@\\
->@@[= local current=]=[=tvtropes.get(target)=]@@
->@@@@\\
->@@[= local updated=]=[=string.gsub(current,=]@@
->@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
->@@[= gssscripts)=]@@
->@@@@\\
->@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@
->@@@@\\
->@@[= local posted=]@@
->@@[= while not posted do=]@@
->@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
->@@[= if not posted then print" Retrying..." end=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Executing code---------------------------------------------------------------=]@@
->@@@@\\
->@@[=push "oh god I'm never going to get it right"=]@@
->@@@@\\
->@@@@\\

to:

->@@[=local @@[=local tvtropes =]=[= require "tvtropes"=]@@
->@@@@\\
->@@[=local
@@@@\\
@@[=local
target =]=[= "Tropers/STUART"=]@@
->@@[=local @@[=local user=]=[="STUART"=]@@
->@@@@\\
->@@[=local
@@@@\\
@@[=local
scripts=]=[={=]@@
->@@[= @@[= "urlencode.lua",=]@@
->@@[= @@[= "tvtropes.lua",=]@@
->@@[= @@[= "tropersrepo.lua",=]@@
->@@[= @@[= "arrdev_recap.lua",=]@@
->@@[=}=]@@
->@@@@\\
->@@[=local
@@[=}=]@@
@@@@\\
@@[=local
function scriptfolder(name,script)=]@@
->@@[= @@[= return string.format(=]@@
->@@[= @@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
->@@[= @@[= name,script)=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local
@@[=end=]@@
@@@@\\
@@[=local
function revsection()=]@@
->@@[= @@[= local folders=]=[={=]@@
->@@[= @@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
->@@[= @@[= "[[foldercontrol=]][==]][="=]@@
->@@[= @@[= }=]@@
->@@[= @@[= local headers=]=[=#folders=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
for i=]=[=1, #scripts do=]@@
->@@[= @@[= local slines=]=[={}=]@@
->@@[= @@[= for line in io.lines(scripts[i=]][=) do=]@@
->@@@@\\
->@@[=
@@@@\\
@@[= if line=]=[==]=[="" then=]@@
@@[= slines[#slines+1=]][==]=[='@@@@\\\\'=]@@
@@[= else=]@@
@@[=
--escape all equals signs and percents=]@@
->@@[= if line=]=[==]=[="" then=]@@
->@@[= slines[#slines+1=]][==]=[='->@@@@\\\\'=]@@
->@@[= else=]@@
->@@[=
@@[= local escaped=]=[=string.gsub(line,"[=]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
->@@[=
gsub(line,"[=]%[==]~[==]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[=
function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
slines[#slines+1=]][==]=[=string.format("->@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
->@@[=
format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[=
end=]@@
->@@[= @@[= end=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
local content=]=[=table.concat(slines,'\n')=]@@
->@@[= @@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
->@@[= @@[= end=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
return table.concat(folders,"\n\n")=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local
@@[=end=]@@
@@@@\\
@@[=local
function push(notes)=]@@
->@@[= @@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
print(string.format("Getting current version of =]%[=s...",target))=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
local current=]=[=tvtropes.get(target)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
local updated=]=[=string.gsub(current,=]@@
->@@[= @@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
->@@[= @@[= gssscripts)=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
print(string.format("Posting new version of =]%[=s...",target))=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
local posted=]@@
->@@[= @@[= while not posted do=]@@
->@@[= @@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
->@@[= @@[= if not posted then print" Retrying..." end=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Executing
@@[=end=]@@
@@@@\\
@@[=--Executing
code---------------------------------------------------------------=]@@
->@@@@\\
->@@[=push
@@@@\\
@@[=push
"oh god I'm never going to get it right"=]@@
->@@@@\\
->@@@@\\
@@@@\\
@@@@\\



->@@[=--encoding: UTF-8=]@@
->@@@@\\
->@@[=--Required to post pages=]@@
->@@[=local tvtropes=]=[=require "tvtropes"=]@@
->@@[=--Required for encoding Wikipedia article titles=]@@
->@@[=local urlencode=]=[=require "urlencode"=]@@
->@@@@\\
->@@[=--Arrested Development data----------------------------------------------------=]@@
->@@[=adeps=]=[={=]@@
->@@[= {=]@@
->@@[= "Pilot",=]@@
->@@[= "Top Banana",=]@@
->@@[= "Bringing Up Buster",=]@@
->@@[= "Key Decisions",=]@@
->@@[= "Visiting Ours",=]@@
->@@[= "Charity Drive",=]@@
->@@[= "My Mother, The Car",=]@@
->@@[= "In God We Trust",=]@@
->@@[= "Storming the Castle",=]@@
->@@[= "Pier Pressure",=]@@
->@@[= "Public Relations",=]@@
->@@[= "Marta Complex",=]@@
->@@[= "Beef Consommé",=]@@
->@@[= "Shock and Aww",=]@@
->@@[= "Staff Infection",=]@@
->@@[= "Missing Kitty",=]@@
->@@[= "Altar Egos",=]@@
->@@[= "Justice Is Blind",=]@@
->@@[= "Best Man for the GOB",=]@@
->@@[= "Whistler's Mother",=]@@
->@@[= "Not Without My Daughter",=]@@
->@@[= "Let 'Em Eat Cake"=]@@
->@@[= },=]@@
->@@[= {=]@@
->@@[= "The One Where Michael Leaves",=]@@
->@@[= "The One Where They Build a House",=]@@
->@@[= "¡Amigos!",=]@@
->@@[= "Good Grief",=]@@
->@@[= "Sad Sack",=]@@
->@@[= "Afternoon Delight",=]@@
->@@[= "Switch Hitter",=]@@
->@@[= "Queen for a Day",=]@@
->@@[= "Burning Love",=]@@
->@@[= "Ready, Aim, Marry Me",=]@@
->@@[= "Out on a Limb",=]@@
->@@[= "Hand to God",=]@@
->@@[= "Motherboy XXX",=]@@
->@@[= "The Immaculate Election",=]@@
->@@[= "Sword of Destiny",=]@@
->@@[= "Meat the Veals",=]@@
->@@[= "Spring Breakout",=]@@
->@@[= "Righteous Brothers",=]@@
->@@[= },=]@@
->@@[= {=]@@
->@@[= "The Cabin Show",=]@@
->@@[= "For British Eyes Only",=]@@
->@@[= "Forget-Me-Now",=]@@
->@@[= "Notapusy",=]@@
->@@[= "Mr. F",=]@@
->@@[= "The Ocean Walker",=]@@
->@@[= "Prison Break-In",=]@@
->@@[= "Making a Stand",=]@@
->@@[= "S.O.B.s",=]@@
->@@[= "Fakin' It",=]@@
->@@[= "Family Ties",=]@@
->@@[= "Exit Strategy",=]@@
->@@[= "Development Arrested"=]@@
->@@[= },=]@@
->@@[=}=]@@
->@@[=-------------------------------------------------------------------------------=]@@
->@@@@\\
->@@[=--Interwiki data---------------------------------------------------------------=]@@
->@@[=local tokens=]=[={}=]@@
->@@@@\\
->@@[=do --wikipedia=]@@
->@@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
->@@[= --whose article titles end with "(Arrested Development)"=]@@
->@@[= local disambigeps=]=[={=]@@
->@@[= {1,2,8,11,20,21,22}, --Season 1=]@@
->@@[= {5,6,8,9,11,12,18}, --Season 2=]@@
->@@[= {10,11,12} --Season 3=]@@
->@@[= }=]@@
->@@@@\\
->@@[= --construct lookup table=]@@
->@@[= local disambiguated=]=[={}=]@@
->@@[= for s=]=[=1,#disambigeps do=]@@
->@@[= disambiguated[s=]][==]=[={}=]@@
->@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
->@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
->@@[= end=]@@
->@@[= end=]@@
->@@@@\\
->@@[= --Function that returns the Wikipedia URL=]@@
->@@[= function tokens.wikipedia(s,e)=]@@
->@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
->@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
->@@[= pagename=]=[=urlencode.string(pagename)=]@@
->@@[= if disambiguated[s=]][=[e=]][= then=]@@
->@@[= --Technically, parentheses don't have to be percent-encoded=]@@
->@@[= --for HTTP URIs because they're unused sub-delims=]@@
->@@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
->@@[= --the function that percent-encodes all sub-delims=]@@
->@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
->@@[= end=]@@
->@@@@\\
->@@[= return "http://en.wikipedia.org/wiki/"..pagename=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
->@@[=function tokens.wikia(s,e)=]@@
->@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
->@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
->@@[= pagename=]=[=urlencode.string(pagename)=]@@
->@@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do --Balboa Observer-Picayune=]@@
->@@[= --Season 1 episodes that are listed at different numbers=]@@
->@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
->@@@@\\
->@@[= --Function the returns the URL of the episode's page on the-op.com=]@@
->@@[= function tokens.theop(s,e)=]@@
->@@[= --correct OutOfOrder Season 1 episodes=]@@
->@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
->@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do --IMDB=]@@
->@@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
->@@[= --that I have to use you=]@@
->@@[= local ttnums=]=[={=]@@
->@@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
->@@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
->@@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
->@@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
->@@[= 0515232, 0515224, },=]@@
->@@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
->@@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
->@@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
->@@[= 0515227, 0515245, 0515241, },=]@@
->@@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
->@@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
->@@[= 0515217, 0515215, 0757386, }=]@@
->@@[= }=]@@
->@@@@\\
->@@[= --Function that returns the URL for the episode's IMDB page=]@@
->@@[= function tokens.imdb(s,e)=]@@
->@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do --Hulu, you know, just in case=]@@
->@@[= local watchnums=]=[={=]@@
->@@[= { 589, 1786, 585, 1781, 1785,=]@@
->@@[= 580, 590, 588, 586, 575,=]@@
->@@[= 576, 579, 577, 644, 1783,=]@@
->@@[= 591, 582, 584, 578, 581,=]@@
->@@[= 583, 587},=]@@
->@@[= { 6641, 6644, 6643, 6638, 6639,=]@@
->@@[= 12883, 13226, 12561, 12609, 12298,=]@@
->@@[= 12271, 12901, 13248, 13267, 13276,=]@@
->@@[= 13206, 12232, 12532},=]@@
->@@[= { 6640, 6642, 6635, 6636, 6637,=]@@
->@@[= 12497, 17189, 12523, 13139, 12225,=]@@
->@@[= 12317, 12194, 12215},=]@@
->@@[= }=]@@
->@@@@\\
->@@[= function tokens.hulu(s,e)=]@@
->@@[= return string.format(=]@@
->@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do --Netflix Watch Instantly=]@@
->@@[= --It's largely sequential, but not quite.=]@@
->@@[= --I printed out all the numbers and moved them around=]@@
->@@[= --to fit the correct order (which is both inconsistent=]@@
->@@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
->@@[= local movieids=]=[={=]@@
->@@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
->@@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
->@@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
->@@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
->@@[= 70133693, 70133694, },=]@@
->@@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
->@@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
->@@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
->@@[= 70133709, 70133710, 70133712, },=]@@
->@@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
->@@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
->@@[= 70133723, 70133724, 70133725, }=]@@
->@@[= }=]@@
->@@@@\\
->@@[= function tokens.netflix(s,e)=]@@
->@@[= return string.format(=]@@
->@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=-------------------------------------------------------------------------------=]@@
->@@@@\\
->@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
->@@[=local ad_ep_links=]@@
->@@[=do=]@@
->@@[= local template=]=[=[=]=[=[=]@@
->@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
->@@[=----=]@@
->@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
->@@@@\\
->@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
->@@[=----=]@@
->@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
->@@[==]][==]=[==]][==]@@
->@@[= function ad_ep_links(s,e)=]@@
->@@[= return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
->@@[=local function recap_pagename(s,e)=]@@
->@@[= --get the ep title=]@@
->@@[= local title=]=[=adeps[s=]][=[e=]][==]@@
->@@[= --replace the é in Beef Consommé=]@@
->@@[= title=]=[=string.gsub(title,'é','e')=]@@
->@@[= --transform to CamelCased WikiWord=]@@
->@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
->@@[= --Remove all non-alphanumeric characters=]@@
->@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@
->@@@@\\
->@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local function post_ad_recap_starter(s,e)=]@@
->@@[= return tvtropes.post(=]@@
->@@[= recap_pagename(s,e),=]@@
->@@[= string.format(=]@@
->@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
->@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
->@@[= "STUART",=]@@
->@@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local function update_links(reason)=]@@
->@@[= return function(s,e)=]@@
->@@[= --until comment syntax is changed, Amigos is manual-only=]@@
->@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
->@@[= print "(Skipping Amigos because the links go all screwy)"=]@@
->@@[= else=]@@
->@@[= local pagename=]=[=recap_pagename(s,e)=]@@
->@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
->@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
->@@[= local success=]@@
->@@[= while not success do=]@@
->@@[= local code=]@@
->@@[= success, code =]=[= tvtropes.post(pagename,=]@@
->@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
->@@[= "STUART",reason)=]@@
->@@[= if not success then print("Retrying... "..code) end=]@@
->@@[= end=]@@
->@@[= end=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local function for_all_eps(f)=]@@
->@@[= for s=]=[=1,#adeps do=]@@
->@@[= for e=]=[=1,#adeps[s=]][= do=]@@
->@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
->@@[= f(s,e)=]@@
->@@[= end=]@@
->@@[= end=]@@
->@@[=end=]@@
->@@[=-------------------------------------------------------------------------------=]@@
->@@@@\\
->@@[=--Okay, put your executing commands down here.=]@@

to:

->@@[=--encoding: @@[=--encoding: UTF-8=]@@
->@@@@\\
->@@[=--Required
@@@@\\
@@[=--Required
to post pages=]@@
->@@[=local @@[=local tvtropes=]=[=require "tvtropes"=]@@
->@@[=--Required @@[=--Required for encoding Wikipedia article titles=]@@
->@@[=local @@[=local urlencode=]=[=require "urlencode"=]@@
->@@@@\\
->@@[=--Arrested
@@@@\\
@@[=--Arrested
Development data----------------------------------------------------=]@@
->@@[=adeps=]=[={=]@@
->@@[=
@@[=adeps=]=[={=]@@
@@[=
{=]@@
->@@[= @@[= "Pilot",=]@@
->@@[= @@[= "Top Banana",=]@@
->@@[= @@[= "Bringing Up Buster",=]@@
->@@[= @@[= "Key Decisions",=]@@
->@@[= @@[= "Visiting Ours",=]@@
->@@[= @@[= "Charity Drive",=]@@
->@@[= @@[= "My Mother, The Car",=]@@
->@@[= @@[= "In God We Trust",=]@@
->@@[= @@[= "Storming the Castle",=]@@
->@@[= @@[= "Pier Pressure",=]@@
->@@[= @@[= "Public Relations",=]@@
->@@[= @@[= "Marta Complex",=]@@
->@@[= @@[= "Beef Consommé",=]@@
->@@[= @@[= "Shock and Aww",=]@@
->@@[= @@[= "Staff Infection",=]@@
->@@[= @@[= "Missing Kitty",=]@@
->@@[= @@[= "Altar Egos",=]@@
->@@[= @@[= "Justice Is Blind",=]@@
->@@[= @@[= "Best Man for the GOB",=]@@
->@@[= @@[= "Whistler's Mother",=]@@
->@@[= @@[= "Not Without My Daughter",=]@@
->@@[= @@[= "Let 'Em Eat Cake"=]@@
->@@[= @@[= },=]@@
->@@[= @@[= {=]@@
->@@[= @@[= "The One Where Michael Leaves",=]@@
->@@[= @@[= "The One Where They Build a House",=]@@
->@@[= @@[= "¡Amigos!",=]@@
->@@[= @@[= "Good Grief",=]@@
->@@[= @@[= "Sad Sack",=]@@
->@@[= @@[= "Afternoon Delight",=]@@
->@@[= @@[= "Switch Hitter",=]@@
->@@[= @@[= "Queen for a Day",=]@@
->@@[= @@[= "Burning Love",=]@@
->@@[= @@[= "Ready, Aim, Marry Me",=]@@
->@@[= @@[= "Out on a Limb",=]@@
->@@[= @@[= "Hand to God",=]@@
->@@[= @@[= "Motherboy XXX",=]@@
->@@[= @@[= "The Immaculate Election",=]@@
->@@[= @@[= "Sword of Destiny",=]@@
->@@[= @@[= "Meat the Veals",=]@@
->@@[= @@[= "Spring Breakout",=]@@
->@@[= @@[= "Righteous Brothers",=]@@
->@@[= @@[= },=]@@
->@@[= @@[= {=]@@
->@@[= @@[= "The Cabin Show",=]@@
->@@[= @@[= "For British Eyes Only",=]@@
->@@[= @@[= "Forget-Me-Now",=]@@
->@@[= @@[= "Notapusy",=]@@
->@@[= @@[= "Mr. F",=]@@
->@@[= @@[= "The Ocean Walker",=]@@
->@@[= @@[= "Prison Break-In",=]@@
->@@[= @@[= "Making a Stand",=]@@
->@@[= @@[= "S.O.B.s",=]@@
->@@[= @@[= "Fakin' It",=]@@
->@@[= @@[= "Family Ties",=]@@
->@@[= @@[= "Exit Strategy",=]@@
->@@[= @@[= "Development Arrested"=]@@
->@@[= @@[= },=]@@
->@@[=}=]@@
->@@[=-------------------------------------------------------------------------------=]@@
->@@@@\\
->@@[=--Interwiki
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
@@@@\\
@@[=--Interwiki
data---------------------------------------------------------------=]@@
->@@[=local @@[=local tokens=]=[={}=]@@
->@@@@\\
->@@[=do
@@@@\\
@@[=do
--wikipedia=]@@
->@@[= @@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
->@@[= @@[= --whose article titles end with "(Arrested Development)"=]@@
->@@[= @@[= local disambigeps=]=[={=]@@
->@@[= @@[= {1,2,8,11,20,21,22}, --Season 1=]@@
->@@[= @@[= {5,6,8,9,11,12,18}, --Season 2=]@@
->@@[= @@[= {10,11,12} --Season 3=]@@
->@@[= @@[= }=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--construct lookup table=]@@
->@@[= @@[= local disambiguated=]=[={}=]@@
->@@[= @@[= for s=]=[=1,#disambigeps do=]@@
->@@[= @@[= disambiguated[s=]][==]=[={}=]@@
->@@[= @@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
->@@[= @@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
->@@[= @@[= end=]@@
->@@[= @@[= end=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--Function that returns the Wikipedia URL=]@@
->@@[= @@[= function tokens.wikipedia(s,e)=]@@
->@@[= @@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
->@@[= @@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
->@@[= @@[= pagename=]=[=urlencode.string(pagename)=]@@
->@@[= @@[= if disambiguated[s=]][=[e=]][= then=]@@
->@@[= @@[= --Technically, parentheses don't have to be percent-encoded=]@@
->@@[= @@[= --for HTTP URIs because they're unused sub-delims=]@@
->@@[= @@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
->@@[= @@[= --the function that percent-encodes all sub-delims=]@@
->@@[= @@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
->@@[= @@[= end=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
return "http://en.wikipedia.org/wiki/"..pagename=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function
@@[=end=]@@
@@@@\\
@@[=--Function
that returns the URL of the Arrested Development Wikia entry=]@@
->@@[=function @@[=function tokens.wikia(s,e)=]@@
->@@[= @@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
->@@[= @@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
->@@[= @@[= pagename=]=[=urlencode.string(pagename)=]@@
->@@[= @@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do
@@[=end=]@@
@@@@\\
@@[=do
--Balboa Observer-Picayune=]@@
->@@[= @@[= --Season 1 episodes that are listed at different numbers=]@@
->@@[= @@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--Function the returns the URL of the episode's page on the-op.com=]@@
->@@[= @@[= function tokens.theop(s,e)=]@@
->@@[= @@[= --correct OutOfOrder Season 1 episodes=]@@
->@@[= @@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
->@@[= @@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do
@@[=end=]@@
@@@@\\
@@[=do
--IMDB=]@@
->@@[= @@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
->@@[= @@[= --that I have to use you=]@@
->@@[= @@[= local ttnums=]=[={=]@@
->@@[= @@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
->@@[= @@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
->@@[= @@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
->@@[= @@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
->@@[= @@[= 0515232, 0515224, },=]@@
->@@[= @@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
->@@[= @@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
->@@[= @@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
->@@[= @@[= 0515227, 0515245, 0515241, },=]@@
->@@[= @@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
->@@[= @@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
->@@[= @@[= 0515217, 0515215, 0757386, }=]@@
->@@[= @@[= }=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
--Function that returns the URL for the episode's IMDB page=]@@
->@@[= @@[= function tokens.imdb(s,e)=]@@
->@@[= @@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do
@@[=end=]@@
@@@@\\
@@[=do
--Hulu, you know, just in case=]@@
->@@[= @@[= local watchnums=]=[={=]@@
->@@[= @@[= { 589, 1786, 585, 1781, 1785,=]@@
->@@[= @@[= 580, 590, 588, 586, 575,=]@@
->@@[= @@[= 576, 579, 577, 644, 1783,=]@@
->@@[= @@[= 591, 582, 584, 578, 581,=]@@
->@@[= @@[= 583, 587},=]@@
->@@[= @@[= { 6641, 6644, 6643, 6638, 6639,=]@@
->@@[= @@[= 12883, 13226, 12561, 12609, 12298,=]@@
->@@[= @@[= 12271, 12901, 13248, 13267, 13276,=]@@
->@@[= @@[= 13206, 12232, 12532},=]@@
->@@[= @@[= { 6640, 6642, 6635, 6636, 6637,=]@@
->@@[= @@[= 12497, 17189, 12523, 13139, 12225,=]@@
->@@[= @@[= 12317, 12194, 12215},=]@@
->@@[= @@[= }=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
function tokens.hulu(s,e)=]@@
->@@[= @@[= return string.format(=]@@
->@@[= @@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=do
@@[=end=]@@
@@@@\\
@@[=do
--Netflix Watch Instantly=]@@
->@@[= @@[= --It's largely sequential, but not quite.=]@@
->@@[= @@[= --I printed out all the numbers and moved them around=]@@
->@@[= @@[= --to fit the correct order (which is both inconsistent=]@@
->@@[= @@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
->@@[= @@[= local movieids=]=[={=]@@
->@@[= @@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
->@@[= @@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
->@@[= @@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
->@@[= @@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
->@@[= @@[= 70133693, 70133694, },=]@@
->@@[= @@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
->@@[= @@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
->@@[= @@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
->@@[= @@[= 70133709, 70133710, 70133712, },=]@@
->@@[= @@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
->@@[= @@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
->@@[= @@[= 70133723, 70133724, 70133725, }=]@@
->@@[= @@[= }=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
function tokens.netflix(s,e)=]@@
->@@[= @@[= return string.format(=]@@
->@@[= @@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=-------------------------------------------------------------------------------=]@@
->@@@@\\
->@@[=--Arrested
@@[=end=]@@
@@@@\\
@@[=-------------------------------------------------------------------------------=]@@
@@@@\\
@@[=--Arrested
Development TV Tropes Recap stuff-----------------------------------=]@@
->@@[=local @@[=local ad_ep_links=]@@
->@@[=do=]@@
->@@[=
@@[=do=]@@
@@[=
local template=]=[=[=]=[=[=]@@
->@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
->@@[=----=]@@
->@@[=Interwiki:
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki:
[[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
->@@@@\\
->@@[=Watch
@@@@\\
@@[=Watch
now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
->@@[=----=]@@
->@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
->@@[==]][==]=[==]][==]@@
->@@[=
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[=
function ad_ep_links(s,e)=]@@
->@@[= @@[= return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=--Function
@@[=end=]@@
@@@@\\
@@[=--Function
that returns the page name of the episode's TVTropes Recap page.=]@@
->@@[=local @@[=local function recap_pagename(s,e)=]@@
->@@[= @@[= --get the ep title=]@@
->@@[= @@[= local title=]=[=adeps[s=]][=[e=]][==]@@
->@@[= @@[= --replace the é in Beef Consommé=]@@
->@@[= @@[= title=]=[=string.gsub(title,'é','e')=]@@
->@@[= @@[= --transform to CamelCased WikiWord=]@@
->@@[= @@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
->@@[= @@[= --Remove all non-alphanumeric characters=]@@
->@@[= @@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@
->@@@@\\
->@@[=
@@@@\\
@@[=
return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local
@@[=end=]@@
@@@@\\
@@[=local
function post_ad_recap_starter(s,e)=]@@
->@@[= @@[= return tvtropes.post(=]@@
->@@[= @@[= recap_pagename(s,e),=]@@
->@@[= @@[= string.format(=]@@
->@@[= @@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
->@@[= @@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
->@@[= @@[= "STUART",=]@@
->@@[= @@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local
@@[=end=]@@
@@@@\\
@@[=local
function update_links(reason)=]@@
->@@[= @@[= return function(s,e)=]@@
->@@[= @@[= --until comment syntax is changed, Amigos is manual-only=]@@
->@@[= @@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
->@@[= @@[= print "(Skipping Amigos because the links go all screwy)"=]@@
->@@[= @@[= else=]@@
->@@[= @@[= local pagename=]=[=recap_pagename(s,e)=]@@
->@@[= @@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
->@@[= @@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
->@@[= @@[= local success=]@@
->@@[= @@[= while not success do=]@@
->@@[= @@[= local code=]@@
->@@[= @@[= success, code =]=[= tvtropes.post(pagename,=]@@
->@@[= @@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
->@@[= @@[= "STUART",reason)=]@@
->@@[= @@[= if not success then print("Retrying... "..code) end=]@@
->@@[= @@[= end=]@@
->@@[= @@[= end=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@@@\\
->@@[=local
@@[=end=]@@
@@@@\\
@@[=local
function for_all_eps(f)=]@@
->@@[= @@[= for s=]=[=1,#adeps do=]@@
->@@[= @@[= for e=]=[=1,#adeps[s=]][= do=]@@
->@@[= @@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
->@@[= @@[= f(s,e)=]@@
->@@[= @@[= end=]@@
->@@[= @@[= end=]@@
->@@[=end=]@@
->@@[=-------------------------------------------------------------------------------=]@@
->@@@@\\
->@@[=--Okay,
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
@@@@\\
@@[=--Okay,
put your executing commands down here.=]@@
Is there an issue? Send a MessageReason:
oh god I'm never going to get it right


\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



->@@[= slines[#slines+1=]][==]=[='\\\\'=]@@

to:

->@@[= slines[#slines+1=]][==]=[='\\\\'=]@@slines[#slines+1=]][==]=[='->@@@@\\\\'=]@@



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\
->@@[=push "OK this should be it"=]@@
\\
\\

to:

\\
->@@@@\\
->@@[=push "OK this should be it"=]@@
\\
\\
"oh god I'm never going to get it right"=]@@
->@@@@\\
->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\



\\

to:

\\->@@@@\\
Is there an issue? Send a MessageReason:
OK this should be it
Is there an issue? Send a MessageReason:
OK this should be it


->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->@@[= slines[#slines+1=]][==]=[='->\\\\'=]@@

to:

->@@[= slines[#slines+1=]][==]=[='->\\\\'=]@@slines[#slines+1=]][==]=[='\\\\'=]@@



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\
->@@[=push "more madness from which there is no escape"=]@@
->\\
->\\

to:

->\\
\\
->@@[=push "more madness from which there is no escape"=]@@
->\\
->\\
"OK this should be it"=]@@
\\
\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\



->\\

to:

->\\\\
Is there an issue? Send a MessageReason:
more madness from which there is no escape


\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



->@@[= slines[#slines+1=]][==]=[='\\'=]@@

to:

->@@[= slines[#slines+1=]][==]=[='\\'=]@@slines[#slines+1=]][==]=[='->\\\\'=]@@



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\
\

to:

\
\
->\\
->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\



\

to:

\->\\
Is there an issue? Send a MessageReason:
more madness from which there is no escape


->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->@@[= slines[#slines+1=]][==]=[='->\\'=]@@

to:

->@@[= slines[#slines+1=]][==]=[='->\\'=]@@slines[#slines+1=]][==]=[='\\'=]@@



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\
->\

to:

->\
->\
\
\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\



->\

to:

->\\

Added: 68

Changed: 3425

Is there an issue? Send a MessageReason:
more madness from which there is no escape


@@[=local urlencode=]=[={}=]@@
@@[==]@@
@@[=--URL encode a string.=]@@
@@[=local function encode(str)=]@@
@@[= --Ensure all newlines are in CRLF form=]@@
@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= --Percent-encode all non-unreserved characters=]@@
@@[= --as per RFC 3986, Section 2.3=]@@
@@[= --(except for space, which gets plus-encoded)=]@@
@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[=~ =]][=)",=]@@
@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= --Convert spaces to plus signs=]@@
@@[= return string.gsub (str, " ", "+")=]@@
@@[=end=]@@
@@[==]@@
@@[=--Make this function available as part of the module=]@@
@@[=urlencode.string =]=[= encode=]@@
@@[==]@@
@@[=--URL encode a table as a series of parameters.=]@@
@@[=function urlencode.table(t)=]@@
@@[= --table of argument strings=]@@
@@[= local argts, i=]=[= {}, 1=]@@
@@[= for k, v in pairs(t) do=]@@
@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= i=]=[=i+1=]@@
@@[= end=]@@
@@[= return table.concat(argts,'&')=]@@
@@[=end=]@@
@@[==]@@
@@[=return urlencode=]@@

to:

@@[=local ->@@[=local urlencode=]=[={}=]@@
@@[==]@@
@@[=--URL
->\
->@@[=--URL
encode a string.=]@@
@@[=local ->@@[=local function encode(str)=]@@
@@[= ->@@[= --Ensure all newlines are in CRLF form=]@@
@@[= ->@@[= str =]=[= string.gsub (str, "\r?\n", "\r\n")=]@@
@@[= ->@@[= --Percent-encode all non-unreserved characters=]@@
@@[= ->@@[= --as per RFC 3986, Section 2.3=]@@
@@[= ->@@[= --(except for space, which gets plus-encoded)=]@@
@@[= ->@@[= str =]=[= string.gsub (str, "([^=]%[=w=]%[=-=]%[=.=]%[=_=]%[=~ =]][=)",=]@@
@@[= ->@@[= function (c) return string.format ("=]%[==]%[==]%[=02X", string.byte(c)) end)=]@@
@@[= ->@@[= --Convert spaces to plus signs=]@@
@@[= ->@@[= return string.gsub (str, " ", "+")=]@@
@@[=end=]@@
@@[==]@@
@@[=--Make
->@@[=end=]@@
->\
->@@[=--Make
this function available as part of the module=]@@
@@[=urlencode.->@@[=urlencode.string =]=[= encode=]@@
@@[==]@@
@@[=--URL
->\
->@@[=--URL
encode a table as a series of parameters.=]@@
@@[=function ->@@[=function urlencode.table(t)=]@@
@@[= ->@@[= --table of argument strings=]@@
@@[= ->@@[= local argts, i=]=[= {}, 1=]@@
@@[= ->@@[= for k, v in pairs(t) do=]@@
@@[= ->@@[= argts[i=]][==]=[=encode(k).."=]=[="..encode(v)=]@@
@@[= ->@@[= i=]=[=i+1=]@@
@@[= ->@@[= end=]@@
@@[= ->@@[= return table.concat(argts,'&')=]@@
@@[=end=]@@
@@[==]@@
@@[=return
->@@[=end=]@@
->\
->@@[=return
urlencode=]@@



@@[=--Required to send to TVTropes site.=]@@
@@[=local http =]=[= require"socket.http"=]@@
@@[==]@@
@@[=--Required to create page post data.=]@@
@@[=local urlencode =]=[= require "urlencode"=]@@
@@[==]@@
@@[=local tvtropes=]=[={}=]@@
@@[==]@@
@@[=--Function that returns the authenticated TVTropes URL for the given page.=]@@
@@[=local function authpageurl(page)=]@@
@@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
@@[=end=]@@
@@[==]@@
@@[=local function fullname(page)=]@@
@@[= --Require pagename=]@@
@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= --If no namespace specified, assume Main=]@@
@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
@@[==]@@
@@[= return page=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function that posts the given page.=]@@
@@[=function tvtropes.post(page, body, author, reason)=]@@
@@[==]@@
@@[= page=]=[=fullname(page)=]@@
@@[==]@@
@@[= assert(type(body)=]=[==]=[="string","Page body required")=]@@
@@[==]@@
@@[= local response =]=[==]@@
@@[= {http.request(authpageurl(page),=]@@
@@[= urlencode.table{=]@@
@@[= action=]=[="post", post=]=[="save",=]@@
@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= author=]=[=author or "Anonymous",=]@@
@@[= reason=]=[=reason or ""=]@@
@@[= })}=]@@
@@[==]@@
@@[= --Error on any socket errors=]@@
@@[= assert(response[1=]][=,response[2=]][=)=]@@
@@[==]@@
@@[= --If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= --sometimes it just rejects the password for some reason.=]@@
@@[= if tonumber(response[2=]][=)~=]=[=302 then=]@@
@@[= return nil, response[2=]][=, response[1=]][==]@@
@@[= else return true=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Technically, this is kind of a general function, but it's designed exclusively around=]@@
@@[=--TVTropes' source converter, so it's kept in here.=]@@
@@[=local html2plain=]@@
@@[=do=]@@
@@[= local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
@@[==]@@
@@[= function html2plain(src)=]@@
@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= return src=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function that gets a given page source.=]@@
@@[=function tvtropes.get(page)=]@@
@@[==]@@
@@[= page=]=[=fullname(page)=]@@
@@[==]@@
@@[= local body, code =]=[= http.request(=]@@
@@[= authpageurl(page)..'?action=]=[=source')=]@@
@@[==]@@
@@[= --Trigger error on socket failure=]@@
@@[= assert(body,code)=]@@
@@[==]@@
@@[= --Return the source converted back from the HTML conversion=]@@
@@[= return html2plain(body)=]@@
@@[=end=]@@
@@[==]@@
@@[=return tvtropes=]@@

to:

@@[=--Required ->@@[=--Required to send to TVTropes site.=]@@
@@[=local ->@@[=local http =]=[= require"socket.http"=]@@
@@[==]@@
@@[=--Required
->\
->@@[=--Required
to create page post data.=]@@
@@[=local ->@@[=local urlencode =]=[= require "urlencode"=]@@
@@[==]@@
@@[=local
->\
->@@[=local
tvtropes=]=[={}=]@@
@@[==]@@
@@[=--Function
->\
->@@[=--Function
that returns the authenticated TVTropes URL for the given page.=]@@
@@[=local ->@@[=local function authpageurl(page)=]@@
@@[= ->@@[= return "http://:foamy@tvtropes.org/pmwiki/pmwiki.php/"..page=]@@
@@[=end=]@@
@@[==]@@
@@[=local
->@@[=end=]@@
->\
->@@[=local
function fullname(page)=]@@
@@[= ->@@[= --Require pagename=]@@
@@[= ->@@[= assert(type(page)=]=[==]=[="string","Destination page name required")=]@@
@@[= ->@@[= --If no namespace specified, assume Main=]@@
@@[= ->@@[= if not string.find(page,'/') then page=]=[="Main/"..page end=]@@
@@[==]@@
@@[=
->\
->@@[=
return page=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function
->@@[=end=]@@
->\
->@@[=--Function
that posts the given page.=]@@
@@[=function ->@@[=function tvtropes.post(page, body, author, reason)=]@@
@@[==]@@
@@[=
->\
->@@[=
page=]=[=fullname(page)=]@@
@@[==]@@
@@[=
->\
->@@[=
assert(type(body)=]=[==]=[="string","Page body required")=]@@
@@[==]@@
@@[=
->\
->@@[=
local response =]=[==]@@
@@[= ->@@[= {http.request(authpageurl(page),=]@@
@@[= ->@@[= urlencode.table{=]@@
@@[= ->@@[= action=]=[="post", post=]=[="save",=]@@
@@[= ->@@[= pagename=]=[=page, text=]=[=body,=]@@
@@[= ->@@[= author=]=[=author or "Anonymous",=]@@
@@[= ->@@[= reason=]=[=reason or ""=]@@
@@[= ->@@[= })}=]@@
@@[==]@@
@@[=
->\
->@@[=
--Error on any socket errors=]@@
@@[= ->@@[= assert(response[1=]][=,response[2=]][=)=]@@
@@[==]@@
@@[=
->\
->@@[=
--If it doesn't return Found, return nil, the status, and the body:=]@@
@@[= ->@@[= --sometimes it just rejects the password for some reason.=]@@
@@[= ->@@[= if tonumber(response[2=]][=)~=]=[=302 then=]@@
@@[= ->@@[= return nil, response[2=]][=, response[1=]][==]@@
@@[= ->@@[= else return true=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Technically,
->@@[=end=]@@
->\
->@@[=--Technically,
this is kind of a general function, but it's designed exclusively around=]@@
@@[=--TVTropes' ->@@[=--TVTropes' source converter, so it's kept in here.=]@@
@@[=local ->@@[=local html2plain=]@@
@@[=do=]@@
@@[=
->@@[=do=]@@
->@@[=
local ents =]=[= {quot=]=[='"', amp=]=[='&', lt=]=[='<', gt=]=[='>'}=]@@
@@[==]@@
@@[=
->\
->@@[=
function html2plain(src)=]@@
@@[= ->@@[= src=]=[=string.gsub(src,"<br/>","\n")=]@@
@@[= ->@@[= src=]=[=string.gsub(src,"&(=]%[=w-);",ents)=]@@
@@[= ->@@[= return src=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function
->@@[=end=]@@
->\
->@@[=--Function
that gets a given page source.=]@@
@@[=function ->@@[=function tvtropes.get(page)=]@@
@@[==]@@
@@[=
->\
->@@[=
page=]=[=fullname(page)=]@@
@@[==]@@
@@[=
->\
->@@[=
local body, code =]=[= http.request(=]@@
@@[= ->@@[= authpageurl(page)..'?action=]=[=source')=]@@
@@[==]@@
@@[=
->\
->@@[=
--Trigger error on socket failure=]@@
@@[= ->@@[= assert(body,code)=]@@
@@[==]@@
@@[=
->\
->@@[=
--Return the source converted back from the HTML conversion=]@@
@@[= ->@@[= return html2plain(body)=]@@
@@[=end=]@@
@@[==]@@
@@[=return
->@@[=end=]@@
->\
->@@[=return
tvtropes=]@@



@@[=local tvtropes =]=[= require "tvtropes"=]@@
@@[==]@@
@@[=local target =]=[= "Tropers/STUART"=]@@
@@[=local user=]=[="STUART"=]@@
@@[==]@@
@@[=local scripts=]=[={=]@@
@@[= "urlencode.lua",=]@@
@@[= "tvtropes.lua",=]@@
@@[= "tropersrepo.lua",=]@@
@@[= "arrdev_recap.lua",=]@@
@@[=}=]@@
@@[==]@@
@@[=local function scriptfolder(name,script)=]@@
@@[= return string.format(=]@@
@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= name,script)=]@@
@@[=end=]@@
@@[==]@@
@@[=local function revsection()=]@@
@@[= local folders=]=[={=]@@
@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= "[[foldercontrol=]][==]][="=]@@
@@[= }=]@@
@@[= local headers=]=[=#folders=]@@
@@[==]@@
@@[= for i=]=[=1, #scripts do=]@@
@@[= local slines=]=[={}=]@@
@@[= for line in io.lines(scripts[i=]][=) do=]@@
@@[==]@@
@@[= --escape all equals signs and percents=]@@
@@[= local escaped=]=[=string.gsub(line,"[=]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@
@@[==]@@
@@[= slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[= end=]@@
@@[==]@@
@@[= local content=]=[=table.concat(slines,'\n')=]@@
@@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= end=]@@
@@[==]@@
@@[= folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@
@@[==]@@
@@[= return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
@@[==]@@
@@[=local function push(notes)=]@@
@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[==]@@
@@[= print(string.format("Getting current version of =]%[=s...",target))=]@@
@@[==]@@
@@[= local current=]=[=tvtropes.get(target)=]@@
@@[==]@@
@@[= local updated=]=[=string.gsub(current,=]@@
@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= gssscripts)=]@@
@@[==]@@
@@[= print(string.format("Posting new version of =]%[=s...",target))=]@@
@@[==]@@
@@[= local posted=]@@
@@[= while not posted do=]@@
@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= if not posted then print" Retrying..." end=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Executing code---------------------------------------------------------------=]@@
@@[==]@@
@@[=push "more madness from which there is no escape"=]@@
@@[==]@@
@@[==]@@

to:

@@[=local ->@@[=local tvtropes =]=[= require "tvtropes"=]@@
@@[==]@@
@@[=local
->\
->@@[=local
target =]=[= "Tropers/STUART"=]@@
@@[=local ->@@[=local user=]=[="STUART"=]@@
@@[==]@@
@@[=local
->\
->@@[=local
scripts=]=[={=]@@
@@[= ->@@[= "urlencode.lua",=]@@
@@[= ->@@[= "tvtropes.lua",=]@@
@@[= ->@@[= "tropersrepo.lua",=]@@
@@[= ->@@[= "arrdev_recap.lua",=]@@
@@[=}=]@@
@@[==]@@
@@[=local
->@@[=}=]@@
->\
->@@[=local
function scriptfolder(name,script)=]@@
@@[= ->@@[= return string.format(=]@@
@@[= ->@@[= "[[folder:=]%[=s=]][==]][=\n=]%[=s\n[[/folder=]][==]][=",=]@@
@@[= ->@@[= name,script)=]@@
@@[=end=]@@
@@[==]@@
@@[=local
->@@[=end=]@@
->\
->@@[=local
function revsection()=]@@
@@[= ->@@[= local folders=]=[={=]@@
@@[= ->@@[= "=]%[==]%[=STARTSCRIPTS=]%[==]%[=",=]@@
@@[= ->@@[= "[[foldercontrol=]][==]][="=]@@
@@[= ->@@[= }=]@@
@@[= ->@@[= local headers=]=[=#folders=]@@
@@[==]@@
@@[=
->\
->@@[=
for i=]=[=1, #scripts do=]@@
@@[= ->@@[= local slines=]=[={}=]@@
@@[= ->@@[= for line in io.lines(scripts[i=]][=) do=]@@
@@[==]@@
@@[=
->\
->@@[=
--escape all equals signs and percents=]@@
@@[= ->@@[= if line=]=[==]=[="" then=]@@
->@@[= slines[#slines+1=]][==]=[='->\\'=]@@
->@@[= else=]@@
->@@[=
local escaped=]=[=string.gsub(line,"[=]%[==]=[==]%[==]][==]%[==]%[==]][=",=]@@
@@[= ->@@[= function(char) return string.format("=]=[==]][=&#=]%[=i;[=]=[=",string.byte(char)) end)=]@@
@@[==]@@
@@[=
->\
->@@[=
slines[#slines+1=]][==]=[=string.format("@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
@@[=
format("->@@[=]=[==]%[=s=]=[==]][=@@",escaped)=]@@
->@@[=
end=]@@
@@[==]@@
@@[=
->@@[= end=]@@
->\
->@@[=
local content=]=[=table.concat(slines,'\n')=]@@
@@[= ->@@[= folders[i+headers=]][==]=[=scriptfolder(scripts[i=]][=,content)=]@@
@@[= ->@@[= end=]@@
@@[==]@@
@@[=
->\
->@@[=
folders[#folders+1=]][==]=[="=]%[==]%[=ENDSCRIPTS=]%[==]%[="=]@@
@@[==]@@
@@[=
->\
->@@[=
return table.concat(folders,"\n\n")=]@@
@@[=end=]@@
@@[==]@@
@@[=local
->@@[=end=]@@
->\
->@@[=local
function push(notes)=]@@
@@[= ->@@[= local gssscripts=]=[=string.gsub(revsection(),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[==]@@
@@[=
->\
->@@[=
print(string.format("Getting current version of =]%[=s...",target))=]@@
@@[==]@@
@@[=
->\
->@@[=
local current=]=[=tvtropes.get(target)=]@@
@@[==]@@
@@[=
->\
->@@[=
local updated=]=[=string.gsub(current,=]@@
@@[= ->@@[= "=]%[==]%[==]%[==]%[=STARTSCRIPTS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDSCRIPTS=]%[==]%[==]%[==]%[=",=]@@
@@[= ->@@[= gssscripts)=]@@
@@[==]@@
@@[=
->\
->@@[=
print(string.format("Posting new version of =]%[=s...",target))=]@@
@@[==]@@
@@[=
->\
->@@[=
local posted=]@@
@@[= ->@@[= while not posted do=]@@
@@[= ->@@[= posted=]=[=tvtropes.post(target,updated,user,notes)=]@@
@@[= ->@@[= if not posted then print" Retrying..." end=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Executing
->@@[=end=]@@
->\
->@@[=--Executing
code---------------------------------------------------------------=]@@
@@[==]@@
@@[=push
->\
->@@[=push
"more madness from which there is no escape"=]@@
@@[==]@@
@@[==]@@
->\
->\



@@[=--encoding: UTF-8=]@@
@@[==]@@
@@[=--Required to post pages=]@@
@@[=local tvtropes=]=[=require "tvtropes"=]@@
@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local urlencode=]=[=require "urlencode"=]@@
@@[==]@@
@@[=--Arrested Development data----------------------------------------------------=]@@
@@[=adeps=]=[={=]@@
@@[= {=]@@
@@[= "Pilot",=]@@
@@[= "Top Banana",=]@@
@@[= "Bringing Up Buster",=]@@
@@[= "Key Decisions",=]@@
@@[= "Visiting Ours",=]@@
@@[= "Charity Drive",=]@@
@@[= "My Mother, The Car",=]@@
@@[= "In God We Trust",=]@@
@@[= "Storming the Castle",=]@@
@@[= "Pier Pressure",=]@@
@@[= "Public Relations",=]@@
@@[= "Marta Complex",=]@@
@@[= "Beef Consommé",=]@@
@@[= "Shock and Aww",=]@@
@@[= "Staff Infection",=]@@
@@[= "Missing Kitty",=]@@
@@[= "Altar Egos",=]@@
@@[= "Justice Is Blind",=]@@
@@[= "Best Man for the GOB",=]@@
@@[= "Whistler's Mother",=]@@
@@[= "Not Without My Daughter",=]@@
@@[= "Let 'Em Eat Cake"=]@@
@@[= },=]@@
@@[= {=]@@
@@[= "The One Where Michael Leaves",=]@@
@@[= "The One Where They Build a House",=]@@
@@[= "¡Amigos!",=]@@
@@[= "Good Grief",=]@@
@@[= "Sad Sack",=]@@
@@[= "Afternoon Delight",=]@@
@@[= "Switch Hitter",=]@@
@@[= "Queen for a Day",=]@@
@@[= "Burning Love",=]@@
@@[= "Ready, Aim, Marry Me",=]@@
@@[= "Out on a Limb",=]@@
@@[= "Hand to God",=]@@
@@[= "Motherboy XXX",=]@@
@@[= "The Immaculate Election",=]@@
@@[= "Sword of Destiny",=]@@
@@[= "Meat the Veals",=]@@
@@[= "Spring Breakout",=]@@
@@[= "Righteous Brothers",=]@@
@@[= },=]@@
@@[= {=]@@
@@[= "The Cabin Show",=]@@
@@[= "For British Eyes Only",=]@@
@@[= "Forget-Me-Now",=]@@
@@[= "Notapusy",=]@@
@@[= "Mr. F",=]@@
@@[= "The Ocean Walker",=]@@
@@[= "Prison Break-In",=]@@
@@[= "Making a Stand",=]@@
@@[= "S.O.B.s",=]@@
@@[= "Fakin' It",=]@@
@@[= "Family Ties",=]@@
@@[= "Exit Strategy",=]@@
@@[= "Development Arrested"=]@@
@@[= },=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
@@[==]@@
@@[=--Interwiki data---------------------------------------------------------------=]@@
@@[=local tokens=]=[={}=]@@
@@[==]@@
@@[=do --wikipedia=]@@
@@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= --whose article titles end with "(Arrested Development)"=]@@
@@[= local disambigeps=]=[={=]@@
@@[= {1,2,8,11,20,21,22}, --Season 1=]@@
@@[= {5,6,8,9,11,12,18}, --Season 2=]@@
@@[= {10,11,12} --Season 3=]@@
@@[= }=]@@
@@[==]@@
@@[= --construct lookup table=]@@
@@[= local disambiguated=]=[={}=]@@
@@[= for s=]=[=1,#disambigeps do=]@@
@@[= disambiguated[s=]][==]=[={}=]@@
@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= end=]@@
@@[= end=]@@
@@[==]@@
@@[= --Function that returns the Wikipedia URL=]@@
@@[= function tokens.wikipedia(s,e)=]@@
@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= if disambiguated[s=]][=[e=]][= then=]@@
@@[= --Technically, parentheses don't have to be percent-encoded=]@@
@@[= --for HTTP URIs because they're unused sub-delims=]@@
@@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= --the function that percent-encodes all sub-delims=]@@
@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= end=]@@
@@[==]@@
@@[= return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function tokens.wikia(s,e)=]@@
@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
@@[==]@@
@@[=do --Balboa Observer-Picayune=]@@
@@[= --Season 1 episodes that are listed at different numbers=]@@
@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
@@[==]@@
@@[= --Function the returns the URL of the episode's page on the-op.com=]@@
@@[= function tokens.theop(s,e)=]@@
@@[= --correct OutOfOrder Season 1 episodes=]@@
@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= end=]@@
@@[=end=]@@
\\
@@[=do --IMDB=]@@
@@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= --that I have to use you=]@@
@@[= local ttnums=]=[={=]@@
@@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= 0515232, 0515224, },=]@@
@@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= 0515227, 0515245, 0515241, },=]@@
@@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= 0515217, 0515215, 0757386, }=]@@
@@[= }=]@@
@@[==]@@
@@[= --Function that returns the URL for the episode's IMDB page=]@@
@@[= function tokens.imdb(s,e)=]@@
@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=do --Hulu, you know, just in case=]@@
@@[= local watchnums=]=[={=]@@
@@[= { 589, 1786, 585, 1781, 1785,=]@@
@@[= 580, 590, 588, 586, 575,=]@@
@@[= 576, 579, 577, 644, 1783,=]@@
@@[= 591, 582, 584, 578, 581,=]@@
@@[= 583, 587},=]@@
@@[= { 6641, 6644, 6643, 6638, 6639,=]@@
@@[= 12883, 13226, 12561, 12609, 12298,=]@@
@@[= 12271, 12901, 13248, 13267, 13276,=]@@
@@[= 13206, 12232, 12532},=]@@
@@[= { 6640, 6642, 6635, 6636, 6637,=]@@
@@[= 12497, 17189, 12523, 13139, 12225,=]@@
@@[= 12317, 12194, 12215},=]@@
@@[= }=]@@
@@[==]@@
@@[= function tokens.hulu(s,e)=]@@
@@[= return string.format(=]@@
@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=do --Netflix Watch Instantly=]@@
@@[= --It's largely sequential, but not quite.=]@@
@@[= --I printed out all the numbers and moved them around=]@@
@@[= --to fit the correct order (which is both inconsistent=]@@
@@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= local movieids=]=[={=]@@
@@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= 70133693, 70133694, },=]@@
@@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= 70133709, 70133710, 70133712, },=]@@
@@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= 70133723, 70133724, 70133725, }=]@@
@@[= }=]@@
@@[==]@@
@@[= function tokens.netflix(s,e)=]@@
@@[= return string.format(=]@@
@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=-------------------------------------------------------------------------------=]@@
@@[==]@@
@@[=--Arrested Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[= local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki: [[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
@@[==]@@
@@[=Watch now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[= function ad_ep_links(s,e)=]@@
@@[= return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local function recap_pagename(s,e)=]@@
@@[= --get the ep title=]@@
@@[= local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= --replace the é in Beef Consommé=]@@
@@[= title=]=[=string.gsub(title,'é','e')=]@@
@@[= --transform to CamelCased WikiWord=]@@
@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= --Remove all non-alphanumeric characters=]@@
@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@
@@[==]@@
@@[= return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
@@[=end=]@@
@@[==]@@
@@[=local function post_ad_recap_starter(s,e)=]@@
@@[= return tvtropes.post(=]@@
@@[= recap_pagename(s,e),=]@@
@@[= string.format(=]@@
@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= "STUART",=]@@
@@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
@@[==]@@
@@[=local function update_links(reason)=]@@
@@[= return function(s,e)=]@@
@@[= --until comment syntax is changed, Amigos is manual-only=]@@
@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= else=]@@
@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= local success=]@@
@@[= while not success do=]@@
@@[= local code=]@@
@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= "STUART",reason)=]@@
@@[= if not success then print("Retrying... "..code) end=]@@
@@[= end=]@@
@@[= end=]@@
@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=local function for_all_eps(f)=]@@
@@[= for s=]=[=1,#adeps do=]@@
@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= f(s,e)=]@@
@@[= end=]@@
@@[= end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
@@[==]@@
@@[=--Okay, put your executing commands down here.=]@@

to:

@@[=--encoding: ->@@[=--encoding: UTF-8=]@@
@@[==]@@
@@[=--Required
->\
->@@[=--Required
to post pages=]@@
@@[=local ->@@[=local tvtropes=]=[=require "tvtropes"=]@@
@@[=--Required ->@@[=--Required for encoding Wikipedia article titles=]@@
@@[=local ->@@[=local urlencode=]=[=require "urlencode"=]@@
@@[==]@@
@@[=--Arrested
->\
->@@[=--Arrested
Development data----------------------------------------------------=]@@
@@[=adeps=]=[={=]@@
@@[=
->@@[=adeps=]=[={=]@@
->@@[=
{=]@@
@@[= ->@@[= "Pilot",=]@@
@@[= ->@@[= "Top Banana",=]@@
@@[= ->@@[= "Bringing Up Buster",=]@@
@@[= ->@@[= "Key Decisions",=]@@
@@[= ->@@[= "Visiting Ours",=]@@
@@[= ->@@[= "Charity Drive",=]@@
@@[= ->@@[= "My Mother, The Car",=]@@
@@[= ->@@[= "In God We Trust",=]@@
@@[= ->@@[= "Storming the Castle",=]@@
@@[= ->@@[= "Pier Pressure",=]@@
@@[= ->@@[= "Public Relations",=]@@
@@[= ->@@[= "Marta Complex",=]@@
@@[= ->@@[= "Beef Consommé",=]@@
@@[= ->@@[= "Shock and Aww",=]@@
@@[= ->@@[= "Staff Infection",=]@@
@@[= ->@@[= "Missing Kitty",=]@@
@@[= ->@@[= "Altar Egos",=]@@
@@[= ->@@[= "Justice Is Blind",=]@@
@@[= ->@@[= "Best Man for the GOB",=]@@
@@[= ->@@[= "Whistler's Mother",=]@@
@@[= ->@@[= "Not Without My Daughter",=]@@
@@[= ->@@[= "Let 'Em Eat Cake"=]@@
@@[= ->@@[= },=]@@
@@[= ->@@[= {=]@@
@@[= ->@@[= "The One Where Michael Leaves",=]@@
@@[= ->@@[= "The One Where They Build a House",=]@@
@@[= ->@@[= "¡Amigos!",=]@@
@@[= ->@@[= "Good Grief",=]@@
@@[= ->@@[= "Sad Sack",=]@@
@@[= ->@@[= "Afternoon Delight",=]@@
@@[= ->@@[= "Switch Hitter",=]@@
@@[= ->@@[= "Queen for a Day",=]@@
@@[= ->@@[= "Burning Love",=]@@
@@[= ->@@[= "Ready, Aim, Marry Me",=]@@
@@[= ->@@[= "Out on a Limb",=]@@
@@[= ->@@[= "Hand to God",=]@@
@@[= ->@@[= "Motherboy XXX",=]@@
@@[= ->@@[= "The Immaculate Election",=]@@
@@[= ->@@[= "Sword of Destiny",=]@@
@@[= ->@@[= "Meat the Veals",=]@@
@@[= ->@@[= "Spring Breakout",=]@@
@@[= ->@@[= "Righteous Brothers",=]@@
@@[= ->@@[= },=]@@
@@[= ->@@[= {=]@@
@@[= ->@@[= "The Cabin Show",=]@@
@@[= ->@@[= "For British Eyes Only",=]@@
@@[= ->@@[= "Forget-Me-Now",=]@@
@@[= ->@@[= "Notapusy",=]@@
@@[= ->@@[= "Mr. F",=]@@
@@[= ->@@[= "The Ocean Walker",=]@@
@@[= ->@@[= "Prison Break-In",=]@@
@@[= ->@@[= "Making a Stand",=]@@
@@[= ->@@[= "S.O.B.s",=]@@
@@[= ->@@[= "Fakin' It",=]@@
@@[= ->@@[= "Family Ties",=]@@
@@[= ->@@[= "Exit Strategy",=]@@
@@[= ->@@[= "Development Arrested"=]@@
@@[= ->@@[= },=]@@
@@[=}=]@@
@@[=-------------------------------------------------------------------------------=]@@
@@[==]@@
@@[=--Interwiki
->@@[=}=]@@
->@@[=-------------------------------------------------------------------------------=]@@
->\
->@@[=--Interwiki
data---------------------------------------------------------------=]@@
@@[=local ->@@[=local tokens=]=[={}=]@@
@@[==]@@
@@[=do
->\
->@@[=do
--wikipedia=]@@
@@[= ->@@[= --Numbers for episodes with ambiguous titles, Wikipedia-wise,=]@@
@@[= ->@@[= --whose article titles end with "(Arrested Development)"=]@@
@@[= ->@@[= local disambigeps=]=[={=]@@
@@[= ->@@[= {1,2,8,11,20,21,22}, --Season 1=]@@
@@[= ->@@[= {5,6,8,9,11,12,18}, --Season 2=]@@
@@[= ->@@[= {10,11,12} --Season 3=]@@
@@[= ->@@[= }=]@@
@@[==]@@
@@[=
->\
->@@[=
--construct lookup table=]@@
@@[= ->@@[= local disambiguated=]=[={}=]@@
@@[= ->@@[= for s=]=[=1,#disambigeps do=]@@
@@[= ->@@[= disambiguated[s=]][==]=[={}=]@@
@@[= ->@@[= for i=]=[=1,#disambigeps[s=]][= do=]@@
@@[= ->@@[= disambiguated[s=]][=[disambigeps[s=]][=[i=]][==]][==]=[=true=]@@
@@[= ->@@[= end=]@@
@@[= ->@@[= end=]@@
@@[==]@@
@@[=
->\
->@@[=
--Function that returns the Wikipedia URL=]@@
@@[= ->@@[= function tokens.wikipedia(s,e)=]@@
@@[= ->@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= ->@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= ->@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= ->@@[= if disambiguated[s=]][=[e=]][= then=]@@
@@[= ->@@[= --Technically, parentheses don't have to be percent-encoded=]@@
@@[= ->@@[= --for HTTP URIs because they're unused sub-delims=]@@
@@[= ->@@[= --per section 2.2 of RFC 3986, so we concatenate after=]@@
@@[= ->@@[= --the function that percent-encodes all sub-delims=]@@
@@[= ->@@[= pagename=]=[=pagename.."_(Arrested_Development)"=]@@
@@[= ->@@[= end=]@@
@@[==]@@
@@[=
->\
->@@[=
return "http://en.wikipedia.org/wiki/"..pagename=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function
->@@[=end=]@@
->\
->@@[=--Function
that returns the URL of the Arrested Development Wikia entry=]@@
@@[=function ->@@[=function tokens.wikia(s,e)=]@@
@@[= ->@@[= local pagename=]=[=adeps[s=]][=[e=]][==]@@
@@[= ->@@[= pagename=]=[=string.gsub(pagename,' ','_')=]@@
@@[= ->@@[= pagename=]=[=urlencode.string(pagename)=]@@
@@[= ->@@[= return "http://arresteddevelopment.wikia.com/wiki/"..pagename=]@@
@@[=end=]@@
@@[==]@@
@@[=do
->@@[=end=]@@
->\
->@@[=do
--Balboa Observer-Picayune=]@@
@@[= ->@@[= --Season 1 episodes that are listed at different numbers=]@@
@@[= ->@@[= local s1flips=]=[={ [5=]][==]=[=6, [6=]][==]=[=5, [7=]][==]=[=8, [8=]][==]=[=7, [16=]][==]=[=18, [17=]][==]=[=16, [18=]][==]=[=17 }=]@@
@@[==]@@
@@[=
->\
->@@[=
--Function the returns the URL of the episode's page on the-op.com=]@@
@@[= ->@@[= function tokens.theop(s,e)=]@@
@@[= ->@@[= --correct OutOfOrder Season 1 episodes=]@@
@@[= ->@@[= if s=]=[==]=[=1 then e =]=[= s1flips[e=]][= or e end=]@@
@@[= ->@@[= return string.format("http://the-op.com/episode/=]%[=i=]%[=02i",s,e)=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
\\
@@[=do
->@@[=end=]@@
->\
->@@[=do
--IMDB=]@@
@@[= ->@@[= --why hello, unreadable block of arbitrary indices, it sure sucks=]@@
@@[= ->@@[= --that I have to use you=]@@
@@[= ->@@[= local ttnums=]=[={=]@@
@@[= ->@@[= { 0515236, 0515256, 0515212, 0515223, 0515257,=]@@
@@[= ->@@[= 0515214, 0515231, 0515221, 0515247, 0515235,=]@@
@@[= ->@@[= 0515238, 0515226, 0515210, 0515244, 0515246,=]@@
@@[= ->@@[= 0515228, 0515208, 0515222, 0515211, 0515258,=]@@
@@[= ->@@[= 0515232, 0515224, },=]@@
@@[= ->@@[= { 0515253, 0515254, 0515209, 0515219, 0515243,=]@@
@@[= ->@@[= 0515207, 0515248, 0515239, 0515213, 0515240,=]@@
@@[= ->@@[= 0515234, 0515220, 0515229, 0515251, 0515255,=]@@
@@[= ->@@[= 0515227, 0515245, 0515241, },=]@@
@@[= ->@@[= { 0515250, 0515249, 0515218, 0515233, 0515230,=]@@
@@[= ->@@[= 0515252, 0515237, 0515225, 0515242, 0515216,=]@@
@@[= ->@@[= 0515217, 0515215, 0757386, }=]@@
@@[= ->@@[= }=]@@
@@[==]@@
@@[=
->\
->@@[=
--Function that returns the URL for the episode's IMDB page=]@@
@@[= ->@@[= function tokens.imdb(s,e)=]@@
@@[= ->@@[= return string.format("http://www.imdb.com/title/tt=]%[=07i/",ttnums[s=]][=[e=]][=)=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=do
->@@[=end=]@@
->\
->@@[=do
--Hulu, you know, just in case=]@@
@@[= ->@@[= local watchnums=]=[={=]@@
@@[= ->@@[= { 589, 1786, 585, 1781, 1785,=]@@
@@[= ->@@[= 580, 590, 588, 586, 575,=]@@
@@[= ->@@[= 576, 579, 577, 644, 1783,=]@@
@@[= ->@@[= 591, 582, 584, 578, 581,=]@@
@@[= ->@@[= 583, 587},=]@@
@@[= ->@@[= { 6641, 6644, 6643, 6638, 6639,=]@@
@@[= ->@@[= 12883, 13226, 12561, 12609, 12298,=]@@
@@[= ->@@[= 12271, 12901, 13248, 13267, 13276,=]@@
@@[= ->@@[= 13206, 12232, 12532},=]@@
@@[= ->@@[= { 6640, 6642, 6635, 6636, 6637,=]@@
@@[= ->@@[= 12497, 17189, 12523, 13139, 12225,=]@@
@@[= ->@@[= 12317, 12194, 12215},=]@@
@@[= ->@@[= }=]@@
@@[==]@@
@@[=
->\
->@@[=
function tokens.hulu(s,e)=]@@
@@[= ->@@[= return string.format(=]@@
@@[= ->@@[= "http://hulu.com/watch/=]%[=i", watchnums[s=]][=[e=]][=)=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=do
->@@[=end=]@@
->\
->@@[=do
--Netflix Watch Instantly=]@@
@@[= ->@@[= --It's largely sequential, but not quite.=]@@
@@[= ->@@[= --I printed out all the numbers and moved them around=]@@
@@[= ->@@[= --to fit the correct order (which is both inconsistent=]@@
@@[= ->@@[= --in IDs to Netflix order and Netflix to DVD order).=]@@
@@[= ->@@[= local movieids=]=[={=]@@
@@[= ->@@[= { 70133673, 70133674, 70133675, 70133677, 70133676,=]@@
@@[= ->@@[= 70133678, 70133680, 70133679, 70133681, 70133682,=]@@
@@[= ->@@[= 70133683, 70133684, 70133685, 70133686, 70133687,=]@@
@@[= ->@@[= 70133688, 70133689, 70133690, 70133691, 70133692,=]@@
@@[= ->@@[= 70133693, 70133694, },=]@@
@@[= ->@@[= { 70133695, 70133696, 70133697, 70133698, 70133699,=]@@
@@[= ->@@[= 70133700, 70133701, 70133702, 70133703, 70133704,=]@@
@@[= ->@@[= 70133705, 70133706, 70133707, 70133708, 70133711,=]@@
@@[= ->@@[= 70133709, 70133710, 70133712, },=]@@
@@[= ->@@[= { 70133713, 70133714, 70133715, 70133716, 70133717,=]@@
@@[= ->@@[= 70133718, 70133720, 70133719, 70133721, 70133722,=]@@
@@[= ->@@[= 70133723, 70133724, 70133725, }=]@@
@@[= ->@@[= }=]@@
@@[==]@@
@@[=
->\
->@@[=
function tokens.netflix(s,e)=]@@
@@[= ->@@[= return string.format(=]@@
@@[= ->@@[= "http://www.netflix.com/WiPlayer?movieid=]=[==]%[=i",movieids[s=]][=[e=]][=)=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=-------------------------------------------------------------------------------=]@@
@@[==]@@
@@[=--Arrested
->@@[=end=]@@
->\
->@@[=-------------------------------------------------------------------------------=]@@
->\
->@@[=--Arrested
Development TV Tropes Recap stuff-----------------------------------=]@@
@@[=local ->@@[=local ad_ep_links=]@@
@@[=do=]@@
@@[=
->@@[=do=]@@
->@@[=
local template=]=[=[=]=[=[=]@@
@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
@@[=----=]@@
@@[=Interwiki:
->@@[==]%[==]%[=STARTLINKS=]%[==]%[==]@@
->@@[=----=]@@
->@@[=Interwiki:
[[$wikipedia Wikipedia=]][==]][= -- [[$wikia Wikia=]][==]][= -- [[$theop Balboa Observer-Picayune=]][==]][= -- [[$imdb IMDB=]][==]][==]@@
@@[==]@@
@@[=Watch
->\
->@@[=Watch
now: [[$hulu Hulu=]][==]][= -- [[$netflix Netflix=]][==]][==]@@
@@[=----=]@@
@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
@@[==]][==]=[==]][==]@@
@@[=
->@@[=----=]@@
->@@[==]%[==]%[=ENDLINKS=]%[==]%[==]@@
->@@[==]][==]=[==]][==]@@
->@@[=
function ad_ep_links(s,e)=]@@
@@[= ->@@[= return (string.gsub(template,"=]%[=$(=]%[=w+)",function(token) return tokens[token=]][=(s,e) end))=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=--Function
->@@[=end=]@@
->\
->@@[=--Function
that returns the page name of the episode's TVTropes Recap page.=]@@
@@[=local ->@@[=local function recap_pagename(s,e)=]@@
@@[= ->@@[= --get the ep title=]@@
@@[= ->@@[= local title=]=[=adeps[s=]][=[e=]][==]@@
@@[= ->@@[= --replace the é in Beef Consommé=]@@
@@[= ->@@[= title=]=[=string.gsub(title,'é','e')=]@@
@@[= ->@@[= --transform to CamelCased WikiWord=]@@
@@[= ->@@[= title=]=[=string.gsub(title,' (=]%[=l?)',string.upper)=]@@
@@[= ->@@[= --Remove all non-alphanumeric characters=]@@
@@[= ->@@[= title=]=[=string.gsub(title,'=]%[=W','')=]@@
@@[==]@@
@@[=
->\
->@@[=
return string.format("Recap/ArrestedDevelopmentS=]%[=iE=]%[=i=]%[=s",s,e,title)=]@@
@@[=end=]@@
@@[==]@@
@@[=local
->@@[=end=]@@
->\
->@@[=local
function post_ad_recap_starter(s,e)=]@@
@@[= ->@@[= return tvtropes.post(=]@@
@@[= ->@@[= recap_pagename(s,e),=]@@
@@[= ->@@[= string.format(=]@@
@@[= ->@@[= "\n\n=]%[=s\n!The ''ArrestedDevelopment'' episode \"=]%[=s\" provides examples of:\n\n",=]@@
@@[= ->@@[= ad_ep_links(s,e),adeps[s=]][=[e=]][=),=]@@
@@[= ->@@[= "STUART",=]@@
@@[= ->@@[= "Adding interwiki links and example header automatically (Ask me about Lua)")=]@@
@@[=end=]@@
@@[==]@@
@@[=local
->@@[=end=]@@
->\
->@@[=local
function update_links(reason)=]@@
@@[= ->@@[= return function(s,e)=]@@
@@[= ->@@[= --until comment syntax is changed, Amigos is manual-only=]@@
@@[= ->@@[= if s=]=[==]=[=2 and e=]=[==]=[=3 then=]@@
@@[= ->@@[= print "(Skipping Amigos because the links go all screwy)"=]@@
@@[= ->@@[= else=]@@
@@[= ->@@[= local pagename=]=[=recap_pagename(s,e)=]@@
@@[= ->@@[= local pageasis=]=[=tvtropes.get(pagename)=]@@
@@[= ->@@[= local gsubsafelinks =]=[= string.gsub(ad_ep_links(s,e),"=]%[==]%[=","=]%[==]%[==]%[==]%[=")=]@@
@@[= ->@@[= local success=]@@
@@[= ->@@[= while not success do=]@@
@@[= ->@@[= local code=]@@
@@[= ->@@[= success, code =]=[= tvtropes.post(pagename,=]@@
@@[= ->@@[= string.gsub(pageasis,"=]%[==]%[==]%[==]%[=STARTLINKS=]%[==]%[==]%[==]%[=.-=]%[==]%[==]%[==]%[=ENDLINKS=]%[==]%[==]%[==]%[=",gsubsafelinks),=]@@
@@[= ->@@[= "STUART",reason)=]@@
@@[= ->@@[= if not success then print("Retrying... "..code) end=]@@
@@[= ->@@[= end=]@@
@@[= ->@@[= end=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[==]@@
@@[=local
->@@[=end=]@@
->\
->@@[=local
function for_all_eps(f)=]@@
@@[= ->@@[= for s=]=[=1,#adeps do=]@@
@@[= ->@@[= for e=]=[=1,#adeps[s=]][= do=]@@
@@[= ->@@[= print(string.format('Doing Season =]%[=i Episode =]%[=i, "=]%[=s"...',s,e,adeps[s=]][=[e=]][=))=]@@
@@[= ->@@[= f(s,e)=]@@
@@[= ->@@[= end=]@@
@@[= ->@@[= end=]@@
@@[=end=]@@
@@[=-------------------------------------------------------------------------------=]@@
@@[==]@@
@@[=--Okay,
->@@[=end=]@@
->@@[=-------------------------------------------------------------------------------=]@@
->\
->@@[=--Okay,
put your executing commands down here.=]@@

Top