Ticket #16066: ampersands.diff

File ampersands.diff, 643 bytes (added by Jerry, 8 years ago)

Change unencoded_ampersands_re to encode &n; as &n; for D&D, R&D, etc.

  • django/utils/html.py

     
    1515# List of possible strings used for bullets in bulleted lists.
    1616DOTS = [u'·', u'*', u'\u2022', u'•', u'•', u'•']
    1717
    18 unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)')
     18unencoded_ampersands_re = re.compile(r'&(?!(\w{2,}|#\d+);)')
    1919word_split_re = re.compile(r'(\s+)')
    2020punctuation_re = re.compile('^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$' % \
    2121    ('|'.join([re.escape(x) for x in LEADING_PUNCTUATION]),
Back to Top