Completed
Pull Request — master (#48)
by Oleg
02:35
created

IconDefNode   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 46.15%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
dl 0
loc 52
ccs 6
cts 13
cp 0.4615
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A prepare_content_tree() 0 8 1
A is_inline_command() 0 7 1
A get_command() 0 7 1
A __init__() 0 9 1
A is_block_command() 0 7 1
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9 1
from sdoc.sdoc2.NodeStore import NodeStore
10 1
from sdoc.sdoc2.node.IconNode import IconNode
11 1
from sdoc.sdoc2.node.Node import Node
12
13
14 1
class IconDefNode(Node):
15
    """
16
    The class for definition of icons in sdoc2.
17
    """
18
19
    # ------------------------------------------------------------------------------------------------------------------
20 1
    def __init__(self, io, options, argument):
21
        """
22
        Object constructor.
23
24
        :param None|cleo.styles.output_style.OutputStyle io: The IO object.
25
        :param dict[str,str] options: The options of this figure.
26
        :param str argument: Not used.
27
        """
28
        super().__init__(io, 'icon_def', options, argument)
29
30
    # ------------------------------------------------------------------------------------------------------------------
31 1
    def get_command(self):
32
        """
33
        Returns the command of this node, i.e. icon_def.
34
35
        :rtype: str
36
        """
37
        return 'icon_def'
38
39
    # ------------------------------------------------------------------------------------------------------------------
40 1
    def is_block_command(self):
41
        """
42
        Returns False.
43
44
        :rtype: bool
45
        """
46
        return False
47
48
    # ------------------------------------------------------------------------------------------------------------------
49 1
    def is_inline_command(self):
50
        """
51
        Returns True.
52
53
        :rtype: bool
54
        """
55
        return True
56
57
    # ------------------------------------------------------------------------------------------------------------------
58 1
    def prepare_content_tree(self):
59
        """
60
        Prepares this node for further processing.
61
        """
62
        reference_name = self.argument
63
        attributes = self._options
64
65
        IconNode.add_definition(reference_name, attributes)
66
67
# ----------------------------------------------------------------------------------------------------------------------
68
NodeStore.register_inline_command('icon_def', IconDefNode)
69