Source

sphinx-vala-domain / sphinx / domains / vala.py

# -*- coding: utf-8 -*-
"""
    sphinx.domains.vala
    ~~~~~~~~~~~~~~~~~~~

    The Vala language domain.

    :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""
from sphinx.domains import Domain


class ValaDomain(Domain):
    """Vala language domain."""
    name = 'vala'
    label = 'Vala'
    # TODO: add object types for:
    #       - classes
    #       - methods
    #       - interfaces
    #       - structs
    object_types = {}
    # TODO: add directive for namespace
    directives = {}
    roles = {}
    initial_data = {
        'objects': {}, # fullname -> docname, objtype
    }

    def clear_doc(self, docname):
        for fullname, (dn, objtype) in self.data['objects'].items():
            if dn == docname:
                del self.data['objects'][fullname]

    def get_objects(self):
        for fullname, (docname, objtype) in self.data['objects'].iteritems():
            yield fullname, fullname, objtype, docname, fullname, 1