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.node.Node import Node |
11
|
|
|
|
12
|
|
|
|
13
|
1 |
|
class EndParagraphNode(Node): |
14
|
|
|
""" |
15
|
|
|
SDoc2 node for end of paragraphs. |
16
|
|
|
|
17
|
|
|
Note: End of paragraphs will are temporary used during the content tree preparation. Before and after the content |
18
|
|
|
preparation end of paragraph nodes do not exist. |
19
|
|
|
""" |
20
|
|
|
|
21
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
22
|
1 |
|
def __init__(self, io, options, argument): |
23
|
|
|
""" |
24
|
|
|
Object constructor. |
25
|
|
|
|
26
|
|
|
:param None|cleo.styles.output_style.OutputStyle io: The IO object. |
27
|
|
|
:param dict[str,str] options: Not used. |
28
|
|
|
:param str argument: Not used. |
29
|
|
|
""" |
30
|
1 |
|
super().__init__(io, 'end_paragraph', options, argument) |
31
|
|
|
|
32
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
33
|
1 |
|
def get_command(self): |
34
|
|
|
""" |
35
|
|
|
Returns the command of this node, i.e. end_paragraph. |
36
|
|
|
|
37
|
|
|
:rtype: str |
38
|
|
|
""" |
39
|
1 |
|
return 'end_paragraph' |
40
|
|
|
|
41
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
42
|
1 |
|
def is_block_command(self): |
43
|
|
|
""" |
44
|
|
|
Returns False. |
45
|
|
|
|
46
|
|
|
:rtype: bool |
47
|
|
|
""" |
48
|
|
|
return False |
49
|
|
|
|
50
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
51
|
1 |
|
def is_inline_command(self): |
52
|
|
|
""" |
53
|
|
|
Returns False. |
54
|
|
|
|
55
|
|
|
:rtype: bool |
56
|
|
|
""" |
57
|
|
|
return False |
58
|
|
|
|
59
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
60
|
1 |
|
def prepare_content_tree(self): |
61
|
|
|
""" |
62
|
|
|
Not implemented for end paragraph nodes. |
63
|
|
|
""" |
64
|
|
|
raise RuntimeError() |
65
|
|
|
|
66
|
|
|
|
67
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
68
|
|
|
NodeStore.register_inline_command('end_paragraph', EndParagraphNode) |
69
|
|
|
|