-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathupdate_bib.sh
More file actions
executable file
·28 lines (26 loc) · 1.16 KB
/
update_bib.sh
File metadata and controls
executable file
·28 lines (26 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
BIBFILES="authors.bib abbrev.bib journals.bib articles.bib biblio.bib crossref.bib"
for file in $BIBFILES; do
# echo $file
curl --silent --show-error https://raw.githubusercontent.com/iridia-ulb/references/master/${file} -o ${file}
if [ ! -s "${file}" ]; then
echo "error: ${file} is empty!"
exit 1
fi
done
tmpbib=$(mktemp --tmpdir tmpXXXXXXXXXX.bib)
keys=$(paste -d '#' -s bibkeys.txt | sed 's/#/\\\|/g')
bib2bib --warn-error --expand --expand-xrefs --no-comment --expand-xrefs $BIBFILES --remove pdf --remove ids -c "(\$key : \"$keys\")" -ob $tmpbib -oc /dev/null
if [ ! -s "${tmpbib}" ]; then
echo "error: ${tmpbib} is empty! keys:= $keys"
exit 1
fi
# Workaround https://github.com/GeoBosh/rbibutils/issues/9
sed -i -e 's#\\slash #~/ #g' \
-e 's#\\hspace{0pt}#{}{}{}#g' \
-e 's%researchrepository.napier.ac.uk/id/eprint/3044%lopez-ibanez.eu/publications#LopezIbanezPhD%g' \
$tmpbib
comment='% DO NOT EDIT THIS FILE. It is auto-generated by "update_bib.sh".'
echo $comment | cat --squeeze-blank - $tmpbib > r/inst/REFERENCES.bib
cp --force r/inst/REFERENCES.bib ./python/doc/source/REFERENCES.bib
rm -f $BIBFILES $tmpbib