Issue #190: Fix long links displaying correctly in invite.ics #191
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description: The issue described in #190 has been resolved by switching to a combination of
rtrim
andchunk_split
.Problem
When we create the
.ics
file, we need to conform to the RFC (outlined here).To do this, we use the
wordwrap
function. This function wraps at word boundaries (in this case, since we set the argument$cut_long_words
to true , it only does this for words less than the limit) and removes any trailing and/or leading whitespace. For example:Note
See that the
wordwrap
function doesn't wrap at exactly 20 characters, and that trailing/leading spaces at the boundary are removed.This is problematic when we view this text in a calendar client.
This causes issues when we render this text. Even though the RFC requires each line in the description to be no more than 75 octets/characters, the container holding such text is not limited by this - i.e it is responsive. In Google Calendar, the container is ~500 pixels, displaying ~55 characters.
This meant that the above output when rendered could look like so:
//verylongwordingashorter word here
This is the same problem as described in Issue #183. That was resolved in #184 by adding a space prior to the new line. But this breaks long links/words, for example:
Prior to PR #184: https://giithub.com/catalyst/moodle-mod_facetoface/pull/191
After PR #184: https://giithub.com/cat alyst/moodle-mod_facet oface/pull/191
Solution
Use a combination of
rtrim
andchunk_split
instead ofwordwrap
. This is adapted from this Stackoverflow answer about the same issue.The
chunk_split
function wraps at the exact length specified and keeps whitespace.This still follows the RFC outlined here.
Testing Instructions
invite.ics
file