wm: infra

Download patch

ref: de92748c1a939d295c7675b92a0174351cf87784
parent: 32ffe2f950e8fc5a18a13a586c890cf4c828f754
author: mkf <mkf>
date: Fri Sep 6 00:01:08 EDT 2024

doc/{html,pdf,ps,txt,weblist}: import

each day there was a new doc tool, which was going to end up confusing.
move them all into their own directory, which sadly may be even more confusing,
if you came looking for documention of this repo...

--- /dev/null
+++ b/doc/html
@@ -1,0 +1,42 @@
+#!/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 '<b>invalid ref '$refname'</b>'
+	exit
+}
+
+if(! test -d $gitfs/$ref/tree){
+	echo '	<p>No code pushed</p>
+		</body>
+		</html>
+	'
+	exit
+}
+
+cd $gitfs/$ref/tree
+
+echo '	<p>'
+
+echo '<p><div id="content">'
+
+ms2html < $gitfs/$ref/tree/$file.ms
+	
+echo '	</div>
+	</p>
+	</body>
+	</html>'
--- /dev/null
+++ b/doc/pdf
@@ -1,0 +1,29 @@
+#!/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
+troff -ms $gitfs/$ref/tree/$file.ms | dpost | ps2pdf
--- /dev/null
+++ b/doc/ps
@@ -1,0 +1,29 @@
+#!/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
+troff -ms $gitfs/$ref/tree/$file.ms | dpost
--- /dev/null
+++ b/doc/txt
@@ -1,0 +1,30 @@
+#!/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
+nroff -ms $gitfs/$ref/tree/$file.ms | col -bf
+
--- /dev/null
+++ b/doc/weblist
@@ -1,0 +1,60 @@
+#!/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>'