Last active
October 30, 2016 20:42
-
-
Save kleinschmidt/4b97fd87106c7472c67d to your computer and use it in GitHub Desktop.
Make Mendeley, BibTeX, and apacite play nicely together by removing URL and month entries. Apacite lumps journal articles and newspaper/magazine articles in the same class, and always prints a month if it's provided. This gist has a shell script that strips this info out and a launchd handler that watches the auto-exported .bib file and runs the…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>auto-clean-mendeley-library</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/Users/dkleinschmidt/Documents/papers/clean-library-auto.sh</string> | |
</array> | |
<key>WatchPaths</key> | |
<array> | |
<string>/Users/dkleinschmidt/Documents/papers/library.bib</string> | |
</array> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /Users/dkleinschmidt/Documents/papers | |
# remove month and url lines in bib entries | |
egrep -v '^(month|url)' > library-clean.bib < library.bib | |
# write a message to the log | |
/usr/bin/logger library.bib modified and cleaned |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this whole solution was adapted from | |
# http://stackoverflow.com/questions/1515730/is-there-a-command-like-watch-or-inotifywait-on-the-mac | |
# you'll have to change the hard-coded locations to match whereever you put these | |
# files and Mendeley exports the .bib file. | |
# install the watcher using launchctl: | |
launchctl load /Users/dkleinschmidt/Documents/papers/clean-library-auto.plist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment