change arguments
This commit is contained in:
parent
9cb637facd
commit
f027208f58
2 changed files with 13 additions and 4 deletions
|
@ -95,6 +95,12 @@ run `blag` on your post:
|
||||||
Mon Dec 16 22:42:00 +03 2024</p>
|
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
|
## bingus-blog integration
|
||||||
|
|
||||||
set `engine = "blag"` in your configuration file. the naming format is
|
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
|
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!"
|
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
|
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
|
this sets the mtime for the post to right now, invalidating the reference to
|
||||||
it as bingus-blog believes that the contents have changed.
|
it as bingus-blog believes that the contents have changed.
|
||||||
|
|
||||||
|
|
9
blag
9
blag
|
@ -87,14 +87,17 @@ codeblock() {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {(
|
render() {(
|
||||||
birth=$(stat -c'%W' "$1")
|
path=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
birth=$(stat -c'%W' "$path")
|
||||||
if (( birth > 0 )); then
|
if (( birth > 0 )); then
|
||||||
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
|
CREATED_AT=$(date --rfc-3339=seconds -d "@$birth")
|
||||||
fi
|
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
|
#shellcheck disable=SC1090
|
||||||
. "$1"
|
. "$path" "$@"
|
||||||
)}
|
)}
|
||||||
|
|
||||||
print_help() {
|
print_help() {
|
||||||
|
|
Loading…
Reference in a new issue