Skip to content

Small python CLI to "clean" the .bib files generated by Mendeley

License

Notifications You must be signed in to change notification settings

giuppep/MendeleyBibTeXCleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MendeleyBibTeXCleaner

Small CLI to "clean" the .bib files generated by Mendeley

Introduction

Mendeley is a popular software to organise bibliography. While it provides a basic feature to export the library in BibTeX format, I often found myself in the need of editing the .bib file to get it to work properly in my LaTeX documents. In particular, the exported .bib file contains a lot of unnecessary information for the use in a LaTeX document (e.g. abstract of the paper, filepath...). Moreover Mendely does not format correctly the month field, e.g. it exports month = {jun} rather than month = jun.

This script takes as input the .bib file created by Mendeley and returns a "cleaned up" file where only the user-specified fields are mantained. Moreover it gives the possibility of fixing the formatting of the month field.

Acknowledgements

This script makes use of click and bibtexparser.

Installation

Simply clone the repository and run

$ pip3 install .

Usage

$ mendeleycleaner COMMAND [ARGS] [OPTIONS] 

To 'clean' a file run

$ mendeleycleaner clean BIB_FILE.bib [OPTIONS]

The script will save the 'cleaned' file as BIB_FILE_edited.bib. This behaviour can be changed using appropriate options (see below).

To edit the configuration file run

$ mendeleycleaner config

At the first run, the script will create a default configuration file in ~/.MedeleyBibTeXCleaner The first few lines of the configuration file will look like

# Configuration file for MendeleyBibTeXCleaner
#
# Comment with "#" (or delete) the lines corresponding to the BibTeX fields
# that you DO NOT want in the processed bib file.
# If you want to include additional BibTeX fields, simply add them at the
# end of this file.
author
title
journal
pages
...

The user should edit the configuration file to their preferences before running the script. The default config file will return a bibliography with minimal information.

To display the help message, simply run

$ mendeleycleaner --help

Flags and options

  • --month will fix the month formatting.
  • --save-to DESTINATION allows the user to specify the destination file.
  • --overwrite overwrites the original .bib file.

Uninstall

To uninstall the script, simply run

$ pip3 uninstall MendeleyBibTeXCleaner

About

Small python CLI to "clean" the .bib files generated by Mendeley

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages