6

Here in Sphinx's documentation it is said what those templates can be redefined. So I tried to copy module.rst from /site-packages/sphinx/ext/autosummary to source/_templates/autosummary (also tried just source/_templates) with some slight changes. But after I regenerated the docs nothing changed.

Maybe i should add some specific option to .. autosummary:: tag to specify custom template directory? (in conf.py directory is set right and sphinx see html templates as well)

UPD: source code: https://github.com/actionless/wooper/blob/master/docs.sh

actionless
  • 198
  • 1
  • 7

2 Answers2

6

It should work if you do the following:

  1. Ensure that the value of the templates_path configuration variable is set to ['_templates'] in conf py.
  2. Put the custom template in the _templates subdirectory.
  3. Use the :template: option:

    .. autosummary::
      :template: mytemplate.rst
    
mzjn
  • 48,958
  • 13
  • 128
  • 248
  • are you sure what no any additional actions are needed? i did it all the same, but it seems what contents of '_templates' directory is processed like source files (and sphinx-build complains about it like about wrong source). adding it to exclude-pattern mutes those warnings but 'autosummary' still behaves like no ":template:" parameter specifiede – actionless Jan 29 '15 at 01:41
  • 1
    btw, here is the source code: https://github.com/actionless/wooper/blob/debug-autosummary/docs.sh – actionless Jan 29 '15 at 01:53
  • 1
    As far as I can tell, you are not generating "stub" pages as described at http://sphinx-doc.org/ext/autosummary.html?highlight=stub. In that case, there are no templates that can be customized. – mzjn Jan 29 '15 at 13:19
  • so seems i need to add `autosummary_generate` option to make things work? – actionless Jan 29 '15 at 18:58
0

Edited: I've originally posted an answer to the wrong issue here. However, might help as well here.

One can 'overrule' the default templates by adding a custom file into the _templates folder. E.g., if you want to change the template for classes used when calling the autosummary directive create a custom class.rst file under this path:

  • _templates/autosummary/class.rst

Should be taken automatically without the need of specifying :template: explicitly.