Note to self: track changes in #299138

#8 html-to-text-loop.txt4.43 KBJorrit


pillarsdotnet’s picture

pillarsdotnet’s picture

Full table support added: #299138-230: Improve \Drupal\Core\Utility\Mail::htmlToText()

I can attest that this version does a better job of presenting complex layout than Mozilla Thunderbird in "View message as plain text" mode.

Applied to Mail System
6.x-2.22 release
7.x-2.22 release
8.x-2.22 release
pillarsdotnet’s picture

Jorrit’s picture

new4.43 KB

The latest version is not working well with nested tables. The do { } while($width > 2) loop is taking a lot of time, more than 30 seconds on my server. I have removed all unnecessary parts from the HTML code such that the problem occurs. I have tried to find the problem, but the code is too vague for me.

Maybe I should put this report in #299138, but I see that there are some fixes made to table conversion after June 4th, 2011. Maybe you can check if the attached file parses properly for the new version?

pillarsdotnet’s picture

Status:Active» Needs work

@#8 -- Thanks. I'll check.

pillarsdotnet’s picture

Thanks very much for the test case; I've added it to the tests for the new version.

I've replaced the linear search with a binary search, and your test case helped me find a few bugs in nested table parsing.

pillarsdotnet’s picture

#299138-246: Improve \Drupal\Core\Utility\Mail::htmlToText()
Improved table generation accuracy and performance.
Added test for correctly formed deeply-nested tables.
Test also asserts that table generation takes less than one second.

Applied to Mail System
Jose Chaves’s picture

Fatal error: Call to undefined function _drupal_html_to_text() in /home/edicoesv/public_html/sites/all/modules/mailsystem/ on line 559

pillarsdotnet’s picture

Thanks; fixed.

Applied to Mail system