|
1
|
|
|
""" |
|
2
|
|
|
SDoc |
|
3
|
|
|
|
|
4
|
|
|
Copyright 2016 Set Based IT Consultancy |
|
5
|
|
|
|
|
6
|
|
|
Licence MIT |
|
7
|
|
|
""" |
|
8
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
9
|
1 |
|
from sdoc.sdoc2.NodeStore import NodeStore |
|
10
|
1 |
|
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
1 |
|
class UnknownHtmlFormatter(HtmlFormatter): |
|
14
|
|
|
""" |
|
15
|
|
|
HtmlFormatter for unknown SDoc2 node types. |
|
16
|
|
|
""" |
|
17
|
|
|
|
|
18
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
19
|
1 |
|
def generate(self, node, file): |
|
20
|
|
|
""" |
|
21
|
|
|
Generates the HTML code for a paragraph node. |
|
22
|
|
|
|
|
23
|
|
|
:param sdoc.sdoc2.node.Node.Node node: The unknown node. |
|
24
|
|
|
:param file file: The output file. |
|
25
|
|
|
""" |
|
26
|
1 |
|
self.write_into_file(node) |
|
27
|
|
|
|
|
28
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
29
|
1 |
|
def generate_chapter(self, node, file): |
|
30
|
|
|
""" |
|
31
|
|
|
Generates the HTML code for a paragraph node. |
|
32
|
|
|
|
|
33
|
|
|
:param sdoc.sdoc2.node.Node.Node node: The unknown node. |
|
34
|
|
|
:param file file: The output file. |
|
35
|
|
|
""" |
|
36
|
|
|
if file: |
|
37
|
|
|
self.write_into_file(node) |
|
38
|
|
|
|
|
39
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
40
|
1 |
|
def write_into_file(self, node): |
|
41
|
|
|
""" |
|
42
|
|
|
Writes into opened file. |
|
43
|
|
|
|
|
44
|
|
|
:param sdoc.sdoc2.node.Node.Node node: The unknown node. |
|
45
|
|
|
""" |
|
46
|
1 |
|
self.error('Unknown SDoc2 command {0}'.format(node.name), node) |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
50
|
|
|
NodeStore.register_formatter('unknown', 'html', UnknownHtmlFormatter) |
|
51
|
|
|
|