Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
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?
Comments
Comment #1
pillarsdotnet commentedNew patch #299138-155: Improve \Drupal\Core\Utility\Mail::htmlToText()
Comment #2
pillarsdotnet commentedApplied #299138-157: Improve \Drupal\Core\Utility\Mail::htmlToText() to:
Comment #3
pillarsdotnet commentedApplied #299138-167: Improve \Drupal\Core\Utility\Mail::htmlToText() to:
Comment #4
pillarsdotnet commentedLatest is #299138-190: Improve \Drupal\Core\Utility\Mail::htmlToText()
Applied to:
Comment #5
pillarsdotnet commentedLatest is #299138-198: Improve \Drupal\Core\Utility\Mail::htmlToText()
Comment #6
pillarsdotnet commentedFull 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.
Comment #7
pillarsdotnet commentedMinor line-wrapping improvements: #299138-232: Improve \Drupal\Core\Utility\Mail::htmlToText()
Comment #8
Jorrit commentedThe 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?
Comment #9
pillarsdotnet commented@#8 -- Thanks. I'll check.
Comment #10
pillarsdotnet commentedThanks 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.
Comment #11
pillarsdotnet commented#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.
Comment #12
Jose Chaves commentedFatal error: Call to undefined function _drupal_html_to_text() in /home/edicoesv/public_html/sites/all/modules/mailsystem/html_to_text.inc on line 559
Comment #13
pillarsdotnet commentedThanks; fixed.