(value)
return '\n'.join(lines)
Template filter to collapse successive blank lines into a single one.
Template filter to collapse successive blank lines into a single one.
Template filter to collapse successive blank lines into a single one .
def collapse_blanklines(value):  # pylint: disable=g-bad-name
  """Template filter to collapse successive blank lines into a single one."""
  lines = []
  previous_blank = False
  for line in value.split('\n'):
    if not line.strip():
      if not previous_blank:
        lines.append(line)
        previous_blank = True
      else:
        pass
    else:
      lines.append(line)
      previous_blank = False
  return '\n'.join(lines)
def collapse_blanklines ( value ) : # pylint: disable=g-bad-name lines = [ ] previous_blank = False for line in value . split ( '\n' ) : if not line . strip ( ) : if not previous_blank : lines . append ( line ) previous_blank = True else : pass else : lines . append ( line ) previous_blank = False return '\n' . join ( lines )