1#!/bin/sh 2 3SOURCEDIR=doc/source/contributor/api 4 5if [ ! -d ${SOURCEDIR} ] ; then 6 mkdir -p ${SOURCEDIR} 7fi 8 9for x in `./doc/find_autodoc_modules.sh`; 10do 11 echo "Generating ${SOURCEDIR}/${x}.rst" 12 echo "${SOURCEDIR}/${x}.rst" >> .autogenerated 13 heading="The :mod:\`${x}\` Module" 14 # Figure out how long the heading is 15 # and make sure to emit that many '=' under 16 # it to avoid heading format errors 17 # in Sphinx. 18 heading_len=$(echo "$heading" | wc -c) 19 underline=$(head -c $heading_len < /dev/zero | tr '\0' '=') 20 ( cat <<EOF 21${heading} 22${underline} 23 24.. automodule:: ${x} 25 :members: 26 :undoc-members: 27 :show-inheritance: 28EOF 29) > ${SOURCEDIR}/${x}.rst 30 31done 32 33if [ ! -f ${SOURCEDIR}/autoindex.rst ] ; then 34 35 cat > ${SOURCEDIR}/autoindex.rst <<EOF 36.. toctree:: 37 :maxdepth: 1 38 39EOF 40 for f in `cat .autogenerated | sort` ; do 41 relative=`echo ${f} | sed -e 's$^'${SOURCEDIR}'/$$'` 42 echo " ${relative}" >> ${SOURCEDIR}/autoindex.rst 43 done 44 45 echo ${SOURCEDIR}/autoindex.rst >> .autogenerated 46fi 47