SPHINXBUILD = sphinx-build
DOCBUILDDIR := $(dir)/_build
-prerst2man := python $(srcdir)/$(dir)/prerst2man.py
+prerst2x := python $(srcdir)/$(dir)/prerst2x.py
mkdocdeps := python $(srcdir)/$(dir)/mkdocdeps.py
# Internal variables.
mv $(DOCBUILDDIR)/man/*.$${section} $(DOCBUILDDIR)/man/man$${section}; \
done
else ifeq ($(HAVE_RST2MAN),1)
- $(prerst2man) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man
+ $(prerst2x) "$(RST2MAN)" $(srcdir)/doc $(DOCBUILDDIR)/man
else
@echo "Fatal: build dependency fail."
@false
from os import makedirs, system
import re
-rst2man = sys.argv[1]
+rst2x = sys.argv[1]
sourcedir = sys.argv[2]
outdir = sys.argv[3]
+try:
+ extension = sys.argv[4]
+except IndexError:
+ extension = ''
sys.path.insert(0, sourcedir)
import conf
infile = open(sourcedir + '/' + page[0] + '.rst', 'r')
# this is a crude hack. We look for the first blank line, and
- # insert the rst2man header there.
+ # insert the rst2x header there.
#
# XXX consider really parsing input
outfile.write("".join(lines))
outfile.close()
+ if extension:
+ ext = extension
+ else:
+ ext = page[4] # man page section
+
system('set -x; {0} {1} {2}/{3}.{4}'
- .format(rst2man, filename, outdir, page[0], page[4]))
+ .format(rst2x, filename, outdir, page[0], ext))