Getting the source .rst file path in Sphinx extension
- by Mikko Ohtamaa
I am writing a Sphinx extension and I need to know the document page source code file system path (.rst file location) to extract some version control system information of it. How can I get this information in my event handler / which event handler I should use?
Example:
# This package may contain traces of nuts
def on_html_page_context(app, pagename, templatename, context, doctree):
import ipdb ; ipdb.set_trace()
if doctree:
print doctree.source
def setup(app):
app.require_sphinx('1.0')
app.connect('html-page-context', on_html_page_context)