ParagraphHtmlFormatter.generate()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nop 3
crap 1
1 1
from typing import Any
2
3 1
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter
4 1
from sdoc.sdoc2.node.ParagraphNode import ParagraphNode
5 1
from sdoc.sdoc2.NodeStore import NodeStore
6
7
8 1
class ParagraphHtmlFormatter(HtmlFormatter):
9
    """
10
    HtmlFormatter for generating HTML code for paragraph.
11
    """
12
13
    # ------------------------------------------------------------------------------------------------------------------
14 1
    def generate(self, node: ParagraphNode, file: Any) -> None:
15
        """
16
        Generates the HTML code for a paragraph node.
17
18
        :param ParagraphNode node: The paragraph node.
19
        :param any file: The output file.
20
        """
21 1
        file.write('<p>')
22 1
        HtmlFormatter.generate(self, node, file)
23 1
        file.write('</p>')
24
25
26
# ----------------------------------------------------------------------------------------------------------------------
27
NodeStore.register_formatter('paragraph', 'html', ParagraphHtmlFormatter)
28