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
|
dnl Part of the tape-and-string suite used to construct the website
|
||||||
ifdef(`DEBUG',`traceon')dnl
|
ifdef(`DEBUG',`traceon')dnl
|
||||||
|
ifdef(`_INFILE',`dnl ',`errprint(`Macro _INFILE is not defined')
|
||||||
|
m4exit(1)')dnl
|
||||||
include(`m4/lib.m4')dnl
|
include(`m4/lib.m4')dnl
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@ -12,10 +14,10 @@ include(`m4/lib.m4')dnl
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<a href="/">Home</a>
|
esyscmd(`awk -f awk/getlinks.awk dat/links.csv')dnl
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
include(`/dev/stdin')dnl Probably not a good idea, but whatever.
|
esyscmd(`./tape.sh' _INFILE)
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/ruby
|
#!/usr/bin/ruby
|
||||||
# pfiles.rb
|
# pfiles.rb
|
||||||
# v1.0-p2
|
# v1.0-p3
|
||||||
require 'find'
|
require 'find'
|
||||||
ignore=!File.file?('ignore.txt') ? [] : File.readlines('ignore.txt')
|
ignore=!File.file?('dat/ignore.txt') ? [] : File.readlines('dat/ignore.txt')
|
||||||
if ignore != []
|
if ignore != []
|
||||||
ignore.map! do |i|
|
ignore.map! do |i|
|
||||||
"in/#{i}"
|
"in/#{i}"
|
||||||
|
50
render.sh
50
render.sh
@ -1,28 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# render.sh: part of the tape-and-string framework.
|
# render.sh: part of the tape-and-string framework.
|
||||||
# v3.3-p4
|
# v3.4-p2
|
||||||
#B: Load
|
#B: Load
|
||||||
enable -f /usr/lib/bash/csv csv
|
enable -f /usr/lib/bash/csv csv
|
||||||
declare -A title
|
declare -A title
|
||||||
#E: Load
|
#E: Load
|
||||||
#B: Definition
|
#B: Definition
|
||||||
function inf { echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
||||||
function wrn { echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
||||||
function err { echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
|
function err { 1>&2 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 dirs {
|
function dirs {
|
||||||
if test -d out; then
|
if test -d out; then
|
||||||
wrn "Directory 'out' already exists."
|
wrn "Directory 'out' already exists."
|
||||||
@ -49,9 +35,9 @@ function docs {
|
|||||||
o="${i/in/out}"
|
o="${i/in/out}"
|
||||||
echo "$i => $o"
|
echo "$i => $o"
|
||||||
if test -z "${title[$i]}"; then
|
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
|
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
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -71,7 +57,7 @@ function sass {
|
|||||||
o="${i/in/out}"
|
o="${i/in/out}"
|
||||||
o="${o/.s[ac]/.c}"
|
o="${o/.s[ac]/.c}"
|
||||||
echo "$i => $o"
|
echo "$i => $o"
|
||||||
sassc -t expanded -a $i $o
|
sassc -t expanded -a $i | sed '/^$/d' > $o
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -111,14 +97,14 @@ function info {
|
|||||||
while read -r ii; do
|
while read -r ii; do
|
||||||
csv -a i "$ii"
|
csv -a i "$ii"
|
||||||
title[in/${i[0]}]=${i[1]}
|
title[in/${i[0]}]=${i[1]}
|
||||||
done < title.csv
|
done < dat/title.csv
|
||||||
#E: Logic/LoadDefs/title
|
#E: Logic/LoadDefs/title
|
||||||
unset ii
|
unset ii
|
||||||
#B: Logic/LoadDefs/ignore
|
#B: Logic/LoadDefs/ignore
|
||||||
if test -f ignore.txt; then
|
if test -f ignore.txt; then
|
||||||
while read -r i; do
|
while read -r i; do
|
||||||
ignore+=(in/$i)
|
ignore+=(in/$i)
|
||||||
done < ignore.txt
|
done < dat/ignore.txt
|
||||||
fi
|
fi
|
||||||
#E: Logic/LoadDefs/ignore
|
#E: Logic/LoadDefs/ignore
|
||||||
#E: Logic/LoadDefs
|
#E: Logic/LoadDefs
|
||||||
@ -127,15 +113,15 @@ if test -z "$*"; then
|
|||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
case $1 in
|
case $1 in
|
||||||
dir) dirs;;
|
dir) dirs;;
|
||||||
doc) docs;;
|
doc) docs;;
|
||||||
s[ac]ss) sass;;
|
s[ac]ss) sass;;
|
||||||
other) other;;
|
other) other;;
|
||||||
rest) other;;
|
rest) other;;
|
||||||
info) info;;
|
info) info;;
|
||||||
vall) info; all;;
|
vall) info; all;;
|
||||||
all) all;;
|
all) all;;
|
||||||
*) all;;
|
*) all;;
|
||||||
esac
|
esac
|
||||||
#E: Logic
|
#E: Logic
|
||||||
exit $?
|
exit $?
|
||||||
|
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