Added variable CSS support.

This commit is contained in:
Atlas Cove 2023-02-11 18:00:31 +00:00
parent 73989bbb7e
commit c2ca1e0e42
5 changed files with 19 additions and 16 deletions

View File

@ -7,7 +7,7 @@ insert_final_newline=true
[{Makefile,*.s[ac]ss}]
indent_style=tab
indent_size=1
[{ignore.txt,*.csv}]
[{ignore.txt,*.csv,m4/*}]
insert_final_newline=false
[*.rb]
indent_style=space

View File

@ -1,4 +1,7 @@
#!/usr/bin/awk
BEGIN{FS="/";x=2}
function none() {print "main";exit}
NF==1{none()}
/\.\//{x++}
{gsub($0,"./","");print $x;exit}
$x~/\.(txti|html|org|md)/{none()}
{if($x=="dnd")none();print $x;exit}

View File

@ -1,5 +1,6 @@
divert(-1)
# extra macros for site structure
define(`ytv',`<iframe width="ifdef(`$3',$1,560)" height="ifdef(`$3',$3,315)" src="$1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>')
define(`wrap',<$1>$2</$1>)
divert
define(`_ytv',`<iframe width="ifdef(`$3',$1,560)" height="ifdef(`$3',$3,315)" src="$1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>')
define(`_wrap',<$1>$2</$1>)
define(`_empty',`')
divert dnl

View File

@ -1,14 +1,12 @@
dnl template.m4.html v1.3-p1
dnl template.m4.html v1.4-p1
dnl Part of the tape-and-string suite used to construct the website
ifdef(`DEBUG',`traceon')dnl
include(`m4/lib.m4')dnl
ifdef(`CSS_INC',`', define(`CSS_INC', `main'))dnl
ifelse(CSS_INC,`dnd',define(`CSS_INC',`main'))dnl
define(`_CSS',`/css/CSS_INC.css')dnl
<!DOCTYPE html>
<html>
<head>
<style>
@import url("_CSS");
@import url("/css/CSSI().css'");
</style>
<title>TITLE</title>
</head>
@ -17,7 +15,8 @@ define(`_CSS',`/css/CSS_INC.css')dnl
<a href="/">Home</a>
</div>
<div class="content">
include(`/dev/stdin')dnl Probably not a good idea, but whatever.
temp
dnl include(`/dev/stdin')dnl Probably not a good idea, but whatever.
</div>
</body>
</html>

View File

@ -1,6 +1,6 @@
#!/bin/bash
# render.sh: part of the tape-and-string framework.
# v3.3-p1
# v3.3-p2
#B: Load
enable -f /usr/lib/bash/csv csv
declare -A title
@ -56,9 +56,9 @@ function docs {
o="${i/in/out}"
echo "$i => $o"
if test -z "${title[$i]}"; then
tape $i | m4 -DCSS_INC=$(awk -f get_sd.awk "$i") m4/main.html.m4 > ${o%.*}.html
tape $i | m4 -DCSSI=$(awk -f get_sd.awk <<< "$i") m4/main.html.m4 > ${o%.*}.html
else
tape $i | m4 -DCSS_INC=$(awk -f get_sd.awk "$i") -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html
tape $i | m4 -DCSSI=$(awk -f get_sd.awk <<< "$i") -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html
fi
done
}