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

TextHtmlFormatter.generate_chapter()   A

Complexity

Conditions 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 3.6875

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 1
cts 4
cp 0.25
rs 9.4285
c 0
b 0
f 0
cc 2
crap 3.6875
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 TextHtmlFormatter(HtmlFormatter):
15
    """
16
    HtmlFormatter for generating HTML code for text.
17
    """
18
    # ------------------------------------------------------------------------------------------------------------------
19 1
    def generate(self, node, file):
20
        """
21
        Generates the HTML code for a text node.
22
23
        :param sdoc.sdoc2.node.TextNode.TextNode node: The text node.
24
        :param file file: The output file.
25
        """
26
        file.write(Html.escape(node.argument))
27
28
        HtmlFormatter.generate(self, node, file)
29
30
# ----------------------------------------------------------------------------------------------------------------------
31
node_store.register_formatter('TEXT', 'html', TextHtmlFormatter)
32