Added the html generator scripts

This commit is contained in:
TillDiem 2021-12-25 16:46:37 +01:00
parent 6685957cf3
commit 51915fade9
4 changed files with 127 additions and 0 deletions

BIN
GH.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

84
blogindex.css Normal file
View File

@ -0,0 +1,84 @@
body {
}
.abstract {
padding: 5px 0px 0px 5px;
}
.button1 {
background-color: white;
color: black;
border: 2px solid white;
/*padding: 7px 16px;*/
text-decoration: none;
font-size: 16px;
cursor: pointer;
float: right;
}
.button1:hover {
background-color: rgba(236, 240, 241, 1);
}
a {
text-decoration: none;
color: darkblue;
}
a.visited {
color: darkblue;
}
h1 {
text-align: center ;
}
h2 {
text-align: left ;
}
footer {
text-align: center ;
}
li{
margin: 0px 0 0 -5px;
}
.mainpart{
margin: auto ;
padding: 50px 0px ;
margin-bottom: 100px ;
max-width: 1000px;
font-size: 14pt;
}
p {
line-height: 1.2;
}
@media only screen and (min-width: 920px) {
/* For tablets: */
li {margin: 0px 0 0 0;}
.mainpart {
font-size: 14pt;
max-width: 1000px;
}
table { border: 2px solid #dddddd;
font-size: 14pt;
}
}
@media only screen and (min-width: 1000px) {
/* For desktop: */
li {margin: 0px 0 0 0;}
.mainpart {font-size: 14pt; }
table { border: 2px solid #dddddd;
font-size: 14pt;
}
}

15
template.html Normal file
View File

@ -0,0 +1,15 @@
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel="stylesheet" href="/blogpost.css" />
<title>mykb - Knowledgebase for Arch Setups</title></head>
<body>
<div class="mainpart">
<header><a href="http://mykb.dieminger.ch" style="text-decoration: none; color:black;"><h1 class="MAIN">mykb - A collection of random software</a> <a href="https://github.com/alexbocken/mykb"><img src="/GH.png" height=22/></a></h1></header>
<nav></nav>
$body$
</div>
</body>
</html>

28
wikihtml.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
FORCE="$1"
SYNTAX="$2"
EXTENSION="$3"
OUTPUTDIR="$4"
INPUT="$5"
CSSFILE="$6"
FILE=$(basename "$INPUT")
FILENAME=$(basename "$INPUT" .$EXTENSION)
FILEPATH=${INPUT%$FILE}
OUTDIR=${OUTPUTDIR%$FILEPATH*}
OUTPUT="$OUTDIR"/$FILENAME
#CSSFILENAME=$(basename "$6")
CSSFILENAME=~/blogpost.css
NAME=$(echo $FILE | sed "s/.md//g")
HAS_MATH=$(grep -o "\$\$.\+\$\$" "$INPUT")
if [ ! -z "$HAS_MATH" ]; then
MATH="--mathjax=https://cdn.jsdelivr.net/npm/mathjax@3.0.1/es5/tex-mml-chtml.js"
else
MATH=""
fi
sed -r 's/(\[.+\])\(([^)]+)\)/\1(\2.html)/g' <"$INPUT" | sed -r 's/^[ ]*\*/-/g' | sed -r 's/^[ \t]\*/-/g' | sed 's/\.md.html)/.html)/g' | pandoc $MATH -s -f $SYNTAX -t html -c $CSSFILENAME --template ~/template.html --metadata title=$NAME >"$OUTPUT.html"