Tuesday, August 18, 2009 at 7:30 PM.
myTwitterProfileSuite.saveOutline
on saveOutline (title, username, adroutline, pagenum=nil) { <<Changes <<5/19/09; 12:21:38 PM by DW <<Add optional pagenum param. <<3/21/09; 11:09:48 PM by DW <<Created. local (adrdata = myTwitterProfileSuite.init ()); local (t, level = 0); bundle { //initial setup of t local (adr); t = adrdata^.params; for adr in @t { if (typeof (adr^) == wptexttype) or (typeof (adr^) == outlinetype) { local (s = string (adr^)); delete (adr); adr^ = s}}}; t.title = title; t.username = username; t.now = clock.now (); t.disqusCode = string (myTwitterProfileSuite.data.disqusThreadCode); t.baseUrl = myTwitterProfileSuite.data.urls.baseSiteUrl; t.bodytext = ""; scratchpad.t = t; on dolevel (adroutline) { local (adrsub); for adrsub in adroutline { if nameof (adrsub^) endswith "outline" { local (linetext = xml.entitydecode (adrsub^.["/atts"].text, true), i); for i = 1 to level { linetext = "<blockquote>" + linetext + "</blockquote>"}; linetext = string.filledstring ("\t", level) + linetext; if defined (adrsub^.["/atts"].pagebreak) { local (url = myTwitterProfileSuite.saveOutline (linetext, username, adrsub, adrsub^.["/atts"].pagenum)); t.bodytext = t.bodytext + "<p><a href=\"" + url + "\">" + linetext + "</a></p>\r"} else { local (flsubs); t.bodytext = t.bodytext + "<p>" + linetext + "</p>\r"; bundle { //set flsubs local (adrpeek); for adrpeek in adrsub { if nameof (adrpeek^) endswith "outline" { flsubs = true; break}}}; if flsubs { level++; dolevel (adrsub); level--}}}}}; dolevel (adroutline); local (s = string.multiplereplaceall (string (adrdata^.prefs.template), @t, false, "<%", "%>")); local (url = myTwitterProfileSuite.saveStaticFile (username, s, pagenum)); <<bundle //old code <<local (server = "xmlrpc://rpc.mytwitterprofile.com:5337/RPC2", url) <<if pagenum == nil <<url = [server].mytwitterProfile.saveWebText (username, s) <<else <<url = [server].mytwitterProfile.saveWebText (username, s, pagenum) return (url)}; bundle { //test code webbrowser.openurl (saveOutline ("Home", "davewiner", @scratchpad.opmlstruct.["00003000\topml"].["00003000\tbody"].["00003000\toutline"]))} <<tcp.dns.getdottedid ("rpc.mytwitterprofile.com") <<"70.85.234.139"
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.