Source: site.view [edit]
Function name: indexAuthorInfo
Arguments:
Description:
Page type: webl
Render function:  
Module: perfectCartoon

Page source:

   
   var cln2 = fun(s)
      s = ExpandCharEntities(Str_Trim(s));
      s = Wub_ReplaceAll(s, "/>", "");
      s = Wub_ReplaceAll(s, "\t", " ");
      s = Wub_ReplaceAll(s, "\\", "");
      s = Wub_ReplaceAll(s, `"`, "'");
      s = Wub_ReplaceAll(s, "???", "");
      s = Wub_ReplaceAll(s, "??", "");
      // s = Wub_ReplaceAll(s, ",", " ");
      return s;
   end;
  
   var cln = fun(s)
      return cln2(Text(s));
   end;
     
     
   var authorInfo = "";
   var P = GetURL("https://docs.google.com/spreadsheet/pub?key=0AsUaQihpzloZdHVybXJJemV4dXRpek5vMzdxdDc5Vmc&output=html");

   Wub_DropDB("perfectCartoon");
   var db = Wub_GetDB("perfectCartoon");
   var coll = Wub_GetCollection(db, "authors");

   every tr in Elem(P, "tr") do
     var dir = tr.dir ? nil;
     if (dir == "ltr") then
        var tds = Elem(P, "td") inside tr;
     
        var fAuthor = cln(tds[1]);
        var fImgUrl = cln(tds[2]);
        var fHomePage = cln(tds[3]);
        var fFacebook = cln(tds[4]);
        var fTwitter = cln(tds[5]);
        var fAboutUrl = cln(tds[6]);
        var fPortfolio = cln(tds[7]);
        var fBio = cln(tds[8]);
     
        if (fAuthor != "author") then
           var dbobj = Wub_NewDBObject([. author=fAuthor, imgUrl=fImgUrl, homepage=fHomePage, facebook=fFacebook,
                                       twitter=fTwitter, aboutUrl=fAboutUrl, portfolio=fPortfolio, bio=fBio .]); 
           Wub_InsertDB(coll, dbobj);

           authorInfo = authorInfo + cln(tds[1]) + "\n";
        end
     end
   end;
   authorInfo;