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.IconNode import IconNode |
11
|
1 |
|
from sdoc.sdoc2.node.Node import Node |
12
|
|
|
|
13
|
|
|
|
14
|
1 |
|
class IconDefNode(Node): |
15
|
|
|
""" |
16
|
|
|
The class for definition of icons in sdoc2. |
17
|
|
|
""" |
18
|
|
|
|
19
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
20
|
1 |
|
def __init__(self, io, options, argument): |
21
|
|
|
""" |
22
|
|
|
Object constructor. |
23
|
|
|
|
24
|
|
|
:param None|cleo.styles.output_style.OutputStyle io: The IO object. |
25
|
|
|
:param dict[str,str] options: The options of this figure. |
26
|
|
|
:param str argument: Not used. |
27
|
|
|
""" |
28
|
|
|
super().__init__(io, 'icon_def', options, argument) |
29
|
|
|
|
30
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
31
|
1 |
|
def get_command(self): |
32
|
|
|
""" |
33
|
|
|
Returns the command of this node, i.e. icon_def. |
34
|
|
|
|
35
|
|
|
:rtype: str |
36
|
|
|
""" |
37
|
|
|
return 'icon_def' |
38
|
|
|
|
39
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
40
|
1 |
|
def is_block_command(self): |
41
|
|
|
""" |
42
|
|
|
Returns False. |
43
|
|
|
|
44
|
|
|
:rtype: bool |
45
|
|
|
""" |
46
|
|
|
return False |
47
|
|
|
|
48
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
49
|
1 |
|
def is_inline_command(self): |
50
|
|
|
""" |
51
|
|
|
Returns True. |
52
|
|
|
|
53
|
|
|
:rtype: bool |
54
|
|
|
""" |
55
|
|
|
return True |
56
|
|
|
|
57
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
58
|
1 |
|
def prepare_content_tree(self): |
59
|
|
|
""" |
60
|
|
|
Prepares this node for further processing. |
61
|
|
|
""" |
62
|
|
|
reference_name = self.argument |
63
|
|
|
attributes = self._options |
64
|
|
|
|
65
|
|
|
IconNode.add_definition(reference_name, attributes) |
66
|
|
|
|
67
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
68
|
|
|
NodeStore.register_inline_command('icon_def', IconDefNode) |
69
|
|
|
|