Completed
Push — master ( 793cf7...172351 )
by P.R.
04:33
created

SmileHtmlFormatter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 27
ccs 3
cts 6
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A generate() 0 10 1
A get_html() 0 10 1
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9 1
from sdoc.helper.Html import Html
10 1
from sdoc.sdoc2 import node_store
11 1
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter
12
13
14 1
class SmileHtmlFormatter(HtmlFormatter):
15
    """
16
    HtmlFormatter for generating HTML code for smile.
17
    """
18
    # ------------------------------------------------------------------------------------------------------------------
19 1
    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
        HtmlFormatter.generate(self, node, file)
29
30
    # ------------------------------------------------------------------------------------------------------------------
31 1
    @staticmethod
32
    def get_html(node):
1 ignored issue
show
Unused Code introduced by
The argument node seems to be unused.
Loading history...
33
        """
34
        Returns string with generated HTML tag.
35
36
        :param sdoc.sdoc2.node.SmileNode.SmileNode node: The smile node.
37
38
        :rtype: str
39
        """
40
        return Html.generate_element('b', {}, 'SMILE')
41
42
# ----------------------------------------------------------------------------------------------------------------------
43
node_store.register_formatter('smile', 'html', SmileHtmlFormatter)
44