An open API service indexing awesome lists of open source software.

https://github.com/giuppep/mendeleybibtexcleaner

Small python CLI to "clean" the .bib files generated by Mendeley
https://github.com/giuppep/mendeleybibtexcleaner

bibtex bibtexparser mendeley

Last synced: 8 months ago
JSON representation

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

Awesome Lists containing this project

README

          

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

## Introduction

[Mendeley](https://www.mendeley.com) is a popular software to organise bibliography.
While it provides a basic feature to export the library in [BibTeX](http://www.bibtex.org/) 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](http://click.pocoo.org) and [bibtexparser](https://github.com/sciunto-org/python-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
```