  def linenumbers(value):
      "Displays text with line numbers"
      from django.utils.html import escape
      lines = value.split(u'\n')
      # Find the maximum width of the line count, for use with zero padding string format command
      width = unicode(len(unicode(len(lines))))
      for i, line in enumerate(lines):
          lines[i] = (u"%0" + width  + u"d. %s") % (i + 1, escape(line))
      return u'\n'.join(lines)
  linenumbers = stringfilter(linenumbers)
 
</s> remove     "Displays text with line numbers"
 </s> add     """Displays text with line numbers.""" </s> remove     "Escapes an IRI value for use in a URL"
 </s> add     """Escapes an IRI value for use in a URL.""" </s> remove     "Replaces ampersands with ``&amp;`` entities"
 </s> add     """Replaces ampersands with ``&amp;`` entities.""" </s> remove     Wraps words at specified line length
 </s> add     Wraps words at specified line length. </s> remove     "Capitalizes the first character of the value"
 </s> add     """Capitalizes the first character of the value."""
    # Find the maximum width of the line count, for use with zero padding
    # string format command.
  def linenumbers(value):
      "Displays text with line numbers"
      from django.utils.html import escape
      lines = value.split(u'\n')
    # Find the maximum width of the line count, for use with zero padding
    # string format command.
      width = unicode(len(unicode(len(lines))))
      for i, line in enumerate(lines):
          lines[i] = (u"%0" + width  + u"d. %s") % (i + 1, escape(line))
      return u'\n'.join(lines)
  linenumbers = stringfilter(linenumbers)
keep keep keep keep replace keep keep keep keep keep
 Style and import fixes.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6641 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/template/defaultfilters.py