|
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 ReferenceNode(Node): |
|
14
|
|
|
""" |
|
15
|
|
|
SDoc2 node for references. |
|
16
|
|
|
""" |
|
17
|
|
|
|
|
18
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
19
|
1 |
|
def __init__(self, io, options, argument): |
|
20
|
|
|
""" |
|
21
|
|
|
Object constructor. |
|
22
|
|
|
|
|
23
|
|
|
:param None|cleo.styles.output_style.OutputStyle io: The IO object. |
|
24
|
|
|
:param dict[str,str] options: The options of this reference. |
|
25
|
|
|
:param str argument: The title of this reference. |
|
26
|
|
|
""" |
|
27
|
1 |
|
super().__init__(io, 'ref', options, argument) |
|
28
|
|
|
|
|
29
|
1 |
|
self.text = '' |
|
30
|
1 |
|
""" |
|
31
|
|
|
The text of a reference. |
|
32
|
|
|
|
|
33
|
|
|
:type: str |
|
34
|
|
|
""" |
|
35
|
|
|
|
|
36
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
37
|
1 |
|
def get_command(self): |
|
38
|
|
|
""" |
|
39
|
|
|
Returns the command of this node, i.e. reference. |
|
40
|
|
|
|
|
41
|
|
|
:rtype: str |
|
42
|
|
|
""" |
|
43
|
1 |
|
return 'ref' |
|
44
|
|
|
|
|
45
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
46
|
1 |
|
def is_block_command(self): |
|
47
|
|
|
""" |
|
48
|
|
|
Returns False. |
|
49
|
|
|
|
|
50
|
|
|
:rtype: bool |
|
51
|
|
|
""" |
|
52
|
1 |
|
return False |
|
53
|
|
|
|
|
54
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
55
|
1 |
|
def is_inline_command(self): |
|
56
|
|
|
""" |
|
57
|
|
|
Returns True. |
|
58
|
|
|
|
|
59
|
|
|
:rtype: bool |
|
60
|
|
|
""" |
|
61
|
|
|
return True |
|
62
|
|
|
|
|
63
|
|
|
# ------------------------------------------------------------------------------------------------------------------ |
|
64
|
1 |
|
def is_phrasing(self): |
|
65
|
|
|
""" |
|
66
|
|
|
Returns True. |
|
67
|
|
|
|
|
68
|
|
|
:rtype: bool |
|
69
|
|
|
""" |
|
70
|
1 |
|
return True |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
# ---------------------------------------------------------------------------------------------------------------------- |
|
74
|
|
|
NodeStore.register_inline_command('ref', ReferenceNode) |
|
75
|
|
|
|