Total Complexity | 1 |
Total Lines | 29 |
Duplicated Lines | 0 % |
Coverage | 80% |
Changes | 0 |
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.TitleNode import TitleNode |
|
6 | 1 | from sdoc.sdoc2.NodeStore import NodeStore |
|
7 | |||
8 | |||
9 | 1 | class TitleHtmlFormatter(HtmlFormatter): |
|
10 | """ |
||
11 | HtmlFormatter for generating HTML code for title of SDoc document. |
||
12 | """ |
||
13 | |||
14 | # ------------------------------------------------------------------------------------------------------------------ |
||
15 | 1 | def generate(self, node: TitleNode, file: Any) -> None: |
|
16 | """ |
||
17 | Generates HTML code for a title node. |
||
18 | |||
19 | :param TitleNode node: The title node. |
||
20 | :param any file: The output file. |
||
21 | """ |
||
22 | html_code = Html.generate_element('span', {}, node.argument) |
||
23 | |||
24 | file.write(html_code) |
||
25 | |||
26 | |||
27 | # ---------------------------------------------------------------------------------------------------------------------- |
||
28 | NodeStore.register_formatter('title', 'html', TitleHtmlFormatter) |
||
29 |