Merge 6e0377b5a1aa2ef5ebf2cb8e3d7730d09f4c2c7f into 9a85d328ccf29f4cebb104e4eeeba1b20a896f6b

This commit is contained in:
Emre AKYÜZ 2023-07-22 16:36:17 +08:00 committed by GitHub
commit 94008c2575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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