Skip to content

Commit

Permalink
paper abbrs
Browse files Browse the repository at this point in the history
  • Loading branch information
wulfdewolf committed Feb 13, 2024
1 parent d4890c9 commit 9c61f4f
Show file tree
Hide file tree
Showing 3 changed files with 2,630 additions and 2,655 deletions.
19 changes: 19 additions & 0 deletions _bibliography/convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import bibtexparser


def add_field_if_author_in_entry(bibtex_path, author_name, new_field, new_field_value):
with open(bibtex_path) as bibtex_file:
bib_database = bibtexparser.load(bibtex_file)

for entry in bib_database.entries:
if 'author' in entry and author_name in entry['author']:
entry[new_field] = new_field_value

with open(bibtex_path, 'w') as bibtex_file:
bibtexparser.dump(bib_database, bibtex_file)


# Usage
add_field_if_author_in_entry(
'papers.bib', 'Nolan', 'abbr', 'NOLAN')
84 changes: 0 additions & 84 deletions _bibliography/nolan.bib

This file was deleted.

Loading

0 comments on commit 9c61f4f

Please sign in to comment.