This commit is contained in:
Luke Smith 2022-10-26 16:28:38 -04:00
parent 130e200da1
commit eaf4c12ee2

View file

@ -4,7 +4,7 @@
if [ -f "$1" ]; then if [ -f "$1" ]; then
# Try to get DOI from pdfinfo or pdftotext output. # Try to get DOI from pdfinfo or pdftotext output.
doi=$(pdfinfo "$1" | grep -io "doi:.*") || doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:\s*\S\+[[:alnum:]]" -m 1) || doi=$(pdftotext "$1" 2>/dev/null - | sed -n '/[dD][oO][iI]:/{s/.*[dD][oO][iI]:\s*\(\S\+[[:alnum:]]\).*/\1/p;q}') ||
exit 1 exit 1
else else
doi="$1" doi="$1"