summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2020-12-29 12:24:04 +0100
committerVolpeon <git@volpeon.ink>2020-12-29 12:24:04 +0100
commit381297c95c7446182e90e459cd0257a8fc86b4cf (patch)
tree5a330a18ea60d983bc6f05976295a316a8ad7a24 /scripts
parentHandle blog entry categories (diff)
downloadvolpeon.ink-381297c95c7446182e90e459cd0257a8fc86b4cf.tar.gz
volpeon.ink-381297c95c7446182e90e459cd0257a8fc86b4cf.tar.bz2
volpeon.ink-381297c95c7446182e90e459cd0257a8fc86b4cf.zip
Improved CSS classes for page content, added proper ref list macro, build scripts load and watch Pandoc filters automatically
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_content.sh32
-rwxr-xr-x[-rw-r--r--]scripts/metadata_tpl.json0
-rwxr-xr-xscripts/watch_filters.sh7
3 files changed, 34 insertions, 5 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index 719b7c9..b258449 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -1,14 +1,31 @@
1#!/bin/bash 1#!/bin/bash
2 2
3CONTENT_DIR="content/" 3CONTENT_DIR="content/"
4FILTERS_DIR="filters/"
4METADATA_DIR="metadata/" 5METADATA_DIR="metadata/"
5TEMPLATES_DIR="templates/" 6TEMPLATES_DIR="templates/"
6OUTPUT_DIR="output/" 7OUTPUT_DIR="output/"
7 8
8CATEGORY_SHORT_LEN=3
9CATEGORY_MAP=$(cat "$METADATA_DIR/categories.json") 9CATEGORY_MAP=$(cat "$METADATA_DIR/categories.json")
10 10
11target_filename () { 11get_filters() {
12 filters_args=""
13
14 mapfile -d $'\0' filters < <(find $FILTERS_DIR \
15 -type f \
16 -name "*.lua" ! -name ".*" \
17 -print0)
18
19 for file in "${filters[@]}"; do
20 filters_args="$filters_args --lua-filter $file"
21 done
22
23 echo $filters_args
24}
25
26FILTERS=$(get_filters)
27
28target_filename() {
12 filename=$1 29 filename=$1
13 filename=${filename#"$CONTENT_DIR"} 30 filename=${filename#"$CONTENT_DIR"}
14 if [ "${filename##*.}" = "md" ]; then 31 if [ "${filename##*.}" = "md" ]; then
@@ -17,7 +34,7 @@ target_filename () {
17 echo "$OUTPUT_DIR$filename" 34 echo "$OUTPUT_DIR$filename"
18} 35}
19 36
20target_url_rel () { 37target_url_rel() {
21 basedir=$1 38 basedir=$1
22 filename=$2 39 filename=$2
23 filename=$(realpath --relative-to="$basedir" "$filename") 40 filename=$(realpath --relative-to="$basedir" "$filename")
@@ -28,7 +45,7 @@ target_url_rel () {
28 echo "$filename" 45 echo "$filename"
29} 46}
30 47
31target_url_abs () { 48target_url_abs() {
32 echo "/$(target_url_rel "$CONTENT_DIR" "$1")" 49 echo "/$(target_url_rel "$CONTENT_DIR" "$1")"
33} 50}
34 51
@@ -148,6 +165,10 @@ handle () {
148 # echo "$(get_metadata "$1")" 165 # echo "$(get_metadata "$1")"
149 echo "$(get_metadata "$1")" > "$subpages_meta_file" 166 echo "$(get_metadata "$1")" > "$subpages_meta_file"
150 167
168 # echo $(pandoc "$1" \
169 # -f markdown \
170 # -t json)
171
151 pandoc "$1" \ 172 pandoc "$1" \
152 -f markdown \ 173 -f markdown \
153 -t html5 \ 174 -t html5 \
@@ -157,7 +178,8 @@ handle () {
157 --metadata section=$section \ 178 --metadata section=$section \
158 --metadata "is$section" \ 179 --metadata "is$section" \
159 --metadata-file metadata/metadata.yaml \ 180 --metadata-file metadata/metadata.yaml \
160 --metadata-file "$subpages_meta_file" 181 --metadata-file "$subpages_meta_file" \
182 $FILTERS
161 # --lua-filter "filters/add_refs.lua" 183 # --lua-filter "filters/add_refs.lua"
162 184
163 rm "$subpages_meta_file" 185 rm "$subpages_meta_file"
diff --git a/scripts/metadata_tpl.json b/scripts/metadata_tpl.json
index 76e4439..76e4439 100644..100755
--- a/scripts/metadata_tpl.json
+++ b/scripts/metadata_tpl.json
diff --git a/scripts/watch_filters.sh b/scripts/watch_filters.sh
new file mode 100755
index 0000000..9bb3b44
--- /dev/null
+++ b/scripts/watch_filters.sh
@@ -0,0 +1,7 @@
1#!/bin/bash
2
3inotifywait -qrme close_write,delete,move --format "%w%f" filters \
4 | while read file
5 do
6 scripts/build_content.sh "all_md"
7 done