def link_source_files(generator):
 posts = [getattr(generator, attr, None) for attr in PROCESS if (getattr(generator, attr, None) is not None)]
 for post in posts[0]:
  if ((not ('SHOW_SOURCE_ON_SIDEBAR' in generator.settings)) and (not ('SHOW_SOURCE_IN_SECTION' in generator.settings))):
   return
  if (('SHOW_SOURCE_ALL_POSTS' in generator.settings) or ('show_source' in post.metadata)):
   show_source_filename = generator.settings.get('SHOW_SOURCE_FILENAME', '{}.txt'.format(post.slug))
   try:
    source_out = os.path.join(post.settings['OUTPUT_PATH'], post.save_as)
    source_out_path = os.path.split(source_out)[0]
    copy_to = os.path.join(source_out_path, show_source_filename)
    source_url = urljoin(post.save_as, show_source_filename)
   except Exception:
    return
   out = dict()
   out['copy_raw_from'] = post.source_path
   out['copy_raw_to'] = copy_to
   logger.debug('Linked %s to %s', post.source_path, copy_to)
   source_files.append(out)
   post.show_source_url = source_url

def link_source_files ( generator ) : posts = [ getattr ( generator , attr , None ) for attr in PROCESS if ( getattr ( generator , attr , None ) is not None ) ] for post in posts [ 0 ] : if ( ( not ( 'SHOW_SOURCE_ON_SIDEBAR' in generator . settings ) ) and ( not ( 'SHOW_SOURCE_IN_SECTION' in generator . settings ) ) ) : return if ( ( 'SHOW_SOURCE_ALL_POSTS' in generator . settings ) or ( 'show_source' in post . metadata ) ) : show_source_filename = generator . settings . get ( 'SHOW_SOURCE_FILENAME' , '{}.txt' . format ( post . slug ) ) try : source_out = os . path . join ( post . settings [ 'OUTPUT_PATH' ] , post . save_as ) source_out_path = os . path . split ( source_out ) [ 0 ] copy_to = os . path . join ( source_out_path , show_source_filename ) source_url = urljoin ( post . save_as , show_source_filename ) except Exception : return out = dict ( ) out [ 'copy_raw_from' ] = post . source_path out [ 'copy_raw_to' ] = copy_to logger . debug ( 'Linked %s to %s' , post . source_path , copy_to ) source_files . append ( out ) post . show_source_url = source_url
processes each article/page object and formulates copy from and copy to destinations .