shithub: img

ref: 033a6e5dcb780c01fe27f6fb4a379820cb91c876
dir: /mkpages.rc/

View raw version
#!/bin/rc

fn mkpage{
	echo '<!DOCTYPE html>
<html>
<head>
<style>
body{
	background-color: black;
	text-align: center;
}
a{
	color: white;
}
.disabled{
	color: grey;
}
</style>
</head>
<body>
<p>'
if(! ~ $3 '')
	echo '<a href="'^$3^'.html">prev</a>'
if not
	echo '<span class="disabled">prev</span>'
echo ' | <a href="index.html">index</a> | '
if(! ~ $4 '')
	echo '<a href="'^$4^'.html">next</a>'
if not
	echo '<span class="disabled">next</span>'
echo '</p>
<p><a href="'^$2^'"><img src="'^$1^'"/></a></p>
</body>
</html>'
}

ls *.full.* | sed 's/\.full\.[A-Z]\+$//' | awk '{
	if (buf){
		i = NR - 1
		p = i - 1
		if(p < 1)
			p = ""
		n = i + 1
		printf "mkpage %s.big.JPG %s.full.* ''%s'' ''%s'' >%d.html\n", buf, buf, p, n, i
	}
	buf = $0
}
END{
	i = NR
	p = i - 1
	printf "mkpage %s.big.JPG %s.full.* ''%s'' '''' >%d.html\n", buf, buf, p, i
}' | rc