[mercury-users] Generating documentation from .m files

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 27 18:15:02 AEDT 2002


On 26-Nov-2002, Pieter Laeremans <pieter.laeremans at student.kuleuven.ac.be> wrote:
> I would like to know wheter there is a tool to generate (I suppose so)
> the GNU info and html documentation from mercury code?

The documentation in the Mercury Library Reference Manual is generated
by the Mmakefile in the `doc' directory of the Mercury source distribution.
In particular, a very simple fragment of shell script converts the library
source files into TexInfo, from which they can then be converted into
GNU info or HTML using standard tools.

Basically it's along the lines of this:

doc.texi: *.m
	for filename in *.m; do     			\  
		file="`basename $$filename .m`";        \
		echo "@node $$file";                    \
		echo "@chapter $$file";                 \
		echo "@example";                        \
		sed -n -e '/:- implementation/q'        \
			-e 's/^%----*----% *$$/%--------------------------------------------------%/'
	\
			-e 's/@/@@/g'                   \
			-e 's/{/@{/g'                   \
			-e 's/}/@}/g'                   \
			-e 'p'                          \
			"$$filename";                   \
		echo "@end example";                    \
		echo "";                                \       
	done > doc.texi

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list