diff --git a/scripts/add-matrix-org-stylings.sh b/scripts/add-matrix-org-stylings.sh index 9a9256b2f..f8edd6acc 100755 --- a/scripts/add-matrix-org-stylings.sh +++ b/scripts/add-matrix-org-stylings.sh @@ -1,26 +1,27 @@ #!/bin/bash -eu -if [[ $# != 1 || ! -d $1 ]]; then - echo >&2 "Usage: $0 include_dir" +if [[ $# == 0 || ! -d $1 ]]; then + echo >&2 "Usage: $0 include_dir file_to_replace..." exit 1 fi -HEADER="$1/head.html" -NAV_BAR="$1/nav.html" -FOOTER="$1/footer.html" +include_dir="$1" +shift -for f in "$1"/{head,nav,footer}.html; do +HEADER="${include_dir}/head.html" +NAV_BAR="${include_dir}/nav.html" +FOOTER="${include_dir}/footer.html" + +for f in "${include_dir}"/{head,nav,footer}.html; do if [[ ! -e "${f}" ]]; then echo >&2 "Need ${f} to exist" exit 1 fi done -files=gen/*.html - perl -MFile::Slurp -pi -e 'BEGIN { $header = read_file("'$HEADER'") } s#
#$header -#' ${files} +#' "$@" perl -MFile::Slurp -pi -e 'BEGIN { $nav = read_file("'$NAV_BAR'") } s##