Exemplo n.º 1
0
    def __init__(
            self,
            creator,
            *args
            ):

        Renderer.__init__( self, *args )

        self.creator = creator
Exemplo n.º 2
0
class DoxygenToRstRendererFactory(object):
    def __init__(self, node_type, type_, renderers, renderer_factory_creator,
                 node_factory, project_info, state, document,
                 rst_content_creator, filter_):

        self.node_type = node_type
        self.type_ = type_
        self.node_factory = node_factory
        self.project_info = project_info
        self.renderers = renderers
        self.renderer_factory_creator = renderer_factory_creator
        self.state = state
        self.document = document
        self.rst_content_creator = rst_content_creator
        self.filter_ = filter_

    def create_renderer(self, parent_data_object, data_object, directive):

        if not self.filter_.allow(parent_data_object, data_object):
            return NullRenderer()

        child_renderer_factory = self.renderer_factory_creator.create_child_factory(
            data_object, self)

        try:
            node_type = data_object.node_type
        except AttributeError, e:

            # Horrible hack to silence errors on filtering unicode objects
            # until we fix the parsing
            if type(data_object) == unicode:
                node_type = "unicode"
            else:
                raise e

        Renderer = self.renderers[node_type]

        if node_type == "docmarkup":

            creator = self.node_factory.inline
            if data_object.type_ == "emphasis":
                creator = self.node_factory.emphasis
            elif data_object.type_ == "computeroutput":
                creator = self.node_factory.literal
            elif data_object.type_ == "ulink":
                Renderer = compoundrenderer.URLMarkupTypeSubRenderer
                return Renderer(self.project_info, data_object,
                                child_renderer_factory, self.node_factory,
                                self.state, self.document, directive)
            elif data_object.type_ == "bold":
                creator = self.node_factory.strong
            elif data_object.type_ == "superscript":
                creator = self.node_factory.superscript
            elif data_object.type_ == "subscript":
                creator = self.node_factory.subscript
            elif data_object.type_ == "center":
                print "Warning: does not currently handle 'center' text display"
            elif data_object.type_ == "small":
                print "Warning: does not currently handle 'small' text display"

            return Renderer(creator, self.project_info, data_object,
                            child_renderer_factory, self.node_factory,
                            self.state, self.document, directive)

        if node_type == "verbatim":

            return Renderer(self.rst_content_creator, self.project_info,
                            data_object, child_renderer_factory,
                            self.node_factory, self.state, self.document,
                            directive)

        if node_type == "memberdef":

            if data_object.kind == "function":
                Renderer = compoundrenderer.FuncMemberDefTypeSubRenderer
            elif data_object.kind == "enum":
                Renderer = compoundrenderer.EnumMemberDefTypeSubRenderer
            elif data_object.kind == "typedef enum":
                Renderer = compoundrenderer.TypedefEnumMemberDefTypeSubRenderer
            elif data_object.kind == "typedef":
                Renderer = compoundrenderer.TypedefMemberDefTypeSubRenderer
            elif data_object.kind == "typedef function pointer":
                Renderer = compoundrenderer.TypedefFunctionPointerMemberDefTypeSubRenderer
            elif data_object.kind == "variable":
                Renderer = compoundrenderer.VariableMemberDefTypeSubRenderer
            elif data_object.kind == "macro":
                Renderer = compoundrenderer.MacroMemberDefTypeSubRenderer
            elif data_object.kind == "define":
                Renderer = compoundrenderer.DefineMemberDefTypeSubRenderer
            elif data_object.kind == "define hidden":
                Renderer = compoundrenderer.DefineHiddenMemberDefTypeSubRenderer

        if node_type == "docsimplesect":
            if data_object.kind == "par":
                Renderer = compoundrenderer.ParDocSimpleSectTypeSubRenderer

        return Renderer(self.project_info, data_object, child_renderer_factory,
                        self.node_factory, self.state, self.document,
                        directive)
Exemplo n.º 3
0
 def __init__(self,*args):
     Renderer.__init__( self, *args )
Exemplo n.º 4
0
    def __init__(self, content_creator, *args):
        Renderer.__init__(self, *args)

        self.content_creator = content_creator
Exemplo n.º 5
0
    def __init__(self, compound_parser, *args):
        Renderer.__init__(self, *args)

        self.compound_parser = compound_parser
Exemplo n.º 6
0
    def __init__(self, compound_parser, *args):
        Renderer.__init__(self, *args)

        self.compound_parser = compound_parser
Exemplo n.º 7
0
 def __init__(self, *args):
     Renderer.__init__(self, *args)
Exemplo n.º 8
0
    def __init__(self, content_creator, *args):
        Renderer.__init__(self, *args)

        self.content_creator = content_creator
Exemplo n.º 9
0
    def __init__(self, creator, *args):

        Renderer.__init__(self, *args)

        self.creator = creator