#NEWLINE# def collect_images( post ) : #NEWLINE# #INDENT# 'collect the images (if any) that are in an <img> tag\n    in the rendered post' #NEWLINE# if ( ( type ( post ) == Post ) and post . attachments ) : #NEWLINE# #INDENT# for photo in post . attachments : #NEWLINE# #INDENT# ( yield photo . url ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( type ( src ) == Post ) : #NEWLINE# #INDENT# html = util . markdown_filter ( post . content , img_path = post . get_image_path ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# html = post . content #NEWLINE# #UNINDENT# if html : #NEWLINE# #INDENT# soup = BeautifulSoup ( html ) #NEWLINE# for img in soup . find_all ( 'img' ) : #NEWLINE# #INDENT# if ( not img . find_parent ( class_ = 'h-card' ) ) : #NEWLINE# #INDENT# src = img . get ( 'src' ) #NEWLINE# if src : #NEWLINE# #INDENT# ( yield urljoin ( get_settings ( ) . site_url , src ) )