#NEWLINE# def match_tag_start( self ) : #NEWLINE# #INDENT# match = self . match ( '\n            \\<%     # opening tag\n\n            ([\\w\\.\\:]+)   # keyword\n\n            ((?:\\s+\\w+|\\s*=\\s*|".*?"|\'.*?\')*)  # attrname, = \\\n                                               #        sign, string expression\n\n            \\s*     # more whitespace\n\n            (/)?>   # closing\n\n            ' , ( ( re . I | re . S ) | re . X ) ) #NEWLINE# if match : #NEWLINE# #INDENT# ( keyword , attr , isend ) = match . groups ( ) #NEWLINE# self . keyword = keyword #NEWLINE# attributes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if attr : #NEWLINE# #INDENT# for att in re . findall ( '\\s*(\\w+)\\s*=\\s*(?:\'([^\']*)\'|\\"([^\\"]*)\\")' , attr ) : #NEWLINE# #INDENT# ( key , val1 , val2 ) = att #NEWLINE# text = ( val1 or val2 ) #NEWLINE# text = text . replace ( '\r\n' , '\n' ) #NEWLINE# attributes [ key ] = text #NEWLINE# #UNINDENT# #UNINDENT# self . append_node ( parsetree . Tag , keyword , attributes ) #NEWLINE# if isend : #NEWLINE# #INDENT# self . tag . pop ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( keyword == 'text' ) : #NEWLINE# #INDENT# match = self . match ( '(.*?)(?=\\</%text>)' , re . S ) #NEWLINE# if ( not match ) : #NEWLINE# #INDENT# raise exceptions . SyntaxException ( ( 'Unclosed tag: <%%%s>' % self . tag [ ( - 1 ) ] . keyword ) , ** match . exception_kwargs ) #NEWLINE# #UNINDENT# self . append_node ( parsetree . Text , match . group ( 1 ) ) #NEWLINE# return self . match_tag_end ( ) #NEWLINE# #UNINDENT# #UNINDENT# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return False