Completed
Pull Request — master (#49)
by Oleg
02:03
created

TitleHtmlFormatter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
dl 0
loc 16
ccs 2
cts 4
cp 0.5
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 TitleHtmlFormatter(HtmlFormatter):
15
    """
16
    HtmlFormatter for generating HTML code for title of SDoc document.
17
    """
18
19
    # ------------------------------------------------------------------------------------------------------------------
20 1
    def generate(self, node, file):
21
        """
22
        Generates HTML code for a title node.
23
24
        :param sdoc.sdoc2.node.TitleNode.TitleNode node: The title node.
25
        :param file file: The output file.
26
        """
27
        html_code = Html.generate_element('span', {}, node.argument)
28
29
        file.write(html_code)
30
31
# ----------------------------------------------------------------------------------------------------------------------
32
NodeStore.register_formatter('title', 'html', TitleHtmlFormatter)
33