#25401: django.utils.html.strip_tags can insert spurious semicolons
-----------------------------+------------------------------------
Reporter: jbaldivieso | Owner: nobody
Type: Bug | Status: closed
Component: Utilities | Version: 1.8
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by bak1an):
Indeed, failing example is not a valid html piece so there is not much
sense in trying to guarantee some sort of valid behaviour with cases like
this.
The results are coming directly python's HTMLParser. In this particular
case it recognizes '&first' to be the character reference. In the first
case ({{{"&first_name"}}}) it processes the entire string as plain text
data without trying to parse it because there are no tags at all.
I'm closing this ticket as invalid since after a closer review it does not
look like something that should be addressed within Django.
jbaldivieso, you can try using {{{bleach}}} library
(http://bleach.readthedocs.org/en/latest/), using its {{{clean}}} and
{{{linkify}}} functions combination it might be possible to resolve your
markdown processing issues.
You can also (on your own risk) try to hack django's
{{{MLStripper.handle_entityref}}}
(https://github.com/django/django/blob/master/django/utils/html.py#L135).
Of course you can reopen this in case you have use cases where django's
{{{strip_tags}}} misbehaves with valid html data.
--
Ticket URL: <https://code.djangoproject.com/ticket/25401#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.909168030d0d033e1476cb4ec4c8dc25%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.