Hi. I have some questions regarding templates and autosummary.

I have a simple .rst file with the following:


==== begin of mypackages.rst ====
.. autosummary::
   :toctree: modulos

   pyproj.modulo1
   pyproj.modulo2
   pyproj.pack1.modulo3
==== end of mypackages.rst ====


and my conf.py has the following:


==== begin of fragment of conf.py ====
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.autosummary']

autoclass_content = "both"
autodoc_member_order = "bysource"
autosummary_generate = True
autodoc_default_flags = ['members']
==== end of fragment of conf.py ====


When I do 'make html', the stub files generated in the 'modulos'
folder contain (for example):


==== begin of modulos/pyproj.pack1.modulo3.rst ====
pyproj.pack1.modulo3
====================

.. currentmodule:: pyproj.pack1

.. autodata:: modulo3
==== end of modulos/pyproj.pack1.modulo3.rst ====


but I need it to use 'automodule' instead of 'autodata'. In the sphinx
distribution, under 'sphinx/ext/autosummary/templates/autosummary/'
there are three basic templates: base.rst, class.rst and module.rst.

My first question is, why is the base.rst template always used, rather
than module.rst?

If I use :template:module.rst in the autosummary, as in


==== begin of mypackages.rst ====
.. autosummary::
   :toctree: modulos
   :template: module.rst

   pyproj.modulo1
   pyproj.modulo2
   pyproj.pack1.modulo3
==== end of mypackages.rst ====


then I get the following exception:


==== begin of building error ====
Exception occurred:
  File "/usr/local/lib/python2.6/dist-packages/sphinx/jinja2glue.py",
line 139, in get_source
    raise TemplateNotFound(template)
TemplateNotFound: module.rst
The full traceback has been saved in /tmp/sphinx-err-3s1ldW.log, if
you want to report the issue to the developers.
==== end of building error ====


So my second question is why doesn't it find the "official" templates
directory ('sphinx/ext/autosummary/templates/autosummary/')

Then I copy module.rst to my sources/_templates and ensure that
conf.py has this:

templates_path = ['_templates']

Then it compiles correctly, but I get these warnings:


==== begin of building warnings ====
reading sources... [100%] packages
/home/eposse/Dropbox/Experiments/sphinx/pyproj/doc/source/_templates/module.rst:4:
(WARNING/2) invalid signature for automodule (u'{{ fullname }}')

/home/eposse/Dropbox/Experiments/sphinx/pyproj/doc/source/_templates/module.rst:4:
(WARNING/2) don't know which module to import for autodocumenting u'{{
fullname }}' (try placing a "module" or "currentmodule" directive in
the document, or giving an explicit module name)

looking for now-outdated files... none found
pickling environment... done
checking consistency...
/home/eposse/Dropbox/Experiments/sphinx/pyproj/doc/source/_templates/module.rst::
WARNING: document isn't included in any toctree
done
==== end of building warnings ====


So it looks like sphinx is trying to process the template as any other
.rst document.

So my last questions are: why is sphinx dealing with the files under
_templates treated as any other .rst file? and can I do something to
avoid these warnings or is this a bug?


Thanks


PS: I use Sphinx 1.0.7 on Python 2.6.6 and 2.7.1. with  Docutils
version: 0.7 releaseand Jinja2 version: 2.5.5



-- 
Ernesto Posse

Modelling and Analysis in Software Engineering
School of Computing
Queen's University - Kingston, Ontario, Canada

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to