Created
December 11, 2013 00:12
-
-
Save fffergal/7902825 to your computer and use it in GitHub Desktop.
Sphinx extension for adding titles to autodoc classes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sphinx.ext.autodoc import ClassDocumenter | |
class TitledClassDocumenter(ClassDocumenter): | |
def add_directive_header(self, *args, **kwargs): | |
title_lines = [ | |
self.object_name, | |
'=' * len(self.object_name), | |
'', | |
] | |
for line in title_lines: | |
self.add_line(line, 'Fergal being cool') | |
return super(TitledClassDocumenter, self).add_directive_header( | |
*args, **kwargs) | |
def setup(api): | |
api.add_autodocumenter(TitledClassDocumenter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment