parseICS : function()

in js/libs/ical.js [413:449]


      parseICS : function(str){
        var self = this
        var lines = str.split(/\r?\n/)
        var ctx = {}
        var stack = []
  
        for (var i = 0, ii = lines.length, l = lines[0]; i<ii; i++, l=lines[i]){
          //Unfold : RFC#3.1
          while (lines[i+1] && /[ \t]/.test(lines[i+1][0])) {
            l += lines[i+1].slice(1)
            i += 1
          }
  
          var kv = l.split(":")
  
          if (kv.length < 2){
            // Invalid line - must have k&v
            continue;
          }
  
          // Although the spec says that vals with colons should be quote wrapped
          // in practise nobody does, so we assume further colons are part of the
          // val
          var value = kv.slice(1).join(":")
            , kp = kv[0].split(";")
            , name = kp[0]
            , params = kp.slice(1)
  
          ctx = self.handleObject(name, value, params, ctx, stack, l) || {}
        }
  
         // type and params are added to the list of items, get rid of them.
         delete ctx.type
         delete ctx.params
  
         return ctx
      }