#NEWLINE# def _parse( self , is_source , lang_rules ) : #NEWLINE# #INDENT# par_splitter = '\n\n' #NEWLINE# template_open = '{{' #NEWLINE# template_ends = '}}' #NEWLINE# template = self . content #NEWLINE# context = '' #NEWLINE# prev_split_pos = 0 #NEWLINE# prev_text_pos = 0 #NEWLINE# while 1 : #NEWLINE# #INDENT# par_pos = self . content . find ( par_splitter , prev_split_pos ) #NEWLINE# t_open_pos = self . content . find ( template_open , prev_split_pos ) #NEWLINE# if ( prev_text_pos == ( - 1 ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( par_pos == ( - 1 ) ) and ( t_open_pos == ( - 1 ) ) ) : #NEWLINE# #INDENT# source = trans = self . content [ prev_text_pos : ] . strip ( ) #NEWLINE# prev_text_pos = ( - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( par_pos < t_open_pos ) or ( t_open_pos == ( - 1 ) ) ) : #NEWLINE# #INDENT# source = trans = self . content [ prev_text_pos : par_pos ] . strip ( ) #NEWLINE# prev_split_pos = prev_text_pos = ( par_pos + 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# t_end_pos = self . content . find ( template_ends , ( prev_split_pos + 1 ) ) #NEWLINE# prev_split_pos = t_end_pos #NEWLINE# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not source . strip ( '\n' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# source_len = len ( source ) #NEWLINE# template = re . sub ( re . escape ( trans ) , ( '%(hash)s_tr' % { #NEWLINE# #INDENT# 'hash' : hash_tag ( source , context ) , #NEWLINE# #UNINDENT# } ) , template ) #NEWLINE# self . stringset . strings . append ( GenericTranslation ( source , trans , context = context ) ) #NEWLINE# #UNINDENT# return template