Skip to content

Extended length summary support #15

Open
@rjhorniii

Description

@rjhorniii

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions