Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 UTC on 18 March 2024, to get $100 off your ticket.
testcase html:
<a href="http://drupal.org/" title="the official website">Drupal</a> is an open source content management platform.
result:
Drupal
is an open source content management platform.
expected result:
Drupal [1] is an open source content management platform.
[1] http://drupal.org/
problem:
$pattern = '@(<a[^>]+?href="([^"]*)">(.+?)</a>)@i';
fix:
$pattern = '@(<a[^>]+?href="([^"]*)"[^>]*?>(.+?)</a>)@i';
and attached.
if i see this right, drupal_html_to_text() also fails for utf8 with non ascii characters. but thats another issue.
Comment | File | Size | Author |
---|---|---|---|
drupal_html_to_text.patch | 844 bytes | ax | |
Comments
Comment #1
Gábor HojtsyThat is pretty straightforward and trivial. Committed. Thanks.
Comment #2
(not verified) CreditAttribution: commented