diff options
author | EuAndreh <eu@euandre.org> | 2025-04-09 17:10:45 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-04-09 17:10:45 -0300 |
commit | 0d29cc71734dbc96e0e76ccdaa640aba957f3ec8 (patch) | |
tree | 6e76c30b021c3bdf1f48a91d69d6f3c8ea98cedc /src/conf | |
parent | src/links: Add new working subcommand (diff) | |
download | mkwb-0d29cc71734dbc96e0e76ccdaa640aba957f3ec8.tar.gz mkwb-0d29cc71734dbc96e0e76ccdaa640aba957f3ec8.tar.xz |
src/conf: Extract embedded-config from document header variables
Diffstat (limited to 'src/conf')
-rwxr-xr-x | src/conf | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -92,13 +92,14 @@ eval "$(assert-arg -- "$FILENAME" 'FILENAME')" trap 'rm -f -- "$FILENAME".embedded-config' EXIT -{ - if head -n1 -- "$FILENAME" | grep -q '^////$'; then - awk 'sep > 1 {exit}; /^\/{4}$/ { sep++; next } { print }' \ - "$FILENAME" - fi -} > "$FILENAME".embedded-config -. "$(realpath -- "$FILENAME".embedded-config)" +awk ' +$0 == "" {exit} +/^= / {next} +{ printf "export %s=\"%s\"\n", + substr($1, 2, length($1) - 2), + substr($0, length($1) + 2) } +' "$FILENAME" > "$FILENAME".embedded-config +. ./"$FILENAME".embedded-config is_article() { printf '%s\n' "$FILENAME" | grep -qE \ |