Skip to content
Snippets Groups Projects
Commit 141c1e57 authored by Fabian Nuraddin Alexander Gabel's avatar Fabian Nuraddin Alexander Gabel :speech_balloon:
Browse files

minimal working example of static build

parent 19fa1eca
No related branches found
No related tags found
No related merge requests found
*build/
*deploy/
local/*
public/*
*/public/*
*.html
!static/forschung/*.html
!static/home/*.html
!static/topic/*.html
*.log
!testing/test_pandoc/*.html
!testing/test_create_html/*.html
*.swp
!*ref_*
#!/bin/bash
# building the a standalone static webpage
PROJECT_ROOT="/home/fabian/gitlab/gitlab-project-showroom"
PROJECT_BIN=$PROJECT_ROOT/bin
# Check commandline arguments
if [ $# -lt 1 ]
then
PROJECT_DEPLOY=`pwd`
PROJECT_TOPICS=`pwd`"/topics"
PROJECT_BUILD=`pwd`"/build"
echo -e "No deploy directory was specified."
# clean up directories
rm -rf $PROJECT_BUILD
rm -rf $PROJECT_DEPLOY/{.public,public}
elif [ $# -lt 2 ]
then
PROJECT_BUILD="$1"
PROJECT_TOPICS=$PROJECT_BUILD
PROJECT_BUILD="$1/build"
echo -e "No extra topics directory was specified."
# clean up directories
rm -rf $PROJECT_BUILD
rm -rf $PROJECT_DEPLOY/{.public,public}
elif [ $# -lt 3 ]
then
PROJECT_DEPLOY="$1"
PROJECT_TOPICS="$2"
PROJECT_BUILD="$1/build"
echo -e "No extra build directory was specified."
# clean up directories
rm -rf $PROJECT_BUILD
rm -rf $PROJECT_DEPLOY/{.public,public}
else
PROJECT_DEPLOY="$1"
PROJECT_TOPICS="$2"
PROJECT_BUILD="$3"
fi
# prepare directories / clean-up
mkdir -p $PROJECT_DEPLOY
mkdir -p $PROJECT_BUILD
cp -vf $PROJECT_TOPICS/*.md $PROJECT_BUILD
echo -e "Deploying to $PROJECT_DEPLOY ...;"
echo -e "Building into directory $PROJECT_BUILD ..."
echo -e "Using .md-files from $PROJECT_TOPICS ..."
# preprocess .md-files
#echo "Preproc Topics"
#$PROJECT_BIN/preproc_topics.sh $PROJECT_BUILD $PROJECT_TOPICS
# build html files
echo "Creating HTML Files with pandoc"
$PROJECT_BIN/create_html.sh $PROJECT_BUILD
# replace markers
#echo "Replacing markers"
#$PROJECT_BIN/replace_marker.sh $PROJECT_BUILD
#make public directory and copy files
mkdir -p $PROJECT_DEPLOY/.public
for f in $PROJECT_BUILD/*.html
do
filename=$(basename -- "$f")
cp $f $PROJECT_DEPLOY/.public/$filename
done
echo "Copying files to final destination ..."
cp -r $PROJECT_TOPICS/img $PROJECT_ROOT/css $PROJECT_DEPLOY/.public
mv -v $PROJECT_DEPLOY/.public $PROJECT_DEPLOY/public
echo "Done. Visit file://$PROJECT_DEPLOY/public/index.html ."
#!/bin/bash
# processing command line arguments
# Define variables
MATHJAX_URL='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
# Check commandline arguments
if [ $# -lt 1 ]
then
PROJECT_BUILD=`pwd`"/build"
PROJECT_TOPICS=`pwd`
echo -e "No building directory was specified."
elif [ $# -lt 2 ]
then
PROJECT_BUILD="$1"
PROJECT_TOPICS=$PROJECT_BUILD
echo -e "No extra topics directory was specified."
else
PROJECT_BUILD="$1"
PROJECT_TOPICS="$2"
fi
mkdir -p $PROJECT_BUILD
echo -e "Building into directory $PROJECT_BUILD ..."
echo -e "Using .md-files from $PROJECT_TOPICS ..."
# specify URL to avoid use of local library
# see https://docs.mathjax.org/en/latest/web/start.html#ways-of-accessing-mathjax
# and https://www.jsdelivr.com/package/npm/mathjax
for f in $PROJECT_TOPICS/*.md
do
filename=$(basename -- "$f")
pandoc --mathjax=$MATHJAX_URL --standalone \
-c $PROJECT_ROOT/css/pandoc.css $f -o $PROJECT_BUILD/"${filename%.md}".html
done
body {
margin: auto;
padding-right: 1em;
padding-left: 1em;
max-width: 44em;
border-left: 1px solid black;
border-right: 1px solid black;
color: black;
font-family: Verdana, sans-serif;
font-size: 100%;
line-height: 140%;
color: #333;
}
pre {
border: 1px dotted gray;
background-color: #ececec;
color: #1111111;
padding: 0.5em;
}
code {
font-family: monospace;
}
h1 a, h2 a, h3 a, h4 a, h5 a {
text-decoration: none;
color: #7a5ada;
}
h1, h2, h3, h4, h5 { font-family: verdana;
font-weight: bold;
border-bottom: 1px dotted black;
color: #7a5ada; }
h1 {
font-size: 130%;
}
h2 {
font-size: 110%;
}
h3 {
font-size: 95%;
}
h4 {
font-size: 90%;
font-style: italic;
}
h5 {
font-size: 90%;
font-style: italic;
}
h1.title {
font-size: 200%;
font-weight: bold;
padding-top: 0.2em;
padding-bottom: 0.2em;
text-align: left;
border: none;
}
dt code {
font-weight: bold;
}
dd p {
margin-top: 0;
}
img {
max-width: 100%;
height: auto;
}
#footer {
padding-top: 1em;
font-size: 70%;
color: gray;
text-align: center;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment