Completed
Push — master ( 4c8e7d...ffbd85 )
by P.R.
01:53
created

SmileHtmlFormatter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A generate() 0 10 1
A generate_chapter() 0 11 2
A get_html() 0 10 1
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9
from sdoc.helper.Html import Html
10
from sdoc.sdoc2 import node_store
11
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter
12
13
14
class SmileHtmlFormatter(HtmlFormatter):
15
    """
16
    HtmlFormatter for generating HTML code for smile.
17
    """
18
    # ------------------------------------------------------------------------------------------------------------------
19
    def generate(self, node, file):
20
        """
21
        Generates the HTML code for a smile node.
22
23
        :param sdoc.sdoc2.node.SmileNode.SmileNode node: The smile node.
24
        :param file file: The output file.
25
        """
26
        file.write(SmileHtmlFormatter.get_html(node))
27
28
        super().generate(node, file)
29
30
    # ------------------------------------------------------------------------------------------------------------------
31
    def generate_chapter(self, node, file):
32
        """
33
        Generates the HTML code for a smile node.
34
35
        :param sdoc.sdoc2.node.SmileNode.SmileNode node: The smile node.
36
        :param file file: The output file.
37
        """
38
        if file:
39
            file.write(SmileHtmlFormatter.get_html(node))
40
41
        super().generate_chapter(node, file)
42
43
    # ------------------------------------------------------------------------------------------------------------------
44
    @staticmethod
45
    def get_html(node):
1 ignored issue
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
46
        """
47
        Returns string with generated HTML tag.
48
49
        :param sdoc.sdoc2.node.SmileNode.SmileNode node: The smile node.
50
51
        :rtype: str
52
        """
53
        return Html.generate_element('b', {}, 'SMILE')
54
55
# ----------------------------------------------------------------------------------------------------------------------
56
node_store.register_formatter('smile', 'html', SmileHtmlFormatter)
57