Merge branch 'tech'
This commit is contained in:
commit
b353d076fa
2
awk/getlinks.awk
Normal file
2
awk/getlinks.awk
Normal file
@ -0,0 +1,2 @@
|
||||
BEGIN{FS=","}
|
||||
{print "<a href=\"" $1 "\">" $2 "</a>"}
|
1
dat/links.csv
Normal file
1
dat/links.csv
Normal file
@ -0,0 +1 @@
|
||||
/,Home
|
|
@ -1,6 +1,8 @@
|
||||
dnl template.m4.html v1.4-p1
|
||||
dnl template.m4.html v2.0-p1
|
||||
dnl Part of the tape-and-string suite used to construct the website
|
||||
ifdef(`DEBUG',`traceon')dnl
|
||||
ifdef(`_INFILE',`dnl ',`errprint(`Macro _INFILE is not defined')
|
||||
m4exit(1)')dnl
|
||||
include(`m4/lib.m4')dnl
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@ -12,10 +14,10 @@ include(`m4/lib.m4')dnl
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<a href="/">Home</a>
|
||||
esyscmd(`awk -f awk/getlinks.awk dat/links.csv')dnl
|
||||
</div>
|
||||
<div class="content">
|
||||
include(`/dev/stdin')dnl Probably not a good idea, but whatever.
|
||||
esyscmd(`./tape.sh' _INFILE)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/ruby
|
||||
# pfiles.rb
|
||||
# v1.0-p2
|
||||
# v1.0-p3
|
||||
require 'find'
|
||||
ignore=!File.file?('ignore.txt') ? [] : File.readlines('ignore.txt')
|
||||
ignore=!File.file?('dat/ignore.txt') ? [] : File.readlines('dat/ignore.txt')
|
||||
if ignore != []
|
||||
ignore.map! do |i|
|
||||
"in/#{i}"
|
||||
|
32
render.sh
32
render.sh
@ -1,28 +1,14 @@
|
||||
#!/bin/bash
|
||||
# render.sh: part of the tape-and-string framework.
|
||||
# v3.3-p4
|
||||
# v3.4-p2
|
||||
#B: Load
|
||||
enable -f /usr/lib/bash/csv csv
|
||||
declare -A title
|
||||
#E: Load
|
||||
#B: Definition
|
||||
function inf { echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
||||
function wrn { echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
||||
function err { echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
|
||||
function tape {
|
||||
if test -d "$1"; then
|
||||
err "tape: Passed directory, $1"
|
||||
return 1
|
||||
fi
|
||||
case $1 in
|
||||
*.txti) redcloth "$1" ;;
|
||||
*.org) org-ruby --translate html "$1" ;;
|
||||
*.md) comrak --gfm "$1" ;;
|
||||
*.html) cat $1 ;;
|
||||
*.s[ac]ss) err "Told to render $1, shouldn't happen"; return 1 ;;
|
||||
*) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;;
|
||||
esac
|
||||
}
|
||||
function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
||||
function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
||||
function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
|
||||
function dirs {
|
||||
if test -d out; then
|
||||
wrn "Directory 'out' already exists."
|
||||
@ -49,9 +35,9 @@ function docs {
|
||||
o="${i/in/out}"
|
||||
echo "$i => $o"
|
||||
if test -z "${title[$i]}"; then
|
||||
tape $i | m4 -DCSSI=$(awk -f get_sd.awk <<< "$i") m4/main.html.m4 > ${o%.*}.html
|
||||
m4 -D_INFILE="$i" -DCSSI=$(awk -f awk/getsd.awk <<< "$i") m4/main.html.m4 > ${o%.*}.html
|
||||
else
|
||||
tape $i | m4 -DCSSI=$(awk -f get_sd.awk <<< "$i") -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html
|
||||
m4 -D_INFILE="$i" -DCSSI=$(awk -f awk/getsd.awk <<< "$i") -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html
|
||||
fi
|
||||
done
|
||||
}
|
||||
@ -71,7 +57,7 @@ function sass {
|
||||
o="${i/in/out}"
|
||||
o="${o/.s[ac]/.c}"
|
||||
echo "$i => $o"
|
||||
sassc -t expanded -a $i $o
|
||||
sassc -t expanded -a $i | sed '/^$/d' > $o
|
||||
done
|
||||
fi
|
||||
}
|
||||
@ -111,14 +97,14 @@ function info {
|
||||
while read -r ii; do
|
||||
csv -a i "$ii"
|
||||
title[in/${i[0]}]=${i[1]}
|
||||
done < title.csv
|
||||
done < dat/title.csv
|
||||
#E: Logic/LoadDefs/title
|
||||
unset ii
|
||||
#B: Logic/LoadDefs/ignore
|
||||
if test -f ignore.txt; then
|
||||
while read -r i; do
|
||||
ignore+=(in/$i)
|
||||
done < ignore.txt
|
||||
done < dat/ignore.txt
|
||||
fi
|
||||
#E: Logic/LoadDefs/ignore
|
||||
#E: Logic/LoadDefs
|
||||
|
22
tape.sh
Executable file
22
tape.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
||||
function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
||||
function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
|
||||
if test -d "$1"; then
|
||||
err "tape: Passed directory, $1"
|
||||
return 1
|
||||
elif test -z "$*"; then
|
||||
err "No files passed."
|
||||
exit 1
|
||||
fi
|
||||
case $1 in
|
||||
_INFILE) err "Passed raw macro."; exit 1;;
|
||||
*.txti) redcloth "$1" ;;
|
||||
*.org) org-ruby --translate html "$1" ;;
|
||||
*.md) comrak --gfm "$1" ;;
|
||||
*.html) cat $1 ;;
|
||||
*.s[ac]ss) err "Told to render $1, shouldn't happen"; exit 1 ;;
|
||||
*.sh) (inf "Running shellscript $1, I hope you know what you're doing..."; source $1 );;
|
||||
*) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user