[MLton-commit] r4225

Stephen Weeks MLton@mlton.org
Tue, 15 Nov 2005 13:36:47 -0800


Make the pdf version of the MLton guide using htmldoc, and install the
pdf along with the rest of our documentation.

----------------------------------------------------------------------

U   mlton/trunk/Makefile
U   mlton/trunk/bin/make-pdf-guide
U   mlton/trunk/package/debian/control

----------------------------------------------------------------------

Modified: mlton/trunk/Makefile
===================================================================
--- mlton/trunk/Makefile	2005-11-15 21:23:43 UTC (rev 4224)
+++ mlton/trunk/Makefile	2005-11-15 21:36:44 UTC (rev 4225)
@@ -151,6 +151,7 @@
 docs: dirs
 	$(MAKE) -C $(LEX) docs
 	$(MAKE) -C $(YACC) docs
+	bin/make-pdf-guide
 
 BSDSRC = /tmp/mlton-$(VERSION)
 .PHONY: freebsd
@@ -416,6 +417,7 @@
 		cd $(SRC)/doc &&					\
 		$(CP) changelog examples guide license README $(TDOC)/	\
 	)
+	mv $(TDOC)/guide/mlton-guide.pdf $(TDOC)/
 	(								\
 		cd $(SRC)/util &&					\
 		$(CP) cmcat cm2mlb $(TDOC)/				\

Modified: mlton/trunk/bin/make-pdf-guide
===================================================================
--- mlton/trunk/bin/make-pdf-guide	2005-11-15 21:23:43 UTC (rev 4224)
+++ mlton/trunk/bin/make-pdf-guide	2005-11-15 21:36:44 UTC (rev 4225)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
 set -e
-set -x
 
 name=`basename $0`
 dir=`dirname $0`
@@ -24,10 +23,110 @@
 ;;
 esac
 
-tmp='/tmp/guide'
+book='mlton.book'
+pages='.pages'
+pdf='mlton-guide.pdf'
+script='.script'
+titlepage='title.html'
+tmp='/tmp/mlton-guide'
+version=`date +%Y%m%d`
+
 rm -rf $tmp
 mkdir $tmp
+cd $tmp
 
-( cd $src/doc/guide && tar -cf - . ) | ( cd $tmp && tar -xf - )
-yes | time html2ps -DHnRtTU -C fb -W bL http://localhost/guide/ >guide.ps 2>/tmp/z.log
-ps2pdf guide.ps
+( cd $src/doc/guide && tar -cf - . ) | tar -xf -
+
+# The grep -v takes out files that aren't wiki pages.
+ls -1 | grep -v '\.' >$pages
+
+echo 'Massaging HTML.'
+
+for f in `cat $pages`; do
+cat >$script <<EOF
+23,41d
+s;\(<body .*\);\1\n<h1>$f</h1>;
+s;<img src=\"\(http://mlton.org[^>]*\)>;<img src="moin-www.png"><a href=\"\1>image</a>;g
+EOF
+	sed -f $script <$f >.tmp
+	mv .tmp $f
+done
+
+echo 'Generating PDF titlepage.'
+cat >$titlepage <<EOF
+<html>
+<head><title>MLton Guide ($version)</title></head>
+<body>
+<h1>MLton Guide</h1>
+<p>
+This is the guide for MLton, an open-source, whole-program,
+optimizing Standard ML compiler.
+</p>
+
+<p>
+This guide was generated automatically from the MLton wiki,
+available online at <a href="http://mlton.org/">http://mlton.org</a>.
+It is up to date for MLton $version.
+</p>
+
+</body>
+</html>
+EOF
+
+echo 'Generating htmldoc script.'
+(
+cat <<EOF
+#HTMLDOC 1.8.24 Open Source
+-f $pdf
+-t pdf13 
+--bodyfont times 
+--bottom 0.50in 
+--browserwidth 680 
+--charset iso-8859-1 
+--color
+--compression=9 
+--effectduration 1.0 
+--embedfonts 
+--firstpage p1 
+--fontsize 11.0 
+--fontspacing 1.2 
+--footer ..1 
+--header t.c
+--headfootfont Helvetica 
+--headfootsize 11.0 
+--headingfont Helvetica 
+--jpeg=0 
+--left 1.00in 
+--links 
+--linkstyle underline 
+--no-encryption 
+--no-pscommands 
+--no-strict
+--no-xrxcomments 
+--nup 1 
+--pageduration 10 
+--pageeffect none 
+--pagelayout single 
+--pagemode document 
+--portrait 
+--right 0.50in 
+--size Universal 
+--title 
+--top 0.50in 
+--webpage 
+$titlepage
+Home
+Index
+EOF
+
+grep -v '^\(Home\|Index\)$' $pages 
+) >$book
+
+echo 'Running htmldoc.'
+htmldoc --batch $book
+
+mv $pdf $src/doc/guide
+
+cd
+
+rm -rf $tmp

Modified: mlton/trunk/package/debian/control
===================================================================
--- mlton/trunk/package/debian/control	2005-11-15 21:23:43 UTC (rev 4224)
+++ mlton/trunk/package/debian/control	2005-11-15 21:36:44 UTC (rev 4225)
@@ -2,7 +2,7 @@
 Section: devel
 Priority: optional
 Maintainer: Stephen Weeks <sweeks@sweeks.com>
-Build-Depends: mlton (>= 20041109-1), libgmp3-dev (>= 4.0.1), tetex-bin, tetex-extra, time
+Build-Depends: mlton (>= 20041109-1), htmldoc, libgmp3-dev (>= 4.0.1), tetex-bin, tetex-extra, time
 Standards-Version: 3.6.2
 
 Package: mlton