diff --git a/doc/api.rst b/doc/api.rst index d4f377c..be89075 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -12,6 +12,7 @@ Contents: api.feed api.entry - api.podcast - api.podcast_entry api.util + ext/api.ext.base + ext/api.ext.podcast + ext/api.ext.podcast_entry diff --git a/doc/conf.py b/doc/conf.py index 57479c2..40a2698 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -3,7 +3,7 @@ # All configuration values have a default; values that are commented out # 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, # 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(' ') ) 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): app.connect('autodoc-process-docstring', process_docstring) + app.connect('source-read', substitute_link) diff --git a/doc/api.podcast.rst b/doc/ext/api.ext.base.rst similarity index 76% rename from doc/api.podcast.rst rename to doc/ext/api.ext.base.rst index f3ccc42..0d6573c 100644 --- a/doc/api.podcast.rst +++ b/doc/ext/api.ext.base.rst @@ -3,5 +3,5 @@
Contents
-.. automodule:: feedgen.podcast +.. automodule:: feedgen.ext.base :members: diff --git a/doc/api.podcast_entry.rst b/doc/ext/api.ext.podcast.rst similarity index 73% rename from doc/api.podcast_entry.rst rename to doc/ext/api.ext.podcast.rst index 418ef74..0fdcb0c 100644 --- a/doc/api.podcast_entry.rst +++ b/doc/ext/api.ext.podcast.rst @@ -3,5 +3,5 @@
Contents
-.. automodule:: feedgen.podcast_entry +.. automodule:: feedgen.ext.podcast :members: diff --git a/doc/ext/api.ext.podcast_entry.rst b/doc/ext/api.ext.podcast_entry.rst new file mode 100644 index 0000000..2ee1e0f --- /dev/null +++ b/doc/ext/api.ext.podcast_entry.rst @@ -0,0 +1,7 @@ +.. raw:: html + +
Contents
+
+ +.. automodule:: feedgen.ext.podcast_entry + :members: diff --git a/doc/index.rst b/doc/index.rst index bf869f8..22fc46b 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,6 +1,6 @@ .. contents:: Table of Contents -.. include:: main-readme.rst +.. include-github-readme .. raw:: html diff --git a/doc/main-readme.rst b/doc/main-readme.rst deleted file mode 120000 index 15926e3..0000000 --- a/doc/main-readme.rst +++ /dev/null @@ -1 +0,0 @@ -../readme.md \ No newline at end of file diff --git a/readme.md b/readme.md index e97f568..ae6b19d 100644 --- a/readme.md +++ b/readme.md @@ -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 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).