From 9426b9fde89357216ea57c59fb669c2e049c92a1 Mon Sep 17 00:00:00 2001 From: 404NetworkError Date: Fri, 5 May 2017 13:13:38 -0500 Subject: [PATCH 1/8] Added simple build script for Linux and macOS systems. --- build_mendeleyBibFix.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 build_mendeleyBibFix.sh diff --git a/build_mendeleyBibFix.sh b/build_mendeleyBibFix.sh new file mode 100755 index 0000000..b0ac15c --- /dev/null +++ b/build_mendeleyBibFix.sh @@ -0,0 +1,2 @@ +#!/bin/sh +gcc mendeleyBibFix.c -std=c99 -Wall -o "mendeleyBibFix" From e5cbd3ec550e24c55b8818a4ba949caa4dad9e44 Mon Sep 17 00:00:00 2001 From: 404NetworkError Date: Fri, 5 May 2017 13:14:16 -0500 Subject: [PATCH 2/8] Fixed warnings about format. --- mendeleyBibFix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mendeleyBibFix.c b/mendeleyBibFix.c index 8ceecf7..74a21a8 100644 --- a/mendeleyBibFix.c +++ b/mendeleyBibFix.c @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) curBibEntry = malloc((curBibLength + 1)*sizeof(char)); if(curBibEntry == NULL) { - fprintf(stderr,"ERROR: Memory could not be allocated to copy bib entry %u.\n", numEntry); + fprintf(stderr,"ERROR: Memory could not be allocated to copy bib entry %lu.\n", numEntry); exit(EXIT_FAILURE); } for(curBibInd = 0; curBibInd < curBibLength; curBibInd++) @@ -376,7 +376,7 @@ int main(int argc, char *argv[]) fprintf(outputFile, "%s", outputContent); fclose(outputFile); - printf("Successfully wrote and closed output file with %u entries.\n", numEntry); + printf("Successfully wrote and closed output file with %lu entries.\n", numEntry); // Cleanup free(inputContent); From 7079acbbff48bd67fa2e60447de93cdc52bf7456 Mon Sep 17 00:00:00 2001 From: 404NetworkError Date: Fri, 5 May 2017 13:15:44 -0500 Subject: [PATCH 3/8] Updated README with simple Linux or macOS directions. --- README.md | 6 ++++-- mendeleyBibFix.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4a89ab6..7bda8ba 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,11 @@ It should work correctly for files generated by Mendeley Desktop v1.16.1. Still A number of fixes are hard-coded, i.e., it expects to know where the braces are. So this code runs very fast (bib files with hundreds of entries are fixed in a small fraction of a second) but may not be "future-proof" -You will need to compile this code to run it. A compiled version for windows is included on the release page of Github. If you are going to compile it yourself with gcc, then you will need the -std=c99 option +You will need to compile this code to run it. A compiled version for Windows is included on the release page of Github. If you are going to compile it yourself with gcc, then you will need the -std=c99 option -Call syntax (windows): +Call syntax (Windows): mendeleyBibFix.exe [OUTPUT_FILENAME] [INPUT_FILENAME] +Call syntax (Linux or macOS): + ./mendeleyBibFix [OUTPUT_FILENAME] [INPUT_FILENAME] Both arguments are optional. If there is only one argument, then it is assumed to be the output filename. The default input filename is "library.bib", and the default output filename is "library_fixed.bib". If you're happy with the defaults then you can just double-click on the executable in the directory with "library.bib". diff --git a/mendeleyBibFix.c b/mendeleyBibFix.c index 74a21a8..eb7e9e2 100644 --- a/mendeleyBibFix.c +++ b/mendeleyBibFix.c @@ -26,12 +26,14 @@ * So this code runs very fast (bib files with hundreds of entries are fixed in a * small fraction of a second) but may not be "future-proof" * - * You will need to compile this code to run it. A compiled version for windows is + * You will need to compile this code to run it. A compiled version for Windows is * included on the release page of Github. If you are going to compile it yourself with gcc, * then you will need the -std=c99 option * - * Call syntax (windows): + * Call syntax (Windows): * mendeleyBibFix.exe [OUTPUT_FILENAME] [INPUT_FILENAME] + * Call syntax (Linux or macOS): + * ./mendeleyBibFix [OUTPUT_FILENAME] [INPUT_FILENAME] * * Both arguments are optional. If there is only one argument, then it is assumed to be * the output filename. The default input filename is "library.bib", and the default From 1d08836c5a711babd390410bbdd8bb1f8d0e8ea5 Mon Sep 17 00:00:00 2001 From: 404NetworkError Date: Fri, 5 May 2017 13:16:19 -0500 Subject: [PATCH 4/8] Updated gitignore to include new executable for Linux and macOS systems. --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index dc389f0..a0f212d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ library.bib library_fixed.bib -*.exe \ No newline at end of file +*.exe +mendeleyBibFix From bbed34c496f2990fb275bac24d8137ca350d7a0a Mon Sep 17 00:00:00 2001 From: 404NetworkError Date: Fri, 5 May 2017 13:25:36 -0500 Subject: [PATCH 5/8] Fixed call syntax in README. --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7bda8ba..7429168 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,12 @@ It should work correctly for files generated by Mendeley Desktop v1.16.1. Still A number of fixes are hard-coded, i.e., it expects to know where the braces are. So this code runs very fast (bib files with hundreds of entries are fixed in a small fraction of a second) but may not be "future-proof" -You will need to compile this code to run it. A compiled version for Windows is included on the release page of Github. If you are going to compile it yourself with gcc, then you will need the -std=c99 option +You will need to compile this code to run it. A compiled version for Windows is included on the release page of Github. If you are going to compile it yourself with `gcc`, then you will need the `-std=c99` option -Call syntax (Windows): - mendeleyBibFix.exe [OUTPUT_FILENAME] [INPUT_FILENAME] -Call syntax (Linux or macOS): - ./mendeleyBibFix [OUTPUT_FILENAME] [INPUT_FILENAME] +* Call syntax (Windows): + `mendeleyBibFix.exe [OUTPUT_FILENAME] [INPUT_FILENAME]` +* Call syntax (Linux or macOS): + `./mendeleyBibFix [OUTPUT_FILENAME] [INPUT_FILENAME]` Both arguments are optional. If there is only one argument, then it is assumed to be the output filename. The default input filename is "library.bib", and the default output filename is "library_fixed.bib". If you're happy with the defaults then you can just double-click on the executable in the directory with "library.bib". + From 87124f548dead2363f17262a0c11c8ecf016a582 Mon Sep 17 00:00:00 2001 From: Adam Noel Date: Sat, 14 Oct 2017 13:40:54 -0400 Subject: [PATCH 6/8] Update build_mendeleyBibFix.bat Removed switch that made the compiled program debuggable --- build_mendeleyBibFix.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_mendeleyBibFix.bat b/build_mendeleyBibFix.bat index a59c938..dd9e036 100644 --- a/build_mendeleyBibFix.bat +++ b/build_mendeleyBibFix.bat @@ -1,2 +1,2 @@ @echo off -gcc mendeleyBibFix.c -std=c99 -g -o "mendeleyBibFix.exe" \ No newline at end of file +gcc mendeleyBibFix.c -std=c99 -o "mendeleyBibFix.exe" From 5771c60113e63c3d7155069b55864c825ded1f2b Mon Sep 17 00:00:00 2001 From: Caleb Aldridge Date: Fri, 27 Jul 2018 13:24:41 -0500 Subject: [PATCH 7/8] Added minor run instructions I added minor instructions (from comments at https://ramblingacademic.com/2016/06/fixing-bibtex-files-mendeley/) that are useful for cmd line challenged/intimidated persons (such as myself). --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7429168..40fb3da 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ It should work correctly for files generated by Mendeley Desktop v1.16.1. Still A number of fixes are hard-coded, i.e., it expects to know where the braces are. So this code runs very fast (bib files with hundreds of entries are fixed in a small fraction of a second) but may not be "future-proof" -You will need to compile this code to run it. A compiled version for Windows is included on the release page of Github. If you are going to compile it yourself with `gcc`, then you will need the `-std=c99` option +You will need to compile this code to run it. A compiled version for Windows is included on the release page of Github. If you are going to compile it yourself with `gcc`, then you will need the `-std=c99` option (e.g., command like “gcc -o mendeleyBibFix mendeleyBibFix.c -std=c99”). + +To run the script open a command window and navigate to the folder containing both the bib-file and the executable (e.g., cd "C:\Users\Documents..."); then enter “mendeleyBibFix.exe OUTPUT_FILENAME INPUT_FILENAME” where you specify the input and output filenames. You can omit those filename arguments if your bib-file is called library.bib and you want it to create library_fixed.bib. * Call syntax (Windows): `mendeleyBibFix.exe [OUTPUT_FILENAME] [INPUT_FILENAME]` From c18f2f3d1cde9daedb1b227ae26d17fdac022837 Mon Sep 17 00:00:00 2001 From: Adam Noel Date: Mon, 30 Jul 2018 09:16:12 +0100 Subject: [PATCH 8/8] Update README.md revised README for coherence and unity --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 40fb3da..09319c3 100644 --- a/README.md +++ b/README.md @@ -9,18 +9,22 @@ This is a simple function intended to correct bib-files that are automatically g * removes all appearances of the "annote" field, which is used by Mendeley for personal annotations to the entry * removes all appearances of the "file" field, which lists the location of a local soft copy -It should work correctly for files generated by Mendeley Desktop v1.16.1. Still works as of v1.17.9. +It should work correctly for files generated by Mendeley Desktop v1.16.1. Still works as of v1.18. A number of fixes are hard-coded, i.e., it expects to know where the braces are. So this code runs very fast (bib files with hundreds of entries are fixed in a small fraction of a second) but may not be "future-proof" You will need to compile this code to run it. A compiled version for Windows is included on the release page of Github. If you are going to compile it yourself with `gcc`, then you will need the `-std=c99` option (e.g., command like “gcc -o mendeleyBibFix mendeleyBibFix.c -std=c99”). -To run the script open a command window and navigate to the folder containing both the bib-file and the executable (e.g., cd "C:\Users\Documents..."); then enter “mendeleyBibFix.exe OUTPUT_FILENAME INPUT_FILENAME” where you specify the input and output filenames. You can omit those filename arguments if your bib-file is called library.bib and you want it to create library_fixed.bib. - +The full call syntax is as follows: * Call syntax (Windows): `mendeleyBibFix.exe [OUTPUT_FILENAME] [INPUT_FILENAME]` * Call syntax (Linux or macOS): `./mendeleyBibFix [OUTPUT_FILENAME] [INPUT_FILENAME]` -Both arguments are optional. If there is only one argument, then it is assumed to be the output filename. The default input filename is "library.bib", and the default output filename is "library_fixed.bib". If you're happy with the defaults then you can just double-click on the executable in the directory with "library.bib". +Both arguments are optional. If there is only one argument, then it is assumed to be the output filename. The default input filename is "library.bib" (which is the default name of the bib-file that Mendeley generates), and the default output filename is "library_fixed.bib". + +You can run the script in one of two ways: +1) Open a command window and navigate to the folder containing both the bib-file and the executable (e.g., cd "C:\Users\Documents..."). Then enter (for Windows) "mendeleyBibFix.exe OUTPUT_FILENAME INPUT_FILENAME". You can omit the filename arguments if your bib-file is called library.bib and you want the script to create library_fixed.bib. +2) If you're happy with the default arguments, and if the executable is placed in the same directory as the bib-file "library.bib", then you can just double-click on the executable +