summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2024-05-10 11:19:49 +0200
committerJonas Smedegaard <dr@jones.dk>2024-06-04 17:35:41 +0200
commit73731d8b52cc9d2e4d5fa65f5e39e0cfad395828 (patch)
tree3fb5608c5a2957e1214bef39c68cf03f693e9dee /bin
parent2f585a90c206a20aa7aa5dbddd00c0cc5ae9a67e (diff)
extend BibLaTeX tidying to cover JabRef comment that bibclean chokes on
Diffstat (limited to 'bin')
-rwxr-xr-xbin/biblatex-tidy.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/biblatex-tidy.sh b/bin/biblatex-tidy.sh
new file mode 100755
index 0000000..a29632d
--- /dev/null
+++ b/bin/biblatex-tidy.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+# tidy BibLaTeX file
+
+# Depends: bibclean
+
+set -eu
+
+INFILE=$1
+
+# workaround: strip JabRef comment that bibclean chokes on
+perl -gpe 's/^\@Comment\{jabref-meta: databaseType:biblatex;\}$//m' < $INFILE > $INFILE~
+bibclean -max-width 0 $INFILE~ > $INFILE~~
+printf '\n%s\n' '@Comment{jabref-meta: databaseType:biblatex;}' >> $INFILE~~
+mv -f $INFILE~~ $INFILE
+rm -f $INFILE~