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

Descriptions with paragraphs get cut off #26

Closed
khalwat opened this issue Sep 8, 2021 · 9 comments
Closed

Descriptions with paragraphs get cut off #26

khalwat opened this issue Sep 8, 2021 · 9 comments
Labels
bug Something isn't working

Comments

@khalwat
Copy link
Contributor

khalwat commented Sep 8, 2021

It seems like any paragraph after the first paragraph gets cut and doesn't display—at least when it's imported in iCal (default Mac Calendar app). Here's how the outputted ICS file looks.

from: #1 (comment)

Source:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam fermentum massa eu justo efficitur hendrerit. Pellentesque condimentum quam vitae lectus gravida, quis ullamcorper risus rutrum. Sed scelerisque elit dolor, quis sodales augue consectetur ac. Quisque diam nulla, sodales nec iaculis non, ornare faucibus urna. Nunc volutpat dui ac lorem placerat convallis. Donec egestas finibus nunc, id egestas sem tincidunt id. Aliquam bibendum eu dolor id venenatis.

Morbi dapibus neque id metus convallis viverra. Aliquam eu gravida arcu. Nam viverra est enim, at pretium diam iaculis dictum. Donec urna metus, sollicitudin eget massa viverra, feugiat ultrices arcu. Nunc lorem nunc, luctus ut ligula id, gravida hendrerit nibh. Nunc elementum risus sed finibus malesuada. Fusce in vestibulum odio. Vivamus faucibus sem nec lorem pretium, eget volutpat justo venenatis. Donec et viverra eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed quis lectus lectus.

Phasellus quis gravida nisi. Morbi in egestas ex. In aliquam eu risus vel imperdiet. Morbi mollis erat egestas est condimentum imperdiet. Nulla pretium diam sit amet suscipit vehicula. Aliquam fermentum tellus nibh, sit amet tristique metus venenatis ut. Nulla non diam id nisl feugiat gravida laoreet in dolor. Mauris sagittis enim ac dolor viverra, at feugiat quam vestibulum.

Pellentesque vulputate magna at ultrices elementum. Curabitur vulputate sapien sed arcu vestibulum aliquam. Vestibulum leo tellus, placerat nec felis sit amet, lacinia pharetra felis. Aenean cursus at mauris ut efficitur. Praesent auctor convallis erat, id mattis risus commodo a. Donec orci purus, venenatis ut lectus vitae, posuere molestie ex. Suspendisse vitae ante ac neque aliquam ultrices. Sed vel metus et dolor lacinia mollis.

Integer felis nulla, efficitur ac enim a, tempus placerat elit. Etiam pharetra magna ut risus viverra faucibus. Fusce gravida quis arcu porttitor condimentum. Nullam porta rutrum nibh, mollis convallis odio commodo vitae. Phasellus nec risus facilisis, fermentum lorem nec, aliquet arcu. Curabitur laoreet at dolor id pretium. Proin interdum nec leo ac finibus. Nam ut euismod magna. Nam pulvinar tempus pellentesque.

Output:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam fermentum ma
	ssa eu justo efficitur hendrerit. Pellentesque condimentum quam vitae lect
	us gravida, quis ullamcorper risus rutrum. Sed scelerisque elit dolor, qui
	s sodales augue consectetur ac. Quisque diam nulla, sodales nec iaculis no
	n, ornare faucibus urna. Nunc volutpat dui ac lorem placerat convallis. Do
	nec egestas finibus nunc, id egestas sem tincidunt id. Aliquam bibendum eu
	 dolor id venenatis.
Morbi dapibus neque id metus convallis viverra. Aliquam eu gravida arcu. Na
	m viverra est enim, at pretium diam iaculis dictum. Donec urna metus, soll
	icitudin eget massa viverra, feugiat ultrices arcu. Nunc lorem nunc, luctu
	s ut ligula id, gravida hendrerit nibh. Nunc elementum risus sed finibus m
	alesuada. Fusce in vestibulum odio. Vivamus faucibus sem nec lorem pretium
	, eget volutpat justo venenatis. Donec et viverra eros. Class aptent tacit
	i sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. 
	Sed quis lectus lectus.
Phasellus quis gravida nisi. Morbi in egestas ex. In aliquam eu risus vel i
	mperdiet. Morbi mollis erat egestas est condimentum imperdiet. Nulla preti
	um diam sit amet suscipit vehicula. Aliquam fermentum tellus nibh, sit ame
	t tristique metus venenatis ut. Nulla non diam id nisl feugiat gravida lao
	reet in dolor. Mauris sagittis enim ac dolor viverra, at feugiat quam vest
	ibulum.
Pellentesque vulputate magna at ultrices elementum. Curabitur vulputate sap
	ien sed arcu vestibulum aliquam. Vestibulum leo tellus, placerat nec felis
	 sit amet, lacinia pharetra felis. Aenean cursus at mauris ut efficitur. P
	raesent auctor convallis erat, id mattis risus commodo a. Donec orci purus
	, venenatis ut lectus vitae, posuere molestie ex. Suspendisse vitae ante a
	c neque aliquam ultrices. Sed vel metus et dolor lacinia mollis.
Integer felis nulla, efficitur ac enim a, tempus placerat elit. Etiam phare
	tra magna ut risus viverra faucibus. Fusce gravida quis arcu porttitor con
	dimentum. Nullam porta rutrum nibh, mollis convallis odio commodo vitae. P
	hasellus nec risus facilisis, fermentum lorem nec, aliquet arcu. Curabitur
	 laoreet at dolor id pretium. Proin interdum nec leo ac finibus. Nam ut eu
	ismod magna. Nam pulvinar tempus pellentesque.
@khalwat khalwat added the bug Something isn't working label Sep 8, 2021
@khalwat
Copy link
Contributor Author

khalwat commented Sep 8, 2021

@jayhlee Addressed in: c504f07

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-icalendar": "dev-develop as 1.1.2”,

Then do a composer clear-cache && composer update

@jayhlee
Copy link

jayhlee commented Sep 9, 2021

All paragraphs now displays. However, every paragraph after the first paragraph doesn't format properly with the line breaks.

The code on the left window is the outputted ICS file. This output doesn't take into account the paragraph line breaks.

The code on the right window is the expected ICS file (insofar as iCal is concerned) that creates a visual paragraph break (it adds \n\n to do so).

actual-expected

@khalwat
Copy link
Contributor Author

khalwat commented Oct 4, 2021

@jayhlee I may not be timely, but I'm determined. I'm going to get this sorted.

@khalwat
Copy link
Contributor Author

khalwat commented Oct 4, 2021

Okay so I figured out the problem... the algorithm in the plugin is correct. But it doesn't expect that text is going to be passed via this Twig code:

    {% filter rfc2445 %}
        BEGIN:VCALENDAR
        PRODID:{{ entry.title }}
        CALSCALE:GREGORIAN
        VERSION:2.0
        METHOD:PUBLISH
        TRANSP:TRANSPARENT
        X-WR-CALNAME:{{ entry.title }}
        X-WR-TIMEZONE:America/New_York
        BEGIN:VEVENT
        UID:1119
        DTSTAMP:{{ entry.dateCreated.getTimestamp() | date("Ymd", "UTC") }}T{{ entry.dateCreated.getTimestamp() | date("Gi", "UTC") }}00Z
        DTSTART:{{ entry.dateCreated.getTimestamp() | date("Ymd", "UTC") }}T{{ entry.dateCreated.getTimestamp() | date("Gi", "UTC") }}00Z
        DTEND:{{ entry.dateUpdated.getTimestamp() | date("Ymd", "UTC") }}T{{ entry.dateUpdated.getTimestamp() | date("Gi", "UTC") }}00Z
        LOCATION:On Campus Camden, SC
        SUMMARY:OPEN HOUSE (ON CAMPUS) FOR PROSPECTIVE FAMILIES/CADETS
        DESCRIPTION: {{ entry.richText }}
        URL:{{ entry.url }}
        END:VEVENT
        END:VCALENDAR
    {% endfilter %}

When separated into lines based on line breaks, the text looks like this:

