Commit 700abbc3 authored by Fabian Nuraddin Alexander Gabel's avatar Fabian Nuraddin Alexander Gabel 💬
Browse files

rewrite build_webpage

parent 2664df54
Pipeline #116645 passed with stages
in 40 seconds
#!/bin/bash
############################################################
# Command line help
usage="Usage: $(basename "$0") [OPTION]...
build the files for tuhh-delivery, review apps and deployment locally.
# build the files for tuhh-delivery, review apps and deployment locally
#
# Structure
#
# tuhh-build/
# ├── forschung
# │ ├── aa/forschung.html
# │ ├── cm/forschung.html
# │ ├── dm/forschung.html
# │ ├── nm/forschung.html
# │ ├── st/forschung.html
# | └── topics
# | ├── img
# | │ ├── BO_BDO.jpg
# | │ ├── controlimex.png
# | │ └── webpage-example.png
# | ├── topic.html
# | └── Zemke_Hessenberg.html
# ├── home
# │ ├── ataraz.html
# │ ├── cseifert.html
# │ └── ymogge.html
#
#
# Check commandline arguments
Note: mat.tuhh.de uses WINDOWS-1252 character encoding
OPTIONs:
-h, --help show this help text and exit
-b, --build where the procesing takes place (default: '' in-place)
-d, --debug retain all intermediate files for debugging purposes
-p, --prefix add path or filename prefix to html link (default: '')
-t, --topics where the topics files will reside
Using the options -t, s and -w will create suitable subdirectories in the directory specified with -b.
The option -p is necessary if the webpage will not be deployed on the server root but in a subdirectory.
Examples:
$(basename "$0") aperiodSchr.md
$(basename "$0") -d -b build -t /forschung/topics/ -w /forschung/ -p /e10/research aperiodSchr.md"
############################################################
#!/bin/bash
RESEARCH_BIN=$RESEARCH_ROOT/bin
RESEARCH_STATIC=$RESEARCH_ROOT/static
PROJECT_PATH=""
if [ $# -lt 1 ]
then
RESEARCH_BUILD=$RESEARCH_ROOT/build
PROJECT_ROOT="" #standard if webpage is deployed at root
elif [ $# -lt 2 ]
then
RESEARCH_DEPLOY=$1
PROJECT_ROOT=""
elif [ $# -lt 3 ]
then
RESEARCH_DEPLOY=$1
PROJECT_ROOT=$2
else
RESEARCH_DEPLOY=$1
PROJECT_ROOT=$2 # full path
PROJECT_PATH=$3 # path without web root
fi
#echo "Deploying to $RESEARCH_DEPLOY."
#echo "Using PROJECT_ROOT=$PROJECT_ROOT"
rm -rf $RESEARCH_BUILD $RESEARCH_DEPLOY && mkdir $RESEARCH_BUILD
#mkdir -p $RESEARCH_BUILD $RESEARCH_DEPLOY $RESEARCH_DEPLOY/include
RESEARCH_BUILD=`pwd`"/build"
RESEARCH_TOPICS=$RESEARCH_ROOT/topics
DEBUG_MODE="False"
while getopts ':hdb:s:t:w:p:' option; do
case "$option" in
h | --help) echo "$usage"
exit
;;
b | --build) RESEARCH_BUILD=$OPTARG
;;
d | --debug) DEBUG_MODE="True"
;;
t | --topics) RESEARCH_TOPICS=$OPTARG
;;
p | --prefix) PROJECT_ROOT=$OPTARG
;;
:) printf "missing argument for -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
esac
done
echo "Building into $RESEARCH_BUILD ..."
rm -rf $RESEARCH_BUILD && mkdir $RESEARCH_BUILD
echo "Preprocessing Topics..."
for f in $RESEARCH_ROOT/test_topics/*.md
for f in $RESEARCH_TOPICS/*.md
do
filename=$(basename -- "$f")
$RESEARCH_BIN/preproc_topic.sh -b "$RESEARCH_BUILD" \
......@@ -83,7 +88,7 @@ do
# replace h2 tag by div
sed -i -e "s;<h2\(.*\)>\(.*\)</h2.*>;<div\1>\2</div>;g" \
$RESEARCH_BUILD/home/${filename%.md}_research.html
$RESEARCH_BUILD/home/${filename%.md}.html
rm -rf $RESEARCH_BUILD/home/$filename
done
......@@ -96,7 +101,7 @@ do
$RESEARCH_BUILD/forschung/$wg/$filename >> $RESEARCH_BUILD/build.log 2>&1
sed -i -e "s;<h2\(.*\)>\(.*\)</h2.*>;<div\1>\2</div>;g" \
$RESEARCH_BUILD/forschung/$wg/${filename%.md}_research.html
$RESEARCH_BUILD/forschung/$wg/${filename%.md}.html
rm -rf $RESEARCH_BUILD/forschung/$wg/$filename
done
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment