Skip to content

Commit 2df33aa

Browse files
authored
Merge pull request #315 from Interlisp/mth6--remove-all-empty-fields-from-json
Remove all empty fields (and the keys) from the downloaded Zotero bibliography data.
2 parents 0531a7d + 9cb30d0 commit 2df33aa

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/update_bibliography.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ fi
246246
showInfo 1 "Got $(jq '. | length' <<< "$items") items"
247247

248248
# Piece-wise processing for debugging:
249+
items=$(jq 'include "./bib-fns";walk(if type == "object" then removeEmptyKeys end)' <<< $items)
250+
showInfo 8 "Remove all empty fields and the keys."
251+
if $debugFiles ; then
252+
dfn=$(debugFileName "removeEmptyKeys" $dfn)
253+
echo "$items" > "$dfn"
254+
fi
255+
249256
items=$(jq 'include "./bib-fns";map(semiflatten)' <<< "$items")
250257
showInfo 8 "Elevate fields in .csljson and .data to the item level."
251258
if $debugFiles ; then

0 commit comments

Comments
 (0)