implemented link templating, finally.

This commit is contained in:
Atlas Cove 2023-02-17 18:17:33 +00:00
parent 22fac1e502
commit f6f49aa315
8 changed files with 12 additions and 9 deletions

2
awk/getlinks.awk Normal file
View File

@ -0,0 +1,2 @@
BEGIN{FS=","}
{print "<a href=\"" $1 "\">" $2 "</a>"}

1
dat/links.csv Normal file
View File

@ -0,0 +1 @@
/,Home
1 / Home

View File

@ -14,7 +14,7 @@ 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">
esyscmd(`./tape.sh' _INFILE)

View File

@ -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}"

View File

@ -1,6 +1,6 @@
#!/bin/bash
# render.sh: part of the tape-and-string framework.
# v3.4-p1
# v3.4-p2
#B: Load
enable -f /usr/lib/bash/csv csv
declare -A title
@ -35,9 +35,9 @@ function docs {
o="${i/in/out}"
echo "$i => $o"
if test -z "${title[$i]}"; then
m4 -D_INFILE="$i" -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
m4 -D_INFILE="$i" -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
}
@ -57,7 +57,7 @@ function sass {
o="${i/in/out}"
o="${o/.s[ac]/.c}"
echo "$i => $o"
sassc -t expanded -a $i | sed 'g/^$/d' > $o
sassc -t expanded -a $i | sed '/^$/d' > $o
done
fi
}
@ -97,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