Completed
Pull Request — master (#17)
by
unknown
01:20
created

sdoc.sdoc2.node.LabelNode   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %
Metric Value
dl 0
loc 41
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A is_block_command() 0 7 1
A is_inline_command() 0 7 1
A get_command() 0 7 1
A __init__() 0 8 1
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9
from sdoc.sdoc2 import node_store
10
from sdoc.sdoc2.node.Node import Node
11
12
13
class LabelNode(Node):
14
    """
15
    SDoc2 node for labels.
16
    """
17
18
    # ------------------------------------------------------------------------------------------------------------------
19
    def __init__(self, options, argument):
20
        """
21
        Object constructor.
22
23
        :param dict[str,str] options: The options of this label.
24
        :param str argument: The title of this label.
25
        """
26
        super().__init__('label', options, argument)
27
28
    # ------------------------------------------------------------------------------------------------------------------
29
    def get_command(self):
30
        """
31
        Returns the command of this node, i.e. label.
32
33
        :rtype: str
34
        """
35
        return 'label'
36
37
    # ------------------------------------------------------------------------------------------------------------------
38
    def is_block_command(self):
39
        """
40
        Returns False.
41
42
        :rtype: bool
43
        """
44
        return False
45
46
    # ------------------------------------------------------------------------------------------------------------------
47
    def is_inline_command(self):
48
        """
49
        Returns True.
50
51
        :rtype: bool
52
        """
53
        return True
54
55
# ----------------------------------------------------------------------------------------------------------------------
56
node_store.register_inline_command('label', LabelNode)
57