12
12
CableMultiplier = str # = Literal['wirecount', 'terminations', 'length', 'total_length']
13
13
ImageScale = str # = Literal['false', 'true', 'width', 'height', 'both']
14
14
15
- Designator = str # Case insensitive unique name of connector or cable
16
- Pin = Union [int , str ] # Pin identifier
17
- Wire = Union [int , str ] # Wire number or 's' for shield
18
- MLstr = str # Multi-line string where any newline is properly handled
15
+ PlainText = str # Text not containing HTML tags nor newlines
16
+ Hypertext = str # Text possibly including HTML hyperlinks that are removed in all outputs except HTML output
17
+ MultilineHypertext = str # Hypertext possibly also including newlines to break lines in diagram output
18
+ Designator = PlainText # Case insensitive unique name of connector or cable
19
+ Pin = Union [int , PlainText ] # Pin identifier
20
+ Wire = Union [int , PlainText ] # Wire number or Literal['s'] for shield
19
21
Color = str # Two-letter color name = Literal[wv_colors._color_hex.keys()]
20
22
Colors = str # One or more two-letter color names (Color) concatenated into one string
21
23
ColorScheme = str # Color scheme name = Literal[wv_colors.COLOR_CODES.keys()]
@@ -34,7 +36,7 @@ class Image:
34
36
height : Optional [int ] = None
35
37
fixedsize : Optional [bool ] = None
36
38
# Contents of the text cell <td> just below the image cell:
37
- caption : Optional [MLstr ] = None
39
+ caption : Optional [MultilineHypertext ] = None
38
40
# See also HTML doc at https://graphviz.org/doc/info/shapes.html#html
39
41
40
42
def __post_init__ (self , gv_dir ):
@@ -60,11 +62,11 @@ def __post_init__(self, gv_dir):
60
62
61
63
@dataclass
62
64
class AdditionalComponent :
63
- type : MLstr
64
- subtype : Optional [MLstr ] = None
65
- manufacturer : Optional [MLstr ] = None
66
- mpn : Optional [MLstr ] = None
67
- pn : Optional [str ] = None
65
+ type : MultilineHypertext
66
+ subtype : Optional [MultilineHypertext ] = None
67
+ manufacturer : Optional [MultilineHypertext ] = None
68
+ mpn : Optional [MultilineHypertext ] = None
69
+ pn : Optional [Hypertext ] = None
68
70
qty : float = 1
69
71
unit : Optional [str ] = None
70
72
qty_multiplier : Union [ConnectorMultiplier , CableMultiplier , None ] = None
@@ -77,16 +79,16 @@ def description(self) -> str:
77
79
@dataclass
78
80
class Connector :
79
81
name : Designator
80
- manufacturer : Optional [MLstr ] = None
81
- mpn : Optional [MLstr ] = None
82
- pn : Optional [str ] = None
82
+ manufacturer : Optional [MultilineHypertext ] = None
83
+ mpn : Optional [MultilineHypertext ] = None
84
+ pn : Optional [Hypertext ] = None
83
85
style : Optional [str ] = None
84
86
category : Optional [str ] = None
85
- type : Optional [MLstr ] = None
86
- subtype : Optional [MLstr ] = None
87
+ type : Optional [MultilineHypertext ] = None
88
+ subtype : Optional [MultilineHypertext ] = None
87
89
pincount : Optional [int ] = None
88
90
image : Optional [Image ] = None
89
- notes : Optional [MLstr ] = None
91
+ notes : Optional [MultilineHypertext ] = None
90
92
pinlabels : List [Pin ] = field (default_factory = list )
91
93
pins : List [Pin ] = field (default_factory = list )
92
94
color : Optional [Color ] = None
@@ -167,11 +169,11 @@ def get_qty_multiplier(self, qty_multiplier: Optional[ConnectorMultiplier]) -> i
167
169
@dataclass
168
170
class Cable :
169
171
name : Designator
170
- manufacturer : Union [MLstr , List [MLstr ], None ] = None
171
- mpn : Union [MLstr , List [MLstr ], None ] = None
172
- pn : Union [str , List [str ], None ] = None
172
+ manufacturer : Union [MultilineHypertext , List [MultilineHypertext ], None ] = None
173
+ mpn : Union [MultilineHypertext , List [MultilineHypertext ], None ] = None
174
+ pn : Union [Hypertext , List [Hypertext ], None ] = None
173
175
category : Optional [str ] = None
174
- type : Optional [MLstr ] = None
176
+ type : Optional [MultilineHypertext ] = None
175
177
gauge : Optional [float ] = None
176
178
gauge_unit : Optional [str ] = None
177
179
show_equiv : bool = False
@@ -180,7 +182,7 @@ class Cable:
180
182
wirecount : Optional [int ] = None
181
183
shield : Union [bool , Color ] = False
182
184
image : Optional [Image ] = None
183
- notes : Optional [MLstr ] = None
185
+ notes : Optional [MultilineHypertext ] = None
184
186
colors : List [Colors ] = field (default_factory = list )
185
187
color_code : Optional [ColorScheme ] = None
186
188
show_name : bool = True
0 commit comments