Rewrote Sphinx documentation

This commit is contained in:
Lars Kiesow 2013-05-05 22:02:41 +02:00
parent 9df7e9dc48
commit 115f5e1ac3
8 changed files with 28 additions and 8 deletions

View file

@ -12,6 +12,7 @@ Contents:
api.feed api.feed
api.entry api.entry
api.podcast
api.podcast_entry
api.util api.util
ext/api.ext.base
ext/api.ext.podcast
ext/api.ext.podcast_entry

View file

@ -3,7 +3,7 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import sys, os, time import sys, os, time, codecs, re
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
@ -264,5 +264,18 @@ def process_docstring(app, what, name, obj, options, lines):
ll.append( (' '*newlen) + l.lstrip(' ') ) ll.append( (' '*newlen) + l.lstrip(' ') )
lines[:] = ll lines[:] = ll
# Include the GitHub readme file in index.rst
r = re.compile(r'\[`*([^\]`]+)`*\]\(([^\)]+)\)')
r2 = re.compile(r'.. include-github-readme')
def substitute_link(app, docname, text):
if docname == 'index':
readme_text = ''
with codecs.open(os.path.abspath('../readme.md'), 'r', 'utf-8') as f:
readme_text = r.sub(r'`\1 <\2>`_', f.read())
text[0] = r2.sub(readme_text, text[0])
def setup(app): def setup(app):
app.connect('autodoc-process-docstring', process_docstring) app.connect('autodoc-process-docstring', process_docstring)
app.connect('source-read', substitute_link)

View file

@ -3,5 +3,5 @@
<div class="apititle"><b>Contents</b></div> <div class="apititle"><b>Contents</b></div>
<div class="apitoc"></div> <div class="apitoc"></div>
.. automodule:: feedgen.podcast .. automodule:: feedgen.ext.base
:members: :members:

View file

@ -3,5 +3,5 @@
<div class="apititle"><b>Contents</b></div> <div class="apititle"><b>Contents</b></div>
<div class="apitoc"></div> <div class="apitoc"></div>
.. automodule:: feedgen.podcast_entry .. automodule:: feedgen.ext.podcast
:members: :members:

View file

@ -0,0 +1,7 @@
.. raw:: html
<div class="apititle"><b>Contents</b></div>
<div class="apitoc"></div>
.. automodule:: feedgen.ext.podcast_entry
:members:

View file

@ -1,6 +1,6 @@
.. contents:: Table of Contents .. contents:: Table of Contents
.. include:: main-readme.rst .. include-github-readme
.. raw:: html .. raw:: html

View file

@ -1 +0,0 @@
../readme.md

View file

@ -161,4 +161,4 @@ You can test the module by simply executing::
If you want to have a look at the code for this test to have a working code If you want to have a look at the code for this test to have a working code
example for a whole feed generation process, you can find it in the example for a whole feed generation process, you can find it in the
[`__main__.py`](https://github.com/lkiesow/pyFeedGenerator/blob/master/feedgenerator/__main__.py#L36). [`__main__.py`](https://github.com/lkiesow/python-feedgen/blob/master/feedgen/__main__.py).