build: Update to marsh 0.8.1.

This commit is contained in:
Bradley Sepos 2021-12-26 14:14:57 -05:00
parent 737b0e25d0
commit f1f26d8cd3
No known key found for this signature in database
GPG Key ID: DEADE2F57D42D9C7

24
marsh
View File

@ -1,12 +1,12 @@
#!/bin/bash
# marsh - build static websites using markdown and bash
#
# Copyright 2018 Bradley Sepos
# Copyright 2021 Bradley Sepos
# Released under the MIT License. See LICENSE for details.
# https://github.com/bradleysepos/marsh
NAME="marsh"
VERSION="0.8.0"
VERSION="0.8.1"
SELF="${BASH_SOURCE[0]}"
SELF_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd -P)
SELF_DIR="${SELF_DIR:-$(pwd)}"
@ -1089,7 +1089,7 @@ function build_template { # build_template dest_dir target_dir document templat
for ITEM in ${LIST[@]}; do
cp "${FILE}" "${FILE_TEMP}"
<"${FILE_TEMP}" \
awk '/^[ ]*\{\%[ ]*if[ ]+'${TAG//\./\.}'[ ]+'${COMPARITOR// /[ ]+}'[ ]+"'${ITEM}'"[ ]*\%\}[ ]*$/ {
awk '/^[ ]*\{%[ ]*if[ ]+'${TAG//\./\.}'[ ]+'${COMPARITOR// /[ ]+}'[ ]+"'${ITEM}'"[ ]*%\}[ ]*$/ {
tag=1;
line=1;
delete buffer;
@ -1097,16 +1097,16 @@ function build_template { # build_template dest_dir target_dir document templat
{
buffer[line++]=$0;
}
(tag==1 && (/^[ ]*\{\%[ ]*endif[ ]*\%\}[ ]*$/ || /^[ ]*\{\%[ ]*else[ ]*\%\}[ ]*$/)) {
(tag==1 && (/^[ ]*\{%[ ]*endif[ ]*%\}[ ]*$/ || /^[ ]*\{%[ ]*else[ ]*%\}[ ]*$/)) {
for (i=2; i < line-1; i++) {
print buffer[i];
}
}
(tag>0 && /^[ ]*\{\%[ ]*else[ ]*\%\}[ ]*$/) {
(tag>0 && /^[ ]*\{%[ ]*else[ ]*%\}[ ]*$/) {
tag=2;
next;
}
(tag>0 && /^[ ]*\{\%[ ]*endif[ ]*\%\}[ ]*$/) {
(tag>0 && /^[ ]*\{%[ ]*endif[ ]*%\}[ ]*$/) {
tag=0;
next;
}
@ -1118,7 +1118,7 @@ function build_template { # build_template dest_dir target_dir document templat
# process else
cp "${FILE}" "${FILE_TEMP}"
<"${FILE_TEMP}" \
awk '/^[ ]*\{\%[ ]*if[ ]+'${TAG//\./\.}'[ ]+'${COMPARITOR// /[ ]+}'[ ]+".+"[ ]*\%\}[ ]*$/ {
awk '/^[ ]*\{%[ ]*if[ ]+'${TAG//\./\.}'[ ]+'${COMPARITOR// /[ ]+}'[ ]+".+"[ ]*%\}[ ]*$/ {
tag=1;
line=1;
delete buffer;
@ -1129,16 +1129,16 @@ function build_template { # build_template dest_dir target_dir document templat
(tag==1) {
delete buffer;
}
(tag==2 && /^[ ]*\{\%[ ]*endif[ ]*\%\}[ ]*$/) {
(tag==2 && /^[ ]*\{%[ ]*endif[ ]*%\}[ ]*$/) {
for (i=2; i < line-1; i++) {
print buffer[i];
}
}
(tag>0 && /^[ ]*\{\%[ ]*else[ ]*\%\}[ ]*$/) {
(tag>0 && /^[ ]*\{%[ ]*else[ ]*%\}[ ]*$/) {
tag=2;
next;
}
(tag>0 && /^[ ]*\{\%[ ]*endif[ ]*\%\}[ ]*$/) {
(tag>0 && /^[ ]*\{%[ ]*endif[ ]*%\}[ ]*$/) {
tag=0;
next;
}
@ -1154,7 +1154,7 @@ function build_template { # build_template dest_dir target_dir document templat
FILE_TEMP=$(mktemp "${MARSH_TEMP}/conditional-XXXXXX")
# remove unsupported conditionals
cp "${FILE}" "${FILE_TEMP}"
<"${FILE_TEMP}" awk '/^[ ]*\{\%[ ]*if[^%]+\%\}[ ]*$/ {k=1;i=1;delete a} {a[i++]=$0} (k==1 && /^[ ]*\{\%[ ]*endif[ ]*\%\}[ ]*$/) {k=0;next} (k==0) { print }' > "${FILE}"
<"${FILE_TEMP}" awk '/^[ ]*\{%[ ]*if[^%]+%\}[ ]*$/ {k=1;i=1;delete a} {a[i++]=$0} (k==1 && /^[ ]*\{%[ ]*endif[ ]*%\}[ ]*$/) {k=0;next} (k==0) { print }' > "${FILE}"
return 0
}
@ -2233,7 +2233,7 @@ for I in "${!MARKDOWN_OPTIONS[@]}"; do
done
OIFS="${IFS}"
IFS=$'\n'
MARKDOWN_UNKNOWN=($(echo "test options" | "${MARKDOWN}" ${MARKDOWN_OPTIONS[@]} -VV 2>&1 >/dev/null | grep -i "unknown" | sed -E -e 's/^markdown: unknown option <([^>]+)>$/\1/'))
MARKDOWN_UNKNOWN=($("${MARKDOWN}" ${MARKDOWN_OPTIONS[@]} -VV 2>&1 >/dev/null | grep -i "unknown" | sed -E -e 's/^markdown: unknown option <([^>]+)>$/\1/'))
IFS="${OIFS}"
if [[ "${#MARKDOWN_UNKNOWN[@]}" -gt 0 ]]; then
echo -n "Unknown markdown options:" >&2