wm: infra

ref: adf681cd88d306c4afd995150bbb21d3286d0eba
dir: /doc/pdf/

View raw version
#!/bin/rc -e

. /sys/lib/shithub/common.rc

cd $1
shift

rfork ne
nl='
'

gituser=$1
repo=$2
refname=$3
file=$4

repons $gituser $repo
if(! ref=`{resolveref $refname}){
	echo 'Invalid ref '$refname''
	exit
}

if(! test -d $gitfs/$ref/tree){
	echo 'No such document'
	exit
}

cd $gitfs/$ref/tree
if(test -r $gitfs/$ref/tree/$file.wms)
	wm/wiki2ms $gitfs/$ref/tree/$file.wms | troff -ms | dpost | ps2pdf
if not
	troff -ms $gitfs/$ref/tree/$file.ms | dpost | ps2pdf