#NEWLINE# def doctree_resolved( app , doctree , docname ) : #NEWLINE# #INDENT# i = 1 #NEWLINE# figids = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for figure_info in doctree . traverse ( figure ) : #NEWLINE# #INDENT# if ( ( app . builder . name != 'latex' ) and app . config . number_figures ) : #NEWLINE# #INDENT# for cap in figure_info . traverse ( caption ) : #NEWLINE# #INDENT# cap [ 0 ] = Text ( ( '%s %d: %s' % ( app . config . figure_caption_prefix , i , cap [ 0 ] ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# for id in figure_info [ 'ids' ] : #NEWLINE# #INDENT# figids [ id ] = html #NEWLINE# #UNINDENT# i += 1 #NEWLINE# #UNINDENT# if ( app . builder . name != 'latex' ) : #NEWLINE# #INDENT# for ref_info in doctree . traverse ( num_ref ) : #NEWLINE# #INDENT# if ( '#' in ref_info [ 'reftarget' ] ) : #NEWLINE# #INDENT# ( label , target ) = ref_info [ 'reftarget' ] . split ( '#' ) #NEWLINE# labelfmt = ( label + ' %d' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# labelfmt = '%d' #NEWLINE# target = ref_info [ 'reftarget' ] #NEWLINE# #UNINDENT# if ( target not in figids ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( app . builder . name == 'html' ) : #NEWLINE# #INDENT# target_doc = app . builder . env . figid_docname_map [ target ] #NEWLINE# link = ( '%s#%s' % ( app . builder . get_relative_uri ( docname , target_doc ) , target ) ) #NEWLINE# html = ( '<a class="pageref" href="%s">%s</a>' % ( link , ( labelfmt % figids [ target ] ) ) ) #NEWLINE# ref_info . replace_self ( raw ( html , html , format = 'html' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ref_info . replace_self ( Text ( ( labelfmt % figids [ target ] ) ) )