Description

In django/utils/html.py, unencoded_ampersands_re will not convert ampersands if they are followed by at least one alphabetical character and a semicolon. There are no named entities with only a single character, but abbreviations of that form are common in some circles: D&D and R&D for example.

Each issue has adventures designed for early D&D; there’s the beginnings of a megadungeon in issue 2, “The Darkness Beneath”, and a lot of weirdness.

If it isn't safe to assume that there will not be one-character entities, a note in the documentation (​http://docs.djangoproject.com/en/dev/ref/templates/builtins/) will probably be useful. (It may be useful even if this patch does make sense, in case someone tries to use longer abbreviations, such as F&SF or AT&SF and follow them by a semi-colon.

fix_ampersands does have some limitations in that it is not smart enough to distinguish real named entities from non-real ones. But only making it work with one-character words would really just be equivalent to fixing one particular symptom without addressing the core limitations. In this case, what you want to use is in fact django.utils.html.escape.