|
1
|
1 |
|
from typing import Dict |
|
2
|
|
|
|
|
3
|
1 |
|
from cleo.styles import OutputStyle |
|
4
|
|
|
|
|
5
|
1 |
|
from sdoc.sdoc2.node.Node import Node |
|
6
|
1 |
|
from sdoc.sdoc2.NodeStore import NodeStore |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
1 |
View Code Duplication |
class LineBreakNode(Node): |
|
|
|
|
|
|
10
|
|
|
""" |
|
11
|
|
|
SDoc2 node for line breaks. |
|
12
|
|
|
""" |
|
13
|
|
|
|
|
14
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
15
|
1 |
|
def __init__(self, io: OutputStyle, options: Dict[str, str], argument: str): |
|
16
|
|
|
""" |
|
17
|
|
|
Object constructor. |
|
18
|
|
|
|
|
19
|
|
|
:param OutputStyle io: The IO object. |
|
20
|
|
|
:param dict[str,str] options: The options of this smile. |
|
21
|
|
|
:param str argument: Not used. |
|
22
|
|
|
""" |
|
23
|
|
|
super().__init__(io, 'br', options, argument) |
|
24
|
|
|
|
|
25
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
26
|
1 |
|
def get_command(self) -> str: |
|
27
|
|
|
""" |
|
28
|
|
|
Returns the command of this node, i.e. br. |
|
29
|
|
|
""" |
|
30
|
|
|
return 'br' |
|
31
|
|
|
|
|
32
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
33
|
1 |
|
def is_block_command(self) -> bool: |
|
34
|
|
|
""" |
|
35
|
|
|
Returns False. |
|
36
|
|
|
""" |
|
37
|
|
|
return False |
|
38
|
|
|
|
|
39
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
40
|
1 |
|
def is_inline_command(self) -> bool: |
|
41
|
|
|
""" |
|
42
|
|
|
Returns True. |
|
43
|
|
|
""" |
|
44
|
|
|
return True |
|
45
|
|
|
|
|
46
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
47
|
1 |
|
def is_phrasing(self) -> bool: |
|
48
|
|
|
""" |
|
49
|
|
|
Returns True. |
|
50
|
|
|
""" |
|
51
|
|
|
return True |
|
52
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
55
|
|
|
NodeStore.register_inline_command('br', LineBreakNode) |
|
56
|
|
|
|