Passed
Branch master (0442a2)
by P.R.
02:00
created

DocumentNode   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
c 1
b 0
f 0
dl 0
loc 74
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A is_phrasing() 0 7 1
A get_hierarchy_name() 0 7 1
A get_hierarchy_level() 0 7 1
A is_inline_command() 0 7 1
A is_block_command() 0 7 1
A __init__() 0 7 1
A is_document_root() 0 6 1
A get_command() 0 7 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 DocumentNode(Node):
14
    """
15
    SDoc2 node for documents.
16
    """
17
    # ------------------------------------------------------------------------------------------------------------------
18
    def __init__(self, options):
19
        """
20
        Object constructor.
21
22
        :param dict[str,str] options: The options of this document.
23
        """
24
        super().__init__('document', options)
25
26
    # ------------------------------------------------------------------------------------------------------------------
27
    def get_command(self):
28
        """
29
        Returns the command of this node, i.e. document.
30
31
        :rtype: str
32
        """
33
        return 'document'
34
35
    # ------------------------------------------------------------------------------------------------------------------
36
    def get_hierarchy_level(self, parent_hierarchy_level=-1):
37
        """
38
        Returns 0.
39
40
        :rtype: int
41
        """
42
        return 1
43
44
    # ------------------------------------------------------------------------------------------------------------------
45
    def get_hierarchy_name(self):
46
        """
47
        Returns 'sectioning'.
48
49
        :rtype: str
50
        """
51
        return 'sectioning'
52
53
    # ------------------------------------------------------------------------------------------------------------------
54
    def is_block_command(self):
55
        """
56
        Returns True.
57
58
        :rtype: bool
59
        """
60
        return True
61
62
    # ------------------------------------------------------------------------------------------------------------------
63
    def is_document_root(self):
64
        """
65
        Returns True.
66
        :rtype: bool
67
        """
68
        return True
69
70
    # ------------------------------------------------------------------------------------------------------------------
71
    def is_inline_command(self):
72
        """
73
        Returns False.
74
75
        :rtype: bool
76
        """
77
        return False
78
79
    # ------------------------------------------------------------------------------------------------------------------
80
    def is_phrasing(self):
81
        """
82
        Returns False.
83
84
        :rtype: bool
85
        """
86
        return False
87
88
# ----------------------------------------------------------------------------------------------------------------------
89
node_store.register_block_command('document', DocumentNode)
90