doc/ext/sfile.py
author Aravindakshan Babu <akshan@stanford.edu>
Tue, 17 Aug 2010 22:19:19 -0700
branchdev
changeset 219 5311343eb2f5
parent 134 c270826fd4a8
permissions -rw-r--r--
Added documentation for the python classes Point and PersistenceDiagram. Removed the __sub__ method for PersistenceDiagram. Minor renaming. Renamed BottleneckDistance to bottleneck_distance. Renamed intervals iterator for PersistenceDiagram to points. Seems in better conformance with usage.

from docutils import nodes, utils
import posixpath

def sfile_role(typ, rawtext, etext, lineno, inliner, options={}, content=[]):
    env = inliner.document.settings.env
    baseuri = env.config.sfile_base_uri
    text = utils.unescape(etext)
    refnode = nodes.reference('', '', refuri=posixpath.join(baseuri, text))
    refnode += nodes.literal(text, text)
    return [refnode], []

def setup(app):
    app.add_role('sfile', sfile_role)
    app.add_config_value('sfile_base_uri', 'http://example.com/source', True)