Follow-up to #2509218: Ensure that SafeString objects can be used in non-HTML contexts
Problem/Motivation
The parent issue transforms HTML into plain text, but does so merely by stripping tags and decoding entities. For transformation of longer HTML text, we may want to provide a separate output strategy.
Proposed resolution
Provide a PlainTextFormatted output strategy that will be used in email, non-HTML files and possibly in CLI output (i.e. exceptions). We already have a MailFormatHelper, so likely we can just move its code into the output strategy class and deprecate MailFormatHelper.
Remaining tasks
User interface changes
N/A
API changes
Addition of a new output strategy
Comments
Comment #2
plachComment #3
wim leersTransplanting my comment at #2509218-165: Ensure that SafeString objects can be used in non-HTML contexts to here:
Comment #4
jhedstromSince this format could potentially be used on CLI or other non-mail uses,
PlainTextMailOutputmight need to be differently named.Comment #5
wim leers#4:
It's specifically designed for e-mail, it does more than just the
<em>->*mapping.Comment #6
plachI don't think this is about mail only: it's about making available a generic logic to a wider audience. If I had to choose between
PlainTextMailOutputandPlainTextFormattedOutput, I'd go with the latter.MarkedPlainTextOutputwould work for me too.Comment #7
StuartJNCC commentedHow about
RFC3676PlainTextOutputwhich then describes what it is not what it is intended to be used for?Comment #8
wim leers@StuartJNCC I considered that too, but 1) it's hard to read, 2) our naming rules would require it to be written as
Rfc3676PlainTextOutput, which is even harder to read.Comment #9
stefan.r commentedDiscussed this with @dawehner, @plach, @jhedstrom, @Wim Leers and we can probably keep the 77-character RFC-specific logic in the mail helper and take out the HTML to text functionality into a PlainTextFormatted output strategy that can be used for mail, CLI etc.
As a followup to a critical this might be major, maybe normal, maybe won't fix - but it's not blocking any of the other issues, merely a DX improvement.
Leaving this at postponed because @alexpott wanted to do some work on something related.
Comment #15
joelpittetRelated issues have been committed for a while.
Comment #27
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!