提交 fd3e360c authored 作者: bergstrj@lgcm's avatar bergstrj@lgcm

added apirst2html script, simplified html generation scripts

上级 8af8f24c
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
"""An HTML writer supporting link to external documentation.
This module is a frontend for the Docutils_ HTML writer. It allows a document
to reference objects documented in the API documentation generated by
extraction tools such as Doxygen_ or Epydoc_.
.. _Docutils: http://docutils.sourceforge.net/
.. _Doxygen: http://www.doxygen.org/
.. _Epydoc: http://epydoc.sourceforge.net/
"""
# $Id: apirst2html.py 1531 2007-02-18 23:07:25Z dvarrazzo $
__version__ = "$Revision: 1531 $"[11:-2]
__author__ = "Daniele Varrazzo"
__copyright__ = "Copyright (C) 2007 by Daniele Varrazzo"
__docformat__ = 'reStructuredText en'
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
# We have to do some path magic to prevent Python from getting
# confused about the difference between the ``epydoc.py`` script, and the
# real ``epydoc`` package. So remove ``sys.path[0]``, which contains the
# directory of the script.
import sys, os.path
script_path = os.path.abspath(sys.path[0])
sys.path = [p for p in sys.path if os.path.abspath(p) != script_path]
import epydoc.docwriter.xlink as xlink
from docutils.core import publish_cmdline, default_description
description = ('Generates (X)HTML documents with API documentation links. '
+ default_description)
publish_cmdline(reader=xlink.ApiLinkReader(), writer_name='html',
description=description)
...@@ -16,5 +16,13 @@ for module in [tensor]: ...@@ -16,5 +16,13 @@ for module in [tensor]:
if isOp(symbol): if isOp(symbol):
print "" print ""
print "- `%s.%s`" % (module.__name__, symbol_name) print "- `%s.%s`" % (module.__name__, symbol_name)
docstring = getattr(symbol, '__doc__', "")
if not docstring:
print 'No documentation'
elif len(docstring) < 50:
print docstring
else:
print docstring[:40], "..."
#!/bin/bash #!/bin/bash
mkdir -p html/api APIRST2HTML=doc/apirst2html.py
EPYDOC_ARGS='--external-api=api --external-api-file=api:html/api/api-objects.txt --external-api-root=api:../api/'
mkdir -p html/api
mkdir -p html/doc
if [ " $1" != " rst" ]; then
epydoc --config local.epydoc epydoc --config local.epydoc
fi
cd doc if [ " $1" != " epydoc" ]; then
sh build_html.sh for RST in graph oplist ; do
cd ../ $APIRST2HTML $EPYDOC_ARGS doc/$RST.txt html/doc/$RST.html
rm -Rf html/doc done
mv doc/html html/doc fi
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论