Opened 16 years ago
Closed 13 years ago
#10931 closed Bug (fixed)
truncate_html_words doen't handle multi-line tags properly
Reported by: | George Song | Owned by: | Julien Phalip |
---|---|---|---|
Component: | Template system | Version: | dev |
Severity: | Normal | Keywords: | truncatewords_html |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you have the following in your HTML, for example:
<a class="offsite" href= "http://blah.com/something/">
truncate_html_words
will include all the words in the tag, as well as not close the tag properly if it needs to.
The attached patch simply adds the re.S
flag for the two regular expressions used in the function.
Attachments (3)
Change History (11)
by , 16 years ago
Attachment: | utils_text-r10637.patch added |
---|
comment:1 by , 16 years ago
Needs tests: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 16 years ago
Needs tests: | unset |
---|
I've updated the patch with tests that are pretty comprehensive.
comment:4 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:5 by , 14 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → Accepted |
Thanks so much for this. However, the tests for this should be unit tests, as we are moving away from doctests, especially for this type of thing, and especially as there are already unit tests for truncate_html_words in tests/regressiontests/utils/tests.py. Just add to the ones there already.
Thanks.
comment:6 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → Bug |
comment:7 by , 13 years ago
Easy pickings: | unset |
---|---|
Owner: | removed |
Patch needs improvement: | unset |
Status: | assigned → new |
UI/UX: | unset |
I only included the test that specifically addresses the new line issue.
Handle mutli-line tags