def set_image_paths(app, encoded_repository_id, text):
 if text:
  if repository_util.is_tool_shed_client(app):
   route_to_images = ('admin_toolshed/static/images/%s' % encoded_repository_id)
  else:
   route_to_images = ('/repository/static/images/%s' % encoded_repository_id)
  text = text.replace('$PATH_TO_IMAGES', '')
  text = text.replace('${static_path}', '')
  for match in re.findall('.. image:: (?!http)/?(.+)', text):
   text = text.replace(match, match.replace('/', '%2F'))
  text = re.sub('\\.\\. image:: (?!https?://)/?(.+)', ('.. image:: %s/\\1' % route_to_images), text)
 return text

def set_image_paths ( app , encoded_repository_id , text ) : if text : if repository_util . is_tool_shed_client ( app ) : route_to_images = ( 'admin_toolshed/static/images/%s' % encoded_repository_id ) else : route_to_images = ( '/repository/static/images/%s' % encoded_repository_id ) text = text . replace ( '$PATH_TO_IMAGES' , '' ) text = text . replace ( '${static_path}' , '' ) for match in re . findall ( '.. image:: (?!http)/?(.+)' , text ) : text = text . replace ( match , match . replace ( '/' , '%2F' ) ) text = re . sub ( '\\.\\. image:: (?!https?://)/?(.+)' , ( '.. image:: %s/\\1' % route_to_images ) , text ) return text
handle tool help image display for tools that are contained in repositories in the tool shed or installed into galaxy as well as image display in repository readme files .