mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #4658 -- Improved documentation of linebreaks and linebreaksbr. Thanks, ubernostrum and Gary Wilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -254,13 +254,20 @@ def escape(value): | ||||
| escape = stringfilter(escape) | ||||
|  | ||||
| def linebreaks(value): | ||||
|     "Converts newlines into <p> and <br />s" | ||||
|     """ | ||||
|     Replaces line breaks in plain text with appropriate HTML; a single | ||||
|     newline becomes an HTML line break (``<br />``) and a new line | ||||
|     followed by a blank line becomes a paragraph break (``</p>``). | ||||
|     """ | ||||
|     from django.utils.html import linebreaks | ||||
|     return linebreaks(value) | ||||
| linebreaks = stringfilter(linebreaks) | ||||
|  | ||||
| def linebreaksbr(value): | ||||
|     "Converts newlines into <br />s" | ||||
|     """ | ||||
|     Converts all newlines in a piece of plain text to HTML line breaks | ||||
|     (``<br />``). | ||||
|     """ | ||||
|     return value.replace('\n', '<br />') | ||||
| linebreaksbr = stringfilter(linebreaksbr) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user