#!/bin/bash # set some paths/binary names depending on the OS case "$(uname -s)" in "Darwin") PHP="php83" ;; # "Linux" is Linux *) PHP="php" ;; esac # URL of the Bibtex file BIBTEX_URL="https://cloud.hiz-saarland.de/public.php/dav/files/Yj8FtZsTS9TkFWG" # command to run BibtexBrowser BIBTEXBROWSER="${PHP} -c \"php_cli.ini\" -f \"bibtexbrowser.php\"" # DELETEME rm -rf "artifacts" "temp" # create output directories and download bibtex file mkdir -p "artifacts/keys" "temp" wget -O "temp/zrd.bib" "$BIBTEX_URL" # if `bibtool` is available, sanitize the bibtex file if which bibtool >/dev/null 2>&1 then bibtool "temp/zrd.bib" > "temp/zrd.new.bib" echo "Bibtool successful!" mv -f "temp/zrd.new.bib" "temp/zrd.bib" fi # copy static files cp -fR "static" "artifacts/" for WEBSITE_LANGUAGE in german do : # generate full index eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" all display=YearCatDisplay language=$WEBSITE_LANGUAGE > \"artifacts/all.${WEBSITE_LANGUAGE}.html\"" # generate index for each person while read LINE do : ALIAS="$(echo "$LINE" | cut -d ':' -f 1)" SEARCHSTRING="$(echo "$LINE" | cut -d ':' -f 2)" eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" \"author=$SEARCHSTRING\" academic=1 language=$WEBSITE_LANGUAGE > \"artifacts/${ALIAS}.${WEBSITE_LANGUAGE}.html\"" done < "persons.txt" done # generate page for each key egrep '^@' "temp/zrd.bib" | sed -e 's/.*\t \(.*\),/\1/' | while read KEY do : eval "$BIBTEXBROWSER \"bib=temp/zrd.bib\" \"key=$KEY\" > \"artifacts/keys/${KEY}.html\"" done # Clean up rm -rf "temp" rm bibtexbrowser_*.dat