Passed
Push — master ( 4cb748...589c2a )
by P.R.
01:36
created

SmileHtmlFormatter.get_html()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1.037

Importance

Changes 0
Metric Value
eloc 3
dl 8
loc 8
ccs 2
cts 3
cp 0.6667
rs 10
c 0
b 0
f 0
cc 1
nop 0
crap 1.037
1 1
from typing import Any
2
3 1
from sdoc.helper.Html import Html
4 1
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter
5 1
from sdoc.sdoc2.node.SmileNode import SmileNode
6 1
from sdoc.sdoc2.NodeStore import NodeStore
7
8
9 1 View Code Duplication
class SmileHtmlFormatter(HtmlFormatter):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10
    """
11
    HtmlFormatter for generating HTML code for smile.
12
    """
13
14
    # ------------------------------------------------------------------------------------------------------------------
15 1
    def generate(self, node: SmileNode, file: Any) -> None:
16
        """
17
        Generates the HTML code for a smile node.
18
19
        :param SmileNode node: The smile node.
20
        :param any file: The output file.
21
        """
22
        file.write(SmileHtmlFormatter.get_html())
23
24
        HtmlFormatter.generate(self, node, file)
25
26
    # ------------------------------------------------------------------------------------------------------------------
27 1
    @staticmethod
28 1
    def get_html() -> str:
29
        """
30
        Returns string with generated HTML tag for smile.
31
32
        :rtype: str
33
        """
34
        return Html.generate_element('b', {}, 'SMILE')
35
36
37
# ----------------------------------------------------------------------------------------------------------------------
38
NodeStore.register_formatter('smile', 'html', SmileHtmlFormatter)
39