doc/ext/sfile.py
author Dmitriy Morozov <dmitriy@mrzv.org>
Fri, 25 Dec 2009 06:56:27 -0800
branchdev
changeset 184 a5e726461d3f
parent 134 c270826fd4a8
permissions -rw-r--r--
Fixed a serious bug in DynamicPersistenceTrails + LSVineyard sorts filtration by attachment + miscellanea: * added program options to pdbdistance-vineyard * pdbdistance-vineyard takes frame list in a file * more logging * verification of pairing after vertex transpositions (commented out)

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)