Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended length summary support #15

Open
rjhorniii opened this issue Feb 18, 2018 · 0 comments
Open

Extended length summary support #15

rjhorniii opened this issue Feb 18, 2018 · 0 comments

Comments

@rjhorniii
Copy link

The RFC does not limit the length of summary fields, although it permits implementations to truncate at 255 characters.

The following patch allows the summary to span multiple lines in the Ical file, at least to the limit of my testing.

Subject: [PATCH] allow extended length SUMMARY

---

 parse.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/parse.go b/parse.go
index 48cbfc3..0dd2634 100644
--- a/parse.go
+++ b/parse.go
@@ -431,9 +431,9 @@ func (p *Parser) parseEvents(cal *Calendar, eventsData []string) {
 
 // parses the event summary
 func (p *Parser) parseEventSummary(eventData string) string {
-	re, _ := regexp.Compile(`SUMMARY:.*?\n`)
+	re, _ := regexp.Compile(`SUMMARY:.*?\n(?:\s+.*?\n)*`)
 	result := re.FindString(eventData)
-	return trimField(result, "SUMMARY:")
+	return trimField(strings.Replace(result, "\r\n ", "", -1), "SUMMARY:")
 }
 
 // parses the event status
-- 
2.13.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant