#NEWLINE# def __iter__( self ) : #NEWLINE# #INDENT# preserve = 0 #NEWLINE# for token in _base . Filter . __iter__ ( self ) : #NEWLINE# #INDENT# type = token [ 'type' ] #NEWLINE# if ( ( type == 'StartTag' ) and ( preserve or ( token [ 'name' ] in self . spacePreserveElements ) ) ) : #NEWLINE# #INDENT# preserve += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( type == 'EndTag' ) and preserve ) : #NEWLINE# #INDENT# preserve -= 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not preserve ) and ( type == 'SpaceCharacters' ) and token [ 'data' ] ) : #NEWLINE# #INDENT# token [ 'data' ] = ' ' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( not preserve ) and ( type == 'Characters' ) ) : #NEWLINE# #INDENT# token [ 'data' ] = collapse_spaces ( token [ 'data' ] ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# ( yield token )