#NEWLINE# def adjust( self , idx , orig_len , new_len ) : #NEWLINE# #INDENT# '\n        When interpolating template variables, update region ranges for previously-evaluated\n        variables, that are situated later on in the output/template string.\n        ' #NEWLINE# shift = ( new_len - orig_len ) #NEWLINE# for ( key , region ) in self . regions . items ( ) : #NEWLINE# #INDENT# if ( region [ 0 ] > idx ) : #NEWLINE# #INDENT# region [ 0 ] += shift #NEWLINE# region [ 1 ] += shift #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( region [ 1 ] > idx ) or ( orig_len [ 0 ] == idx ) ) : #NEWLINE# #INDENT# region [ 1 ] += shift