summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_content.sh27
1 files changed, 16 insertions, 11 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index 26c936d..a57feed 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -57,6 +57,12 @@ get_metadata() {
57 --template scripts/metadata_tpl.json 57 --template scripts/metadata_tpl.json
58} 58}
59 59
60get_content() {
61 pandoc "$1" \
62 -f markdown \
63 -t plain
64}
65
60get_section() { 66get_section() {
61 filename=$1 67 filename=$1
62 filename=${filename#"$CONTENT_DIR"} 68 filename=${filename#"$CONTENT_DIR"}
@@ -79,20 +85,12 @@ get_subpages_meta() {
79 child_pages=() 85 child_pages=()
80 86
81 if [ -d "$basedir" ]; then 87 if [ -d "$basedir" ]; then
82 mapfile -d $'\0' child_pages_1 < <(find $basedir/ \ 88 mapfile -d $'\0' child_pages < <(find $basedir/ \
83 -type f \ 89 -type f \
84 -name "*.md" ! -name "index.md" \ 90 -name "*.md" \
85 -maxdepth 1 \ 91 ! -wholename "$basedir/index.md" \
86 -print0)
87
88 mapfile -d $'\0' child_pages_2 < <(find $basedir/ \
89 -type f \
90 -name "index.md" \
91 -mindepth 2 \
92 -maxdepth 2 \ 92 -maxdepth 2 \
93 -print0) 93 -print0)
94
95 child_pages=("${child_pages_1[@]}" "${child_pages_2[@]}")
96 fi 94 fi
97 95
98 pages=$(echo "{}" | jq ". + { \ 96 pages=$(echo "{}" | jq ". + { \
@@ -109,6 +107,7 @@ get_subpages_meta() {
109 #echo -e "\033[0;90m[////////]\033[0m - $file" 107 #echo -e "\033[0;90m[////////]\033[0m - $file"
110 108
111 metadata=$(get_metadata "$file") 109 metadata=$(get_metadata "$file")
110 # content=$(get_content "$file")
112 111
113 section=$(get_section "$file") 112 section=$(get_section "$file")
114 113
@@ -130,6 +129,12 @@ get_subpages_meta() {
130 category_name=$(echo "$CATEGORIES" | jq -r .$section.$category) 129 category_name=$(echo "$CATEGORIES" | jq -r .$section.$category)
131 fi 130 fi
132 131
132 # metadata=$(echo "$metadata" | jq ". + { \
133 # content: { \
134 # plain: \"$(echo "$content" | sed -z 's/\\/\\\\/g;s/\n/\\n/g;s/"/\"/g')\", \
135 # }, \
136 # }")
137
133 metadata=$(echo "$metadata" | jq ". + { \ 138 metadata=$(echo "$metadata" | jq ". + { \
134 date: { \ 139 date: { \
135 yyyy_mm_dd: \"$date\", \ 140 yyyy_mm_dd: \"$date\", \