Commit 21335c5b authored by Janek Bevendorff's avatar Janek Bevendorff

Add bib reformatter

parent 7060f313
......@@ -12,19 +12,21 @@
"betamng": "Low level scripts for managing Betaweb.",
"betaweb": "High level scripts for betaweb, e.g. hadoop management.",
"elasticsearch": "Helper scripts for managing Elasticsearch on the Betaweb cluster.",
"latex": "LaTeX helpers",
"git": "Helper scripts for working with the Webis Git server and GitLab instance.",
"webis20": "Storage Management Scripts, need direct access to RAID Controller and MegaCLI installed",
"pki": "Webis TLS PKI Tools",
"k8s": "Kubernetes tools",
"archiveuser": "Archive one or all useraccount(s) on a standard webis machine"
"archiveuser": "Archive one or all useraccount(s) on a standard webis machine"
},
"commands_aliases": {
"core": ["co"],
"latex": ["la"],
"util": ["ut"],
"betamng": ["bm"],
"betaweb": ["bw"],
"elasticsearch": ["es"],
"archiveuser": ["au"]
"archiveuser": ["au"]
}
}
#!/usr/bin/env bash
scriptPath=${0%/*}
. "$scriptPath"/../../libs/bashhelper.sh
. "$scriptPath"/../../libs/shflags
check_tools "bibtool sponge"
usage() {
echo "
usage:
$(basename "$0") FILE [FILE ...]
description:
Reformat BibTeX files.
"
exit 1
}
reformat() {
for f in "$@"; do
if [ ! -f "$f" ]; then
logError "${f}: no such file or directory."
continue
fi
logInfo "Reformatting '${f}'..."
bibtool -- 'print.align = 24' -- 'print.align.key = 0' \
-- 'print.equal.right = off' -- 'pass.comments = on' \
-- 'print.line.length = 1000' -- 'print.use.tab = off' \
-- 'rewrite.rule = {doi# "https?://.*doi.*\.org/\(10\.[0-9]+/.+\)"# "\1"}' \
"$f" | sed '/./,$!d' | sponge "$f"
done
}
if [ "$1" == "" ]; then
usage
exit 1
fi
reformat "$@"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment