feat(cmd edit): exclude bibtex fields if specified

This commit is contained in:
Mitsuhiro Nakamura 2021-12-10 14:56:07 +09:00
parent b208bc45bc
commit d2dfe7dc9a

View File

@ -59,6 +59,12 @@ def command(conf, args):
ui.info(("The metadata of paper '{}' was successfully " ui.info(("The metadata of paper '{}' was successfully "
"edited.".format(color.dye_out(citekey, 'citekey')))) "edited.".format(color.dye_out(citekey, 'citekey'))))
else: else:
# exclude bibtex fields if specified
for item in content.values():
for field in conf['main']['bibtex_field_excludes']:
if field in item:
del item[field]
new_paper = Paper.from_bibentry(content, new_paper = Paper.from_bibentry(content,
metadata=paper.metadata) metadata=paper.metadata)
if rp.rename_paper(new_paper, old_citekey=paper.citekey): if rp.rename_paper(new_paper, old_citekey=paper.citekey):