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

WIP: Line wrapping for text/plain content #135

Closed
wants to merge 5 commits into from

Conversation

requaos
Copy link
Collaborator

@requaos requaos commented Sep 6, 2019

Implementing text wrapping for text/html is a bit more involved, such that we don't break mid-tag. We should create an issue to track wrapping html content for the future.

closes #63

@coveralls
Copy link

coveralls commented Sep 6, 2019

Coverage Status

Coverage decreased (-0.2%) to 87.701% when pulling 826f9c5 on requaos:requaos/linewrap into 51ed44e on jhillyerd:develop.

@requaos requaos changed the title Closes #63 Line wrapping for text/plain content Sep 6, 2019
@requaos
Copy link
Collaborator Author

requaos commented Sep 6, 2019

At present this just uses the same wrapping implementation as the base64 content. @jhillyerd from my reading this won't matter, but let em know if you would prefer to see this not wrap mid-word.

Still work to do writing more tests for increased coverage instead of decreasing... Please do not merge yet (I forgot to create this as a draft PR)

@requaos requaos changed the title Line wrapping for text/plain content WIP: Line wrapping for text/plain content Sep 6, 2019
@jhillyerd
Copy link
Owner

Thinking about this a bit... the only reason to force a wrap before 76-80 characters is to improve the readability of the text in a plain text email program, or when viewing the source - if we split the line in the middle of the word, we aren't improving the readability.

It may be better to pick an wider (but <= 998) number so that if the email is wrapped at something slightly higher than 76, we allow it to pass through, otherwise we hard wrap to remain compliant with the spec.

There is some interesting reading in rfc3676 4.2, but I don't know much about format=flowed.

@requaos
Copy link
Collaborator Author

requaos commented Sep 7, 2019

I will follow the technique described in paragraph six of rfc3676 4.2, the "newer" one. I feel there is enough feature description in the following sections to implement format-(fixed/flowed), delsp-(yes/no), space-stuffing, quoting and even take the Usenet signature separator into consideration.

requaos added a commit to requaos/enmime that referenced this pull request Oct 15, 2019
@requaos
Copy link
Collaborator Author

requaos commented Nov 25, 2019

Looks like there is a reasonable implementation, for decoding, flowed text in k9mail. Porting that shouldn't take too long, but creating an encoder for it will take longer.

https://github.com/jp-perez12/k-9-mail/blob/master/app/core/src/main/java/com/fsck/k9/mailstore/util/FlowedMessageUtils.java

@requaos
Copy link
Collaborator Author

requaos commented Nov 26, 2019

Looks like html is out of scope for this:

Format=flowed applies solely to plain-text messages. HTML messages already have something functionally equivalent to f=f: the <BLOCKQUOTE> element, which does what it says: It quotes blocks of text. When f=f mailers that also can handle HTML encounter <BLOCKQUOTE> text, it’s usually marked up with the same excerpt bars we’re familiar with from f=f. Format=flowed isn’t actually at work there, but since <BLOCKQUOTE> text flows nicely when you resize a window, the effect is the same.

@requaos
Copy link
Collaborator Author

requaos commented Nov 26, 2019

@jhillyerd I ported the feature verbatim and wrote one test around the only example in the rfc. I need to find a preferred implementation, like either pine or mutt, where I can generate some testdata samples programmatically.

@jhillyerd jhillyerd closed this May 26, 2020
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

Successfully merging this pull request may close these issues.

4 participants