[
    0 => '        BEGIN:VCALENDAR'
    1 => '        PRODID:Calendar'
    2 => '        CALSCALE:GREGORIAN'
    3 => '        VERSION:2.0'
    4 => '        METHOD:PUBLISH'
    5 => '        TRANSP:TRANSPARENT'
    6 => '        X-WR-CALNAME:Calendar'
    7 => '        X-WR-TIMEZONE:America/New_York'
    8 => '        BEGIN:VEVENT'
    9 => '        UID:1119'
    10 => '        DTSTAMP:20211004T10200Z'
    11 => '        DTSTART:20211004T10200Z'
    12 => '        DTEND:20211004T10700Z'
    13 => '        LOCATION:On Campus Camden, SC'
    14 => '        SUMMARY:OPEN HOUSE (ON CAMPUS) FOR PROSPECTIVE FAMILIES/CADETS'
    15 => '        DESCRIPTION: <p><strong>Lorem ipsum dolor</strong> sit amet, consectetur adipiscing elit. Etiam fermentum massa eu justo efficitur hendrerit. Pellentesque condimentum quam vitae lectus gravida, quis ullamcorper risus rutrum. Sed scelerisque elit dolor, quis sodales augue consectetur ac. Quisque diam nulla, sodales nec iaculis non, ornare faucibus urna. Nunc volutpat dui ac lorem placerat convallis. Donec egestas finibus nunc, id egestas sem tincidunt id. Aliquam bibendum eu dolor id venenatis.</p>'
    16 => '<p>Morbi dapibus <strong>neque id metus</strong> convallis viverra. Aliquam eu gravida arcu. Nam viverra est enim, at pretium diam iaculis dictum. Donec urna metus, sollicitudin eget massa viverra, feugiat ultrices arcu. Nunc lorem nunc, luctus ut ligula id, gravida hendrerit nibh. Nunc elementum risus sed finibus malesuada. Fusce in vestibulum odio. Vivamus faucibus sem nec lorem pretium, eget volutpat justo venenatis. Donec et viverra eros. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed quis lectus lectus.</p>'
    17 => '<p>Phasellus quis gravida nisi. Morbi in egestas ex. In aliquam eu risus vel imperdiet. Morbi mollis erat egestas est condimentum imperdiet. Nulla pretium diam sit amet suscipit vehicula. Aliquam fermentum tellus nibh, sit amet tristique metus venenatis ut. Nulla non diam id nisl feugiat gravida laoreet in dolor. Mauris sagittis enim ac dolor viverra, at feugiat quam vestibulum.</p>'
    18 => '<p>Pellentesque vulputate magna at ultrices elementum. Curabitur vulputate sapien sed arcu vestibulum aliquam. Vestibulum leo tellus, placerat nec felis sit amet, lacinia pharetra felis. Aenean cursus at mauris ut efficitur. Praesent auctor convallis erat, id mattis risus commodo a. Donec orci purus, venenatis ut lectus vitae, posuere molestie ex. Suspendisse vitae ante ac neque aliquam ultrices. Sed vel metus et dolor lacinia mollis.</p>'
    19 => '<p>Integer felis nulla, efficitur ac enim a, tempus placerat elit. Etiam pharetra magna ut risus viverra faucibus. Fusce gravida quis arcu porttitor condimentum. Nullam porta rutrum nibh, mollis convallis odio commodo vitae. Phasellus nec risus facilisis, fermentum lorem nec, aliquet arcu. Curabitur laoreet at dolor id pretium. Proin interdum nec leo ac finibus. Nam ut euismod magna. Nam pulvinar tempus pellentesque.</p>'
    20 => '        URL:http://localhost:8000/calendar'
    21 => '        END:VEVENT'
    22 => '        END:VCALENDAR'
    23 => '    '
]

In the text after the DESCRIPTION has line breaks in it already from the rich text field being output. And there's no real way for it to be able to tell how that should be split.

