Prep fixing sticky element, and WIP hex injection

This commit is contained in:
Stephen Cochrane 2021-04-22 22:50:01 +02:00
parent 0835b64723
commit 5ff37496a1
2 changed files with 22 additions and 4 deletions

View File

@ -2,6 +2,19 @@
# Auther: Skiqqy # Auther: Skiqqy
HOST="https://github.com/" HOST="https://github.com/"
quote=false # True injects a qoute in hex
# Find a qoute and transform to hex, replaceing newlines with \n
quote ()
{
if "$quote"
then
res=$(printf 'C is quirky, flawed, and an enormous success.\n Dennis M. Ritchie' |
hexdump -e '8/1 " %02X" "\n"')
printf '%s' "${res//$'\n'/\\n}"
return
fi
}
conv () { conv () {
# Take a file and convert it to html by making substitutes. # Take a file and convert it to html by making substitutes.
@ -21,6 +34,7 @@ conv () {
sed -E '/%%BODY%%/r /dev/stdin' raw/template.html | sed -E '/%%BODY%%/r /dev/stdin' raw/template.html |
sed -E '/%%BODY%%/d' | sed -E '/%%BODY%%/d' |
sed -E "s|%%QUOTE%%|$(quote)|g" |
sed 's/%%HEADER%%/'"$header"'/g' sed 's/%%HEADER%%/'"$header"'/g'
} }
@ -46,7 +60,7 @@ main () {
header="<h1>Skiqqy<\/h1>~ Pronounced skippy" header="<h1>Skiqqy<\/h1>~ Pronounced skippy"
;; ;;
*) *)
header="<h1>$(echo $file | cut -d "/" -f 2 | cut -d "." -f 1)<\/h1>" header="<h1>$(echo "$file" | cut -d "/" -f 2 | cut -d "." -f 1)<\/h1>"
path=${file/raw/site} path=${file/raw/site}
path=${path/txt/html} path=${path/txt/html}
;; ;;
@ -54,7 +68,7 @@ main () {
[[ -n $dev ]] && header="$header$dev" [[ -n $dev ]] && header="$header$dev"
echo "Building $file" echo "Building $file"
conv < "$file" > $path conv < "$file" > "$path"
done done
} }

View File

@ -23,7 +23,9 @@
} }
.c{ .c{
display:table-cell;max-width:999px;max-width:80ch display:table-cell;
max-width:999px;
max-width:80ch
} }
pre{ pre{
@ -71,7 +73,9 @@
} }
</style> </style>
<div class="header">%%HEADER%%</div> <div class="header">%%HEADER%%</div>
<div style="text-align:center;display:table;margin:16px auto"><div class=c><pre style="top:0;position:sticky;user-select:none"> <center><pre>%%QUOTE%%</pre></center>
<div style="text-align:left;display:table;margin:16px auto">
<div class=c><pre style="top:0;position:sticky;user-select:none">
Portals: Portals:
<a href=/>Home</a> <a href=/>Home</a>