Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
# Generated manuscript variables
variables = collections.OrderedDict()
# Read metadata which contains pandoc_yaml_metadata
# as well as author_info.
if args.meta_yaml_path.is_file():
with args.meta_yaml_path.open() as read_file:
metadata = yaml.load(read_file)
assert isinstance(metadata, dict)
else:
metadata = {}
logging.warning(f'missing {args.meta_yaml_path} file with yaml_metadata_block for pandoc')
# Add date to metadata
now = datetime_now()
logging.info(
f'Using {now:%Z} timezone.\n'
f'Dating manuscript with the current datetime: {now.isoformat()}')
metadata['date-meta'] = now.date().isoformat()
variables['date'] = f'{now:%B} {now.day}, {now.year}'
# Process authors metadata
authors = metadata.pop('author_info', [])
metadata['author-meta'] = [author['name'] for author in authors]
variables['authors'] = authors
variables = add_author_affiliations(variables)
# Set repository version metadata for Travis CI builds only
# https://docs.travis-ci.com/user/environment-variables/
if os.getenv('TRAVIS', 'false') == 'true':
repo_slug = os.environ['TRAVIS_REPO_SLUG']