change arguments

This commit is contained in:
slonkazoid 2024-12-28 21:25:51 +03:00
parent 9cb637facd
commit f027208f58
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
2 changed files with 13 additions and 4 deletions

View file

@ -95,6 +95,12 @@ run `blag` on your post:
Mon Dec 16 22:42:00 +03 2024</p>
```
### arguments
blagposts rendered with the blag script will have arguments much like a regular
shellscript, except you should reference `$path` instead of `$0` when getting
the script path. `$0` is the path of blag itself.
## bingus-blog integration
set `engine = "blag"` in your configuration file. the naming format is
@ -142,7 +148,7 @@ APIs in blag (do not do this).
due to how blag works, the hash of the query params is stored alongside the
mtime of the post file. you can only tell bingus-blog "hey, don't cache me!"
from a post, but sometimes you need to invalidate the existing cache for all
query param combinations. to do that, `touch -c "$1"` from your post file.
query param combinations. to do that, `touch -c "$path"` from your post file.
this sets the mtime for the post to right now, invalidating the reference to
it as bingus-blog believes that the contents have changed.

9
blag
View file

@ -87,14 +87,17 @@ codeblock() {
}
render() {(
birth=$(stat -c'%W' "$1")
path=$1
shift
birth=$(stat -c'%W' "$path")
if (( birth > 0 )); then
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
fi
MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$1")")
MODIFIED_AT=$(date --rfc-3339=seconds -d "@$(stat -c '%Y' "$path")")
#shellcheck disable=SC1090
. "$1"
. "$path" "$@"
)}
print_help() {