summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2020-12-28 09:57:02 +0100
committerVolpeon <git@volpeon.ink>2020-12-28 09:57:02 +0100
commit4631bf9fee31289d30d211d59b77b579303d55f6 (patch)
treef33e5eb4713280d3c1b5e73e996a08fddab5e9a3 /scripts
parentCompleted automatic metadata generation (diff)
downloadvolpeon.ink-4631bf9fee31289d30d211d59b77b579303d55f6.tar.gz
volpeon.ink-4631bf9fee31289d30d211d59b77b579303d55f6.tar.bz2
volpeon.ink-4631bf9fee31289d30d211d59b77b579303d55f6.zip
Various small fixes, exclude raw ASCII fox from output
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_content.sh25
1 files changed, 20 insertions, 5 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index 298291d..e3b97ea 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -25,8 +25,7 @@ target_url_rel () {
25} 25}
26 26
27target_url_abs () { 27target_url_abs () {
28 url=$(target_url_rel "$CONTENT_DIR" "$1") 28 echo "/$(target_url_rel "$CONTENT_DIR" "$1")"
29 echo "/$url"
30} 29}
31 30
32get_section() { 31get_section() {
@@ -69,7 +68,10 @@ get_subpages() {
69 if [ ${#child_pages[@]} -ne 0 ]; then 68 if [ ${#child_pages[@]} -ne 0 ]; then
70 #echo -e "\033[0;90m[////////]\033[0m Child pages:" 69 #echo -e "\033[0;90m[////////]\033[0m Child pages:"
71 70
72 collected_metadata="[]" 71 collected_metadata=$(echo "{
72 \"all\": [],
73 \"by_year\": {}
74 }" | jq .)
73 75
74 for file in "${child_pages[@]}"; do 76 for file in "${child_pages[@]}"; do
75 #echo -e "\033[0;90m[////////]\033[0m - $file" 77 #echo -e "\033[0;90m[////////]\033[0m - $file"
@@ -84,10 +86,22 @@ get_subpages() {
84 86
85 metadata=$(echo "$metadata" | jq ". + { url_rel: \"$url_rel\", url_abs: \"$url_abs\" }") 87 metadata=$(echo "$metadata" | jq ". + { url_rel: \"$url_rel\", url_abs: \"$url_abs\" }")
86 88
87 collected_metadata=$(echo "$collected_metadata" | jq ". + [ $metadata ]") 89 collected_metadata=$(echo "$collected_metadata" | jq ".all += [ $metadata ]")
90
91 date=$(echo "$metadata" | jq -r .date)
92
93 if [ "$date" != "" ]; then
94 date_year=$(date -d "$date" +%Y)
95 #date_month=$(date -d "$date" +%m)
96 #date_day=$(date -d "$date" +%d)
97
98 collected_metadata=$(echo "$collected_metadata" | jq ".by_year.\"$date_year\" += [ $metadata ]")
99 fi
88 done 100 done
89 101
90 collected_metadata=$(echo "$collected_metadata" | jq "sort_by(.date) | reverse") 102 collected_metadata=$(echo "$collected_metadata" \
103 | jq ".all |= (sort_by(.date) | reverse)" \
104 | jq ".by_year[] |= (sort_by(.date) | reverse)")
91 105
92 echo "{ \"pages\": $collected_metadata }" | jq . 106 echo "{ \"pages\": $collected_metadata }" | jq .
93 fi 107 fi
@@ -110,6 +124,7 @@ handle () {
110 124
111 subpages_meta_file=$(mktemp) 125 subpages_meta_file=$(mktemp)
112 126
127 # echo "$(get_subpages "$1")"
113 echo "$(get_subpages "$1")" > "$subpages_meta_file" 128 echo "$(get_subpages "$1")" > "$subpages_meta_file"
114 129
115 pandoc "$1" \ 130 pandoc "$1" \