Beispiel #1
0
 def set_numbering(self):
     """
     Sets the numbering status to the heading node.
     """
     if 'numbering' in self._options:
         if self._options['numbering'] == 'off':
             self.numbering = False
         elif self._options['numbering'] == 'on':
             self.numbering = True
         else:
             NodeStore.error("Invalid value '{}' for attribute 'numbering'. Allowed values are 'on' and 'off'.".
                             format(self._options['numbering']), self)
Beispiel #2
0
 def set_numbering(self) -> None:
     """
     Sets the numbering status to the heading node.
     """
     if 'numbering' in self._options:
         if self._options['numbering'] == 'off':
             self.numbering = False
         elif self._options['numbering'] == 'on':
             self.numbering = True
         else:
             NodeStore.error(
                 "Invalid value '{}' for attribute 'numbering'. Allowed values are 'on' and 'off'."
                 .format(self._options['numbering']), self)
Beispiel #3
0
    def __check_document_info(info_node_current, info_node_new):
        """
        Checks if a document info node has been set already. If so, an error will be logged.

        :param int|None info_node_current: The current document info node (i.e. a property of the document).
        :param sdoc.sdoc2.node.Node.Node info_node_new: The (new) document info node.
        """
        if info_node_current:
            node = in_scope(info_node_current)
            position = node.position
            out_scope(node)

            NodeStore.error("Document info {0} can be specified only once. Previous definition at {1}.".format(
                info_node_new.name, str(position)), info_node_new)
    def generate(self, node, file):
        """
        Generates the HTML code for an icon node.

        :param sdoc.sdoc2.node.IconNode.IconNode node: The icon node.
        :param file file: The output file.
        """
        attributes = IconNode.get_definition(node.argument)

        if attributes:
            img_element = Html.generate_void_element('img', attributes)
            file.write(img_element)
        else:
            NodeStore.error("There is no definition for icon with name '{}'".format(node.argument), node)
Beispiel #5
0
    def __check_document_info(info_node_current: Optional[int],
                              info_node_new: Node) -> None:
        """
        Checks if a document info node has been set already. If so, an error will be logged.

        :param int|None info_node_current: The current document info node (i.e. a property of the document).
        :param Node info_node_new: The (new) document info node.
        """
        if info_node_current:
            node = in_scope(info_node_current)
            position = node.position
            out_scope(node)

            NodeStore.error(
                "Document info {0} can be specified only once. Previous definition at {1}."
                .format(info_node_new.name, str(position)), info_node_new)
Beispiel #6
0
    def generate(self, node: IconNode, file: Any) -> None:
        """
        Generates the HTML code for an icon node.

        :param IconNode node: The icon node.
        :param any file: The output file.
        """
        attributes = IconNode.get_definition(node.argument)

        if attributes:
            img_element = Html.generate_void_element('img', attributes)
            file.write(img_element)
        else:
            NodeStore.error(
                "There is no definition for icon with name '{}'".format(
                    node.argument), node)