ref: 5e1c7121ff505582d217e60d92fa6ff724e9dc53
dir: /mkfile/
PATHS=`{ls *.ht | sed -e 's/\.ht$//g' | grep -v 'index' | grep -v 'changeblog/';ls changeblog/*.txt | sed -e 's/\.txt$//g'}
BLOGHT=`{ls -r changeblog/*.txt | sed -e 's/\.txt$/.ht/g'}
BLOGMS=`{ls -r changeblog/*.txt | sed -e 's/\.txt$/.ms/g'}
BLOG=`{echo $BLOGHT; echo $BLOGMS}
OBJECTS=`{echo 'pub/'^$PATHS^'/index.html'}
DOMAIN='https://sirjofri.de/'
nl='
'
dfmt='WW, D MMM YY hh:mm:ss ZZZ'
year=`{date -f YYYY | tr -d $nl}
build:V: changeblog.ht $OBJECTS pub/index.html pub/changeblog.xml pub/changeblog.plain.xml pub/changeblog/changeblog.pdf
echo 'Build complete'
prepare:QV: changeblog.ht
echo 'Prepare complete'
mk build
pub/changeblog/changeblog.pdf:Q: $BLOGMS
{
echo '.TL
sirjofri.de changeblog'
for(i in $prereq){
echo '.PP
.PP
.B'
echo `"{date -f $dfmt `{basename $i | sed 's:\.ms$::g' | tr -d $nl}}^:
echo .R
cat $i
echo
echo .bp
}
} | troff -ms | lp -dstdout | ps2pdf > $target
echo '√ '^$target^' created'
pub/changeblog.xml:Q: $BLOGHT
{
echo '<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<author>
<name>sirjofri</name>
<email>sirjofri@sirjofri.de</email>
</author>
<link rel="self" href="'^$DOMAIN^'changeblog.xml"/>
<rights>© Copyright '^$"year^' sirjofri</rights>
<id>'^$"DOMAIN^'</id>
<title>changeblog</title>
<updated>'^`"{date -t | tr -d $nl}^'</updated>'
for(i in $prereq){
ifs=''
sourcefile=`{echo $i | sed 's/ht$/txt/g' | tr -d $nl}
title=`{sed '2q' $sourcefile | tr -d $nl}
content=`{./txt2html $i | cat}
link=$DOMAIN^`{echo -n $i | sed 's:\.ht$:/:' | tr -d $nl}
updated=`{date -t `{basename $i | sed 's/\.ht$//'} | tr -d $nl}
ifs=' '^$nl
echo '<entry>
<title>'^$"title^'</title>
<id>'^$"link^'</id>
<link href="'^$"link^'"/>
<updated>'^$"updated^'</updated>
<content type="html"><![CDATA['^$"content^']]></content>
</entry>
'
}
echo '</feed>'
} > $target
echo '√ '^$target^' created'
pub/changeblog.plain.xml:Q: $BLOGMS
{
echo '<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<author>
<name>sirjofri</name>
<email>sirjofri@sirjofri.de</email>
</author>
<link rel="self" href="'^$DOMAIN^'changeblog.plain.xml"/>
<rights>© Copyright '^$year^' sirjofri</rights>
<id>'^$"DOMAIN^'</id>
<title>changeblog</title>
<updated>'^`"{date -t | tr -d $nl}^'</updated>'
for(i in $prereq){
ifs=''
title=`{sed '1d;2q' $i | tr -d $nl}
content=`{troff -a -ms $i | sed 's/&/\&/g;s/</\</g;s/>/\>/g' | sed 's/$/
/g'}
link=$DOMAIN^`{echo -n $i | sed 's:\.ms$:/:' | tr -d $nl}
updated=`{date -t `{basename $i | sed 's/\.ms$//'} | tr -d $nl}
ifs=' '^$nl
echo '<entry>
<title>'^$"title^'</title>
<id>'^$"link^'</id>
<link href="'^$"link^'"/>
<updated>'^$"updated^'</updated>
<content type="text">'^$"content^'</content>
</entry>
'
}
echo '</feed>'
} > $target
echo '√ '^$target^' created'
changeblog/%.ms:Q: changeblog/%.txt
{
title=`{
sed '2q' changeblog/$stem.txt | tr -d $nl
}
echo '# '^$"title
sed '1d;s/^##/#/g' changeblog/$stem.txt
} | ./txt2ms > $target
echo '√ '^$target^' prepared'
changeblog/%.ht:Q: changeblog/%.txt
{
title=`{
sed '2q' changeblog/$stem.txt | tr -d $nl
}
echo '<article>
<header>
<h2>'^$"title^'</h2>
<b>'^`"{date -f $dfmt $stem | tr -d $nl}^'</b>
</header>'
./txt2html -v 'firstheader=1' changeblog/$stem.txt
echo '</article>'
} > $target
echo '√ '^$target^' prepared'
changeblog.ht:QV: $BLOG
echo '<section>
<header>
<h2>all articles</h2>
</header>
<a href="changeblog.pdf">Download pdf</a><br>
<a href="/changeblog.xml">Feed</a><br>
<ul>' > $target
obs=`{ls -r changeblog/*.txt | sed -e 's/\.txt$//g' -e 's:changeblog/::g'}
for(OB in $obs){
OBN=`{sed '1q' changeblog/^$OB^.txt | tr -d $nl}
echo '<li><a href="/changeblog/'^$OB^'/">'^`"{date -f $dfmt $OB | tr -d $nl}^': '^$"OBN^'</a></li>' >> $target
}
echo '</ul>
</section>' >> $target
echo '√ '^$target^' prepared'
pub/index.html:QV: head.htf index.ht foot.htf
if(! test -d pub)
mkdir pub
cat $prereq | sed -e 's:PAGETITLE:sirjofri:g' | sed -e 's:<<YR>>:'^$year^':g' > pub/index.html
echo '√ '^$target
pub/%/index.html:QV: head.htf %.ht foot.htf
dirpart=`{basename -d $target}
if(! test -d $dirpart)
mkdir -p $dirpart
cat $prereq | sed -e 's:PAGETITLE:'^$stem^':g' | sed -e 's:<<YR>>:'^$year^':g' > pub/$stem/index.html
echo '√ '^$target
deploy:QV:
disk/mkfs -d /usr/web -s pub mkfs.proto
echo √ deployed