1 | 1 | from typing import Dict |
|
2 | |||
3 | 1 | from cleo.io.io import IO |
|
4 | |||
5 | 1 | from sdoc.sdoc2.node.IconNode import IconNode |
|
6 | 1 | from sdoc.sdoc2.node.Node import Node |
|
7 | 1 | from sdoc.sdoc2.NodeStore import NodeStore |
|
8 | |||
9 | |||
10 | 1 | View Code Duplication | class IconDefNode(Node): |
0 ignored issues
–
show
Duplication
introduced
by
![]() |
|||
11 | """ |
||
12 | The class for definition of icons in sdoc2. |
||
13 | """ |
||
14 | |||
15 | # ------------------------------------------------------------------------------------------------------------------ |
||
16 | 1 | def __init__(self, io: IO, options: Dict[str, str], argument: str): |
|
17 | """ |
||
18 | Object constructor. |
||
19 | |||
20 | :param OutputStyle io: The IO object. |
||
21 | :param dict[str,str] options: The options of this figure. |
||
22 | :param str argument: Not used. |
||
23 | """ |
||
24 | super().__init__(io, 'icon_def', options, argument) |
||
25 | |||
26 | # ------------------------------------------------------------------------------------------------------------------ |
||
27 | 1 | def get_command(self) -> str: |
|
28 | """ |
||
29 | Returns the command of this node, i.e. icondef. |
||
30 | """ |
||
31 | return 'icondef' |
||
32 | |||
33 | # ------------------------------------------------------------------------------------------------------------------ |
||
34 | 1 | def is_block_command(self) -> bool: |
|
35 | """ |
||
36 | Returns False. |
||
37 | """ |
||
38 | return False |
||
39 | |||
40 | # ------------------------------------------------------------------------------------------------------------------ |
||
41 | 1 | def is_inline_command(self) -> bool: |
|
42 | """ |
||
43 | Returns True. |
||
44 | """ |
||
45 | return True |
||
46 | |||
47 | # ------------------------------------------------------------------------------------------------------------------ |
||
48 | 1 | def prepare_content_tree(self) -> None: |
|
49 | """ |
||
50 | Prepares this node for further processing. |
||
51 | """ |
||
52 | reference_name = self.argument |
||
53 | attributes = self._options |
||
54 | |||
55 | IconNode.add_definition(reference_name, attributes) |
||
56 | |||
57 | |||
58 | # ---------------------------------------------------------------------------------------------------------------------- |
||
59 | NodeStore.register_inline_command('icondef', IconDefNode) |
||
60 |