Skip to content

Commit a106126

Browse files
committed
Cleanup (remove or conditionalize) most of the irrelevant bits in update_bibliography.sh
1 parent c48cdc3 commit a106126

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

scripts/update_bibliography.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ curlFiles=false # --curlfiles/-u
4444
# The collections files will be created only if directly querying Zotero API.
4545
collectionsFiles=false # --collectionsfiles/-c
4646

47-
# removeChildrenFromFinalFile=false
47+
removeChildrenFromFinalFiles=true # Set to false for debugging, or if later needed.
4848

4949
showInfoLevel=2 # --infolevel/-i
5050
# 0: NO showInfo messages.
@@ -379,22 +379,21 @@ finalCount=$(jq '. | length' <<< "$items")
379379

380380
items=$(jq 'include "./bib-fns";map(issued_iso_string | issued_date_readable | add_author_string | add_editor_string)' <<< "$items")
381381

382-
#items=$(jq 'include "./bib-fns";map(add_author_string)' <<< "$items")
383-
384-
#items=$(jq 'include "./bib-fns";map(add_editor_string)' <<< "$items")
385-
# if $removeChildrenFromFinalFile; then
386-
# # Remove .children arrays, if any. Save space.
387-
# items=$(jq 'map(del(.children))' <<< "$items")
388-
# showInfo 8 "Remove .children arrays from final items"
389-
# if $debugFiles ; then
390-
# dfn=$(debugFileName "withoutChildrenArray" $dfn)
391-
# echo "$items" > "$dfn"
392-
# fi
393-
# fi
382+
if $removeChildrenFromFinalFiles; then
383+
# Remove .children arrays, if any. Save space.
384+
items=$(jq 'map(del(.children))' <<< "$items")
385+
showInfo 8 "Remove .children arrays from final items"
386+
if $debugFiles ; then
387+
dfn=$(debugFileName "withoutChildrenArray" $dfn)
388+
echo "$items" > "$dfn"
389+
fi
390+
fi
394391

395392
# Do this here, instead of keeping a copy of the current value of $items, just to do this later.
396393
jq -c 'include "./bib-fns";.[] | bibItem' <<< "$items" > bibliography-items-by-line.json
397394

395+
if false ; then
396+
# This is now irrelevant!!
398397
# Group by year
399398
items=$(jq 'group_by(.issued."date-parts"[0][0])' <<< "$items")
400399
items=$(jq 'map({ (.[0].issued."date-parts"[0][0] // "Undated" | tostring): . })' <<< "$items")
@@ -409,6 +408,7 @@ if $debugFiles ; then
409408
dfn=$(debugFileName "final" $dfn)
410409
echo "$items" > "$dfn"
411410
fi
411+
fi # end of "irrelevant" block!
412412

413413
showInfo 1 "Generating individual Bibliography entries' .md files"
414414
BIBLIOGRAPHY_DIR="./../content/en/history/bibliography"
@@ -423,6 +423,6 @@ mkdir -p "$BIBLIOGRAPHY_DIR" "$BIBITEMS_DIR"
423423
# Cleanup (uncomment once working)
424424
# rm bibliography-items-by-line.json
425425

426-
showInfo 1 "Outputting CSL JSON"
426+
# showInfo 1 "Outputting CSL JSON"
427427
showInfo 1 "$finalCount entries"
428428
#echo "$items" > "$(dirname "$0")/../static/data/bibliography.json"

0 commit comments

Comments
 (0)