shithub: sirjofri_de

ref: 5bb784ee98ff75aeb87df7a3e79387ce9373ffb1
dir: /mkfile/

View raw version
PATHS=`{ls *.ht | sed -e 's/\.ht$//g' | grep -v 'index' | grep -v 'changeblog/';ls changeblog/*.ms | sed -e 's/\.ms$//g'}
BLOG=`{ls changeblog/*.ms | sed -e 's/\.ms$/.ht/g'}
OBJECTS=`{echo 'pub/'^$PATHS^'/index.html'}

nl='
'

build:QV: changeblog.ht $OBJECTS pub/index.html
	echo 'Build complete'

prepare:QV: changeblog.ht
	echo 'Prepare complete'
	mk build

pub/changeblog/changeblog.pdf:Q: `{ls changeblog/*.ms}
	{
		echo '.TL
	sirjofri.de changeblog'
		for(i in $prereq){
			echo '.PP
	.PP
	.B'
			echo `{echo $i | sed 's:changeblog/::g;s:\.ms$::g'}^:
			echo .R
			cat $i
		}
	} | troff -ms | lp -dstdout | ps2pdf > $target
	echo '√ '^$target^' created'

changeblog/%.ht:Q: changeblog/%.ms
	{
		title=`"{
			sed -n '/\.HTML/s/\.HTML //p' changeblog/$stem.ms
		}
		echo '<article>
	<header>
	<h2>'^$title^'</h2>
	</header>'
		htmlroff -ms changeblog/$stem.ms
		echo '</article>'
	} > $target
	echo '√ '^$target^' prepared'

changeblog.ht:Q: $BLOG
	echo '<section>
	<header>
	<h2>all articles</h2>
	</header>
	<a href="changeblog.pdf">Download pdf</a><br>
	<ul>' > $target
	obs=`{ls changeblog/*.ms | sed -e 's/\.ms$//g' -e 's:changeblog/::g'}
	for(OB in $obs){
		OBN=`"{sed -n '/^\.HTML /s:\.HTML::p' changeblog/^$OB^.ms | tr -d $nl}
		echo '<li><a href="/changeblog/'^$OB^'/">'$OB': '$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' > 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' > pub/$stem/index.html
	echo '√ '^$target