Commit 6753cd44 authored by Johannes Kiesel's avatar Johannes Kiesel

reformat_bib sorts fields

parent 9f3fe2d6
......@@ -14,11 +14,17 @@ cmd_reformat_bib() {
continue
fi
sort_order=$(grep '^\s*\w\w*\s*=' "${f}"\
| sed 's/^\s*\(\w\w*\).*/\1/' \
| sort | uniq \
| awk '{if (NR != 1) {printf " # "}; printf "%s", $1}')
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' \
-- 'new.entry.type {Omitted}' \
-- "sort.order = { * = ${sort_order} }" \
-- 'rewrite.rule = {doi# "https?://.*doi.*\.org/\(10\.[0-9]+/.+\)"# "\1"}' \
"$f" | sed '/./,$!d' | sponge "$f"
done
......
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