shithub: img

ref: b24df14003cf4b8e6c6a5725531b859ba93c2303
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.JPG | sed 's/\.full\.JPG//' | awk '{
	if (buf){
		i = NR - 1
		p = i - 1
		if(p < 1)
			p = ""
		n = i + 1
		printf "mkpage %s.big.JPG %s.full.JPG ''%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.JPG ''%s'' '''' >%d.html\n", buf, buf, p, i
}' | rc