#NEWLINE# def run( self , parent , blocks ) : #NEWLINE# #INDENT# block = blocks . pop ( 0 ) #NEWLINE# open_match = self . PATTERN . search ( block ) #NEWLINE# tag = open_match . group ( 1 ) #NEWLINE# self . parser . parseBlocks ( parent , [ block [ : open_match . start ( ) ] ] ) #NEWLINE# content = [ block [ open_match . end ( ) : ] ] #NEWLINE# close_pattern = re . compile ( ( '\\[/%s\\]' % tag ) ) #NEWLINE# while True : #NEWLINE# #INDENT# close_match = close_pattern . search ( content [ ( - 1 ) ] ) #NEWLINE# if close_match : #NEWLINE# #INDENT# last_block = content . pop ( ( - 1 ) ) #NEWLINE# content . append ( last_block [ : close_match . start ( ) ] ) #NEWLINE# self . parser . parseBlocks ( self . _create_alert ( parent , tag ) , content ) #NEWLINE# blocks . insert ( 0 , last_block [ close_match . end ( ) : ] ) #NEWLINE# break #NEWLINE# #UNINDENT# if ( not len ( blocks ) ) : #NEWLINE# #INDENT# content . append ( ( '[/%s]' % tag ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# content . append ( blocks . pop ( 0 ) )