wm: infra

ref: 9f833900ad0a9bef9743dccddd01b31fd6dc2fe9
dir: /doc/weblist/

View raw version
#!/bin/rc -e

. /sys/lib/shithub/common.rc

rfork ne
nl='
'
cd $1
shift

rfork ne
nl='
'

gituser=$1
repo=$2
ref=$3

repons $gituser $repo

prelude '' 'Documents'
#echo '<img src="/static/'$logo'" /><br/>'

if(~ $#intro 0)
	echo '<h2>Documents</h2><br>'

echo $ref
cd $gitfs/$ref/tree
udir=()
for(doc in `$nl{ls -Q *}){
	ndir=`{basename -d $doc}
	if(~ $ndir .)
		ndir=Root
	if(! ~ $udir $ndir)
		echo '</dl>'
	if(! ~ $udir $ndir){
		echo '<h3>'$ndir'</h3>'
		echo '<dl>'
		udir=$ndir
	}

	echo '<dt>'

	title = `{grep '.TL$^(.+)' $doc | sed 2p}
	filename = `{echo $doc | sed s/'(.+).ms'/\1/g}

	if(! ~ $#title 0)
		echo '<h6>'$filename': '$"title'</h6>'
	if not
		echo '<h6>'$filename'</h6>'	
	echo '</dt><dd>'
	echo '[<a href="'$filename^.html'">html</a>]'
	echo '[<a href="'$filename^.txt'">txt</a>]'
	echo '</dd>'
}
echo '
</div>
</p>
</body>
</html>'