blob: ac55c78c721e9e797484170f67fcf094cd50057d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
(function(module, ns) {
var Base = ns.require('sax/base');
var CalendarDataHandler = Base.create({
name: 'calendar data',
//don't add text only elements
//to the stack as objects
onopentag: null,
onclosetag: null,
//add the value to the parent
//value where key is local tag name
//and value is the text.
ontext: function(data) {
return CalendarDataHandler.ondata.call(this, data);
},
// Servers can also stash ical data inside of an xml cdata.
oncdata: function(data) {
return CalendarDataHandler.ondata.call(this, data);
},
});
CalendarDataHandler.ondata = function(data) {
var handler = this.handler;
this.current[this.currentTag[handler.tagField]] =
CalendarDataHandler.parseICAL(data);
};
/**
* Default ical parser handler.
*
* XXX: Feels a little hacky but works...
*/
CalendarDataHandler.parseICAL = function(input) {
return input;
};
module.exports = CalendarDataHandler;
}.apply(
this,
(this.Caldav) ?
[Caldav('sax/calendar_data_handler'), Caldav] :
[module, require('../caldav')]
));
|