tFix abbreviation of author names with accents - scholarref - tools for DOI and BiBTeX reference extraction, fetching, and parsing
(HTM) git clone git://src.adamsgaard.dk/scholarref
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 866570b4016c579141ed807c3e9719f82b65bc45
(DIR) parent 135d7c53f50e6696b5be7635a229374d2696a498
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 15 Nov 2019 18:15:56 +0100
Fix abbreviation of author names with accents
Diffstat:
M getref | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
---
(DIR) diff --git a/getref b/getref
t@@ -90,7 +90,7 @@ abbreviate_journal_name() {
}
abbreviate_author_name() {
- sed -e '/author = /{' -e 's/\([A-Z]\)[^[:space:]]* \([A-Z]\)/\1. \2/g' -e '}'
+ sed -e '/author = /{' -e 's/\([A-Z]\)[^ ]* \([A-Z]\)/\1. \2/g' -e '}'
}
strip_doi() {
t@@ -101,18 +101,19 @@ get_citation() {
doi=$(echo "$1" | strip_doi)
url="$host/$1"
[ "$verbose" = 1 ] && echo "connecting to $url" || :
- result=$($prefix curl --location \
+ echo "$url"
+ result="$($prefix curl --location \
--header "Accept: application/x-bibtex" \
- --silent --show-error "$url")
+ --silent --show-error "$url")"
echo "$result" | grep -q '<html>' && die 'no result found'
- result="$(echo "$result" | format_bibtex_key)"
- [ "$fulljournal" = 0 ] && result="$(echo "$result" | abbreviate_journal_name)" || :
- [ "$fullauthor" = 0 ] && result="$(echo "$result" | abbreviate_author_name)" || :
- result="$(echo "$result" | grep -v -e 'url = ' -e 'month = ' )"
+ result="$(printf "%s\n" "$result" | format_bibtex_key)"
+ [ "$fulljournal" = 0 ] && result="$(printf "%s\n" "$result" | abbreviate_journal_name)" || :
+ [ "$fullauthor" = 0 ] && result="$(printf "%s\n" "$result" | abbreviate_author_name)" || :
+ result="$(printf "%s\n" "$result" | grep -v -e 'url = ' -e 'month = ' )"
if [ "$nonewline" = 1 ]; then
printf "\n%s" "$result"
else
- echo "$result"
+ printf "%s\n" "$result"
fi
[ "$notify" = 1 ] && notify-send "${0##*/}" "added: $(echo "$result" | cut -c-80)" || :
}