Passed
Push — master ( 1ac98c...ed1e15 )
by P.R.
01:49
created

TextHtmlFormatter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 1
c 1
b 1
f 0
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A generate() 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.NodeStore import NodeStore
11 1
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter
12
13
14 1
class TextHtmlFormatter(HtmlFormatter):
15
    """
16
    HtmlFormatter for generating HTML code for text.
17
    """
18
19
    # ------------------------------------------------------------------------------------------------------------------
20 1
    def generate(self, node, file):
21
        """
22
        Generates the HTML code for a text node.
23
24
        :param sdoc.sdoc2.node.TextNode.TextNode node: The text node.
25
        :param file file: The output file.
26
        """
27 1
        file.write(Html.escape(node.argument))
28
29 1
        HtmlFormatter.generate(self, node, file)
30
31
32
# ----------------------------------------------------------------------------------------------------------------------
33
NodeStore.register_formatter('TEXT', 'html', TextHtmlFormatter)
34