diff options
author | Volpeon <git@volpeon.ink> | 2021-04-20 21:45:36 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-04-20 21:45:36 +0200 |
commit | 269433c6f84ce631d38fd7ffaed04ed3f7c2bf4f (patch) | |
tree | dece94a7b29ef36c98d322b8439e41d171fde0a8 /scripts | |
parent | Update (diff) | |
download | volpeon.ink-269433c6f84ce631d38fd7ffaed04ed3f7c2bf4f.tar.gz volpeon.ink-269433c6f84ce631d38fd7ffaed04ed3f7c2bf4f.tar.bz2 volpeon.ink-269433c6f84ce631d38fd7ffaed04ed3f7c2bf4f.zip |
Support project previews
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build_content.sh | 1 | ||||
-rw-r--r-- | scripts/metadata_filter.lua | 10 | ||||
-rwxr-xr-x | scripts/watch_content.sh | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 83b6908..e627edc 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
@@ -82,6 +82,7 @@ get_subpages_metadata() { | |||
82 | date: .date, \ | 82 | date: .date, \ |
83 | last_update: .last_update, \ | 83 | last_update: .last_update, \ |
84 | category: .category, \ | 84 | category: .category, \ |
85 | preview: .preview, \ | ||
85 | content: \"$content\" \ | 86 | content: \"$content\" \ |
86 | } | del(.[] | nulls)") | 87 | } | del(.[] | nulls)") |
87 | local title=$(echo "$metadata" | jq ".title") | 88 | local title=$(echo "$metadata" | jq ".title") |
diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 499cf3e..21698bd 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua | |||
@@ -260,14 +260,18 @@ function Meta(meta) | |||
260 | 260 | ||
261 | meta.file_out = get_file_out(meta.rewrites, meta.content_dir, | 261 | meta.file_out = get_file_out(meta.rewrites, meta.content_dir, |
262 | meta.output_dir, meta.file_in) | 262 | meta.output_dir, meta.file_in) |
263 | if meta.relative_to == nil then | 263 | if meta.relative_to == nil then meta.relative_to = meta.file_in end |
264 | meta.relative_to = meta.file_in | ||
265 | end | ||
266 | meta.relative_to_out = get_file_out(meta.rewrites, meta.content_dir, | 264 | meta.relative_to_out = get_file_out(meta.rewrites, meta.content_dir, |
267 | meta.output_dir, meta.relative_to) | 265 | meta.output_dir, meta.relative_to) |
268 | 266 | ||
269 | meta.url = resolve_url(meta.site.url, meta.output_dir, meta.relative_to_out, | 267 | meta.url = resolve_url(meta.site.url, meta.output_dir, meta.relative_to_out, |
270 | meta.file_out) | 268 | meta.file_out) |
269 | if meta.preview ~= nil then | ||
270 | meta.preview = pandoc.utils.stringify(meta.preview) | ||
271 | meta.preview = meta.file_out:gsub("/index%.html$", "/" .. meta.preview) | ||
272 | meta.preview = resolve_url(meta.site.url, meta.output_dir, | ||
273 | meta.relative_to_out, meta.preview) | ||
274 | end | ||
271 | 275 | ||
272 | meta.date = format_date(meta.date) | 276 | meta.date = format_date(meta.date) |
273 | if meta.last_update ~= nil then | 277 | if meta.last_update ~= nil then |
diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index dfaa638..30f8a6c 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh | |||
@@ -7,7 +7,7 @@ inotifywait -qrme close_write,delete,move --format "%w%f" "${CONTENT_DIR%/}" \ | |||
7 | do | 7 | do |
8 | if [ -f "$file" ]; then | 8 | if [ -f "$file" ]; then |
9 | # scripts/build_content.sh "single" "$file" | 9 | # scripts/build_content.sh "single" "$file" |
10 | scripts/build_content.sh "all_md" | 10 | scripts/build_content.sh |
11 | elif [ ! -d "$file" ]; then | 11 | elif [ ! -d "$file" ]; then |
12 | scripts/build_content.sh "delete" "$file" | 12 | scripts/build_content.sh "delete" "$file" |
13 | fi | 13 | fi |