From 73ea470f02ffc256b2abd5956cb38cf6a7ed8330 Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Sun, 9 Jul 2017 04:52:29 -0400 Subject: www/publish.sh: Fix conditionals for file matching Before the Makefile, publish.sh was executed on markdown source files using find(1), which happened like this: ./publish.sh ./index.md Now that we have a Makefile, this happens instead: ./publish.sh index.md Note that the file argument "index.md" in the first and second case both refer to the same file, yet they are different strings. This is important because publish.sh gives index.md (among other files) special treatment, and it does this by string comparison. Unfortunately, only the argument in the first case ("./index.md") will cause publish.sh to give special treatment, while the argumnent in the second case ("index.md") will not. To fix this, make it so that both "./index.md" and "index.md" trigger publish.sh's special handling. This commit also fixes the same issue for "docs/fdl-1.3.md" and "conduct.md". --- www/publish.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'www/publish.sh') diff --git a/www/publish.sh b/www/publish.sh index b1b1b405..9c3a4fcd 100755 --- a/www/publish.sh +++ b/www/publish.sh @@ -27,7 +27,9 @@ cat "$1" > "$TMPFILE" OPTS="-T Libreboot" -if [ "${FILE}" != "./index" ]; then +if [[ $FILE == "index" || $FILE == "./index" ]]; then + OPTS="--css /headercenter.css" +else if [[ $FILE == *suppliers ]] then RETURN="" @@ -42,15 +44,14 @@ if [ "${FILE}" != "./index" ]; then RETURN="Edit this page -- Back to previous index" OPTS="-T Libreboot" fi -else - OPTS="--css /headercenter.css" fi if [[ $FILE = *suppliers ]]; then printf '\n%s\n' "Edit this page -- Back to previous page" >> "$TMPFILE" fi -if [ "${FILE}" != "./docs/fdl-1.3" ] && [ "${FILE}" != "./conduct" ]; then +if [[ $FILE != "./docs/fdl-1.3" && $FILE != "docs/fdl-1.3" && + $FILE != "./conduct" && $FILE != "conduct" ]]; then cat footer.md >> "$TMPFILE" fi -- cgit v1.2.3-70-g09d2