khalwat added a commit that referenced this issue Oct 6, 2021
…e broken into multiple lines, and then not read by iCal ([#26](#26))

Signed-off-by: Andrew Welch <[email protected]>
@khalwat
Copy link
Contributor Author

khalwat commented Oct 6, 2021

Addressed in: 10a6cf7

You can try it now by setting your semver in your composer.json to look like this:

    "nystudio107/craft-icalendar": "dev-develop as 1.1.2”,

Then do a composer clear-cache && composer update

@khalwat
Copy link
Contributor Author

khalwat commented Oct 7, 2021

@jayhlee I was able to test it with a nice big multi-line description and it worked well in iCal:

BEGIN:VCALENDAR
PRODID:Calendar
CALSCALE:GREGORIAN
VERSION:2.0
METHOD:PUBLISH
TRANSP:TRANSPARENT
X-WR-CALNAME:Calendar
X-WR-TIMEZONE:America/New_York
BEGIN:VEVENT
UID:1119
DTSTAMP:20211004T010227Z
DTSTART:20211004T010227Z
DTEND:20211004T010750Z
LOCATION:On Campus Camden, SC
SUMMARY:OPEN HOUSE (ON CAMPUS) FOR PROSPECTIVE FAMILIES/CADETS
DESCRIPTION: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
	 fermentum massa eu justo efficitur hendrerit. Pellentesque condimentum qu
	am vitae lectus gravida, quis ullamcorper risus rutrum. Sed scelerisque el
	it dolor, quis sodales augue consectetur ac. Quisque diam nulla, sodales n
	ec iaculis non, ornare faucibus urna. Nunc volutpat dui ac lorem placerat 
	convallis. Donec egestas finibus nunc, id egestas sem tincidunt id. Aliqua
	m bibendum eu dolor id venenatis.\n\n Morbi dapibus neque id metus convall
	is viverra. Aliquam eu gravida arcu. Nam viverra est enim, at pretium diam
	 iaculis dictum. Donec urna metus, sollicitudin eget massa viverra, feugia
	t ultrices arcu. Nunc lorem nunc, luctus ut ligula id, gravida hendrerit n
	ibh. Nunc elementum risus sed finibus malesuada. Fusce in vestibulum odio.
	 Vivamus faucibus sem nec lorem pretium, eget volutpat justo venenatis. Do
	nec et viverra eros. Class aptent taciti sociosqu ad litora torquent per c
	onubia nostra, per inceptos himenaeos. Sed quis lectus lectus.\n\n Phasell
	us quis gravida nisi. Morbi in egestas ex. In aliquam eu risus vel imperdi
	et. Morbi mollis erat egestas est condimentum imperdiet. Nulla pretium dia
	m sit amet suscipit vehicula. Aliquam fermentum tellus nibh, sit amet tris
	tique metus venenatis ut. Nulla non diam id nisl feugiat gravida laoreet i
	n dolor. Mauris sagittis enim ac dolor viverra, at feugiat quam vestibulum
	.\n\n Pellentesque vulputate magna at ultrices elementum. Curabitur vulput
	ate sapien sed arcu vestibulum aliquam. Vestibulum leo tellus, placerat ne
	c felis sit amet, lacinia pharetra felis. Aenean cursus at mauris ut effic
	itur. Praesent auctor convallis erat, id mattis risus commodo a. Donec orc
	i purus, venenatis ut lectus vitae, posuere molestie ex. Suspendisse vitae
	 ante ac neque aliquam ultrices. Sed vel metus et dolor lacinia mollis.\n\
	n Integer felis nulla, efficitur ac enim a, tempus placerat elit. Etiam ph
	aretra magna ut risus viverra faucibus. Fusce gravida quis arcu porttitor 
	condimentum. Nullam porta rutrum nibh, mollis convallis odio commodo vitae
	. Phasellus nec risus facilisis, fermentum lorem nec, aliquet arcu. Curabi
	tur laoreet at dolor id pretium. Proin interdum nec leo ac finibus. Nam ut
	 euismod magna. Nam pulvinar tempus pellentesque.\n\n URL:http://localhost
	:8000/calendar
END:VEVENT
END:VCALENDAR

...passed the validator too: https://icalendar.org/validator.html

Would love it if you're able to confirm, too!

@khalwat
Copy link
Contributor Author

khalwat commented Oct 10, 2021

@khalwat khalwat closed this as completed Oct 10, 2021
@jayhlee
Copy link

jayhlee commented Oct 11, 2021

Sorry for the late reply. Took last week and just got back in the saddle.

Yes, I can confirm that it works! Awesome job! Really appreciate your tenacity in figuring this out!

@khalwat
Copy link
Contributor Author

khalwat commented Oct 11, 2021

Thx for confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants