Commit 6b8a3025 authored by Sebastian's avatar Sebastian
Browse files

Code folding / Lines exceed 75-byte limit

close #46
parent f046beba
......@@ -128,4 +128,10 @@ module.exports.toJSON = function(object, attributes, options) {
});
return result;
};
module.exports.foldLines = function(input) {
return input.split('\r\n').map(function(line) {
return line.match(/(.{1,74})/g).join('\r\n ');
}).join('\r\n');
};
\ No newline at end of file
......@@ -66,6 +66,8 @@ var ICalCalendar = function(_data) {
});
g += 'END:VCALENDAR';
g = tools.foldLines(g);
return g;
};
......
......@@ -9,6 +9,8 @@ DTSTART:20131004T223930Z
DTEND:20131004T231500Z
SUMMARY:Sample Event
LOCATION:localhost
DESCRIPTION:Lorem ipsum dolor sit amet\, consetetur sadipscing elitr\, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat\, sed diam voluptua.\nbeep boop
DESCRIPTION:Lorem ipsum dolor sit amet\, consetetur sadipscing elitr\, sed
diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam era
t\, sed diam voluptua.\nbeep boop
END:VEVENT
END:VCALENDAR
\ No newline at end of file
......@@ -11,8 +11,10 @@ X-MICROSOFT-CDO-ALLDAYEVENT:TRUE
X-MICROSOFT-MSNCALENDAR-ALLDAYEVENT:TRUE
SUMMARY:Sample Event
ORGANIZER;CN="Sebastian Pekarek":mailto:mail@sebbo.net
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;DELEGATED-FROM="matt@example.com";CN="John":MAILTO:john@example.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=DELEGATED;DELEGATED-TO="john@example.com";CN="Matt":MAILTO:matt@example.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;DELEGATED-FROM="matt@examp
le.com";CN="John":MAILTO:john@example.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=DELEGATED;DELEGATED-TO="john@exampl
e.com";CN="Matt":MAILTO:matt@example.com
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:-PT10M
......
......@@ -454,6 +454,7 @@ describe('ical-generator 0.1.x', function() {
});
/*jslint stupid: true */
console.log(cal.toString());
assert.equal(cal.toString(), fs.readFileSync(__dirname + '/results/generate_02.ics', 'utf8'));
});
......
......@@ -1863,7 +1863,7 @@ describe('ical-generator 0.2.x / ICalCalendar', function() {
});
event.createAttendee({email: 'mail@example.com', delegatedTo: 'foo@example.com'});
assert.ok(cal.toString().indexOf('foo@example.com') > -1);
assert.ok(cal.toString().indexOf('foo@example') > -1);
});
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment