Ejemplo n.º 1
0
    def after_content(self):
        ObjectDescription.after_content(self)

        if not self.content:
            return

        node = nodes.paragraph()
        self.state.nested_parse(self.content, 0, node)

        sig_done = False
        sig = f"function {self.names[0]}"
        try:
            func_def = node.children[0][0][1][0]
            node_type = func_def.children[0][0][0]
            if node_type == "function":
                for a in func_def.children[1:-2:2]:
                    sig += a.title().strip()
                sig_done = True
        except IndexError:
            pass

        if sig_done:
            sig += ")"
            print(sig)
        if not node.children or node.children[-1].tagname != "paragraph":
            logger.error(f"{self.names[0]} is undocumented")
Ejemplo n.º 2
0
    def after_content(self):
        """This method is called after child objects have been processed.

        There is also the ``before_content()`` method which is called during
        ``run()`` before child objects have been processed but after the
        current object has been processed.
        """
        for ind, child_node in enumerate(self.registered_children):
            self.registered_children[ind] = child_node.run()[1]
        for context_var in self.ref_context_to_remove:
            self.remove_ref_context(context_var)
        ObjectDescription.after_content(self)
Ejemplo n.º 3
0
    def after_content(self):
        """This method is called after child objects have been processed.

        There is also the ``before_content()`` method which is called during
        ``run()`` before child objects have been processed but after the
        current object has been processed.
        """
        for ind, child_node in enumerate(self.registered_children):
            self.registered_children[ind] = child_node.run()[1]
        for context_var in self.ref_context_to_remove:
            self.remove_ref_context(context_var)
        ObjectDescription.after_content(self)
Ejemplo n.º 4
0
    def after_content(self):
        ObjectDescription.after_content(self)

        if not self.content:
            return

        node = nodes.paragraph()
        self.state.nested_parse(self.content, 0, node)

        # node    <paragraph>
        # node[0]        <field_list>
        # node[0][0]            <field>
        # node[0][0][0]                <field_name>
        # node[0][0][0][0]                     Type
        # node[0][0][1]                <field_body>
        # node[0][0][1][0]                    <paragraph>
        # node[0][0][1][0][0]                        <pending_xref refdoc="scripts/NCSA/external_dns/main.zeek" refdomain="zeek" refexplicit="False" reftarget="function" reftype="type" refwarn="False">
        # node[0][0][1][0][0][0]                            <literal classes="xref zeek zeek-type">
        # node[0][0][1][0][0][0][0]                                function

        sig_done = False
        sig = f"function {self.names[0]}"
        try:
            func_def = node.children[0][0][1][0]
            node_type = func_def.children[0][0][0]
            if node_type == "function":
                for a in func_def.children[1:-2:2]:
                    sig += a.title().strip()
                sig_done = True
        except Exception:
            pass

        if sig_done:
            sig += ")"
            print(sig)
        if not node.children or node.children[-1].tagname != "paragraph":
            logger.error(f"{self.names[0]} is undocumented")
Ejemplo n.º 5
0
 def after_content(self):
     # remove ref_context_key variable
     self.state.document.settings.env.ref_context.pop(self.ref_context_key)
     ObjectDescription.after_content(self)