コード例 #1
0
    def visit_reference(self, node):

        if 'refuri' not in node:
            pass  # Don't add these anchors
        elif 'internal' not in node:
            pass  # Don't add external links (they are automatically added by the reST spec)
        elif 'reftitle' in node:
            # Include node as text, rather than with markup.
            # reST seems unable to parse a construct like ` ``literal`` <url>`_
            # Hence we revert to the more simple `literal <url>`_
            if node.astext() in ["Filter", "Base"]:
                self.add_text('%s' % (node.astext()))
            else:
                RstTranslator.visit_reference(self, node)
            # self.end_state(wrap=False)
            raise nodes.SkipNode
        else:
            if node.astext() == "Unit tests":
                node['refuri'] = "http://pydblite.readthedocs.org/en/latest/unittests.html"
            elif node.astext() == "Example code":
                node['refuri'] = "http://pydblite.readthedocs.org/en/latest/examples.html"
            RstTranslator.visit_reference(self, node)
            raise nodes.SkipNode
コード例 #2
0
 def __init__(self, document, builder):
     RstTranslator.__init__(self, document, builder)