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

DateHtmlFormatter.generate()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.2963

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 10
ccs 1
cts 3
cp 0.3333
rs 10
c 0
b 0
f 0
cc 1
nop 3
crap 1.2963
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.DateNode import DateNode
6 1
from sdoc.sdoc2.NodeStore import NodeStore
7
8
9 1
class DateHtmlFormatter(HtmlFormatter):
10
    """
11
    HtmlFormatter for generating HTML code for date of SDoc document.
12
    """
13
14
    # ------------------------------------------------------------------------------------------------------------------
15 1
    def generate(self, node: DateNode, file: Any) -> None:
16
        """
17
        Generates HTML code for a date node.
18
19
        :param DateNode node: The date node.
20
        :param any file: The output file.
21
        """
22
        html = Html.generate_element('span', {}, node.argument)
23
24
        file.write(html)
25
26
27
# ----------------------------------------------------------------------------------------------------------------------
28
NodeStore.register_formatter('date', 'html', DateHtmlFormatter)
29