Synopsis - Synopsis/Formatters/HTML/Fragments/XRefLinker.py

File: Synopsis/Formatters/HTML/Fragments/XRefLinker.py

     1#
     2# Copyright (C) 2000 Stephen Davies
     3# Copyright (C) 2000 Stefan Seefeld
     4# All rights reserved.
     5# Licensed to the public under the terms of the GNU LGPL (>= 2),
     6# see the file COPYING for details.
     7#
     8
     9from Synopsis.Formatters.HTML.Tags import *
    10from Default import Default
    11
    12class XRefLinker(Default):
    13    """Adds an xref link to all declarations"""
    14
    15    def register(self, formatter):
    16
    17        Default.register(self, formatter)
    18        self.pager = self.processor.xref
    19        self.sxr = self.processor.sxr_prefix and self.processor.ir.sxr
    20
    21    def format_declaration(self, decl):
    22
    23        entry = self.sxr and self.sxr.get(decl.name)
    24        if not entry:
    25            return ''
    26        page = self.pager.get(decl.name)
    27        url = self.directory_layout.xref(page)
    28        url += '#' + quote_as_id(str(decl.name))
    29        label = img(src=rel(self.view.filename(), 'xref.png'), alt='references')
    30        return href(rel(self.view.filename(), url), label)
    31
    32

Generated on Thu Apr 16 16:27:14 2009 by
synopsis (version devel)