diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index baa189efef04c65d506a9e9280fce6ae314d88a2..5b00bc8bb36506d8b7d5815ef68b67714c43d287 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,7 @@ preprocessing: name: alpine:latest script: - apk add --no-cache --upgrade bash + # preprocess .MD files - ./preprocMd.sh - ./preprocIndexMd.sh artifacts: diff --git a/preprocIndexMd.sh b/preprocIndexMd.sh index 07970465bae90f7bb5fab38801e6938446902bfb..461f1513b1c26e1285e5b227f157d99856313b5e 100755 --- a/preprocIndexMd.sh +++ b/preprocIndexMd.sh @@ -1,9 +1,9 @@ #!/bin/bash # generate namelist of collaborators from topic file -original="index.md" -filename="index-output.md" -build_dir="." +original="./build/index.md" +filename="index.md" +build_dir="./build" baseurl='https://www.mat.tuhh.de' #make output copy @@ -30,7 +30,7 @@ do # -> grep the line with the <h1>-tag, something like <h1>Fabian Gabel, M. Sc.</h1><div class='staffIntro'><p><img src='/home/fgabel/images/portrait.png' title='Foto von Fabian Gabel, M. Sc.' class='staffPicture'></p><div class='staffContact'> # -> strip the string such that only the portion between <h1></h1> remains # -> remove leading spaces - fullname=`wget -qO- $baseurl/home/$name/?homepage_id=$name | grep h1 | sed -e "s/<h1>\s*\(.*\)<\/h1>.*$/\1/g" | sed -e 's/^[ \t]*//'` + fullname=`wget -qO- $baseurl/home/$name/?homepage_id=$name | grep h1 | sed -e "s|<h1>\s*\(.*\)</h1>.*$|\1|g" | sed -e 's|^[ \t]*||'` # dirty replacement to avoid dealing with errstr='Binary file (standard input) matches' @@ -45,8 +45,7 @@ do fi echo "Found collaborator $fullname" - - # replace name in .md file - sed -i "s;$name;\[$fullname\]($baseurl/home/$name);g" $build_dir/$filename - + # append research to index + title="## `head -n 1 $build_dir/$filename | sed -e "s;#\s*;\[;g" -e "s;\(.*\);\1\](${filename%.md}.html);g"`" + echo $itle >> ./build/index.md done