adder
This module contains the classes that represent adders.
Adders are used to add content to Obsidian notes.
Adder(fields: list[AdderField] = [])
Adder class.
Parameters:
-
fields
(list[AdderField]
, default:[]
) –The fields of the adder.
Source code in pyobsidian/adder.py
302 303 |
|
add_field(field: AdderField) -> Adder
Add a new adder field to the adder.
Parameters:
-
field
(AdderField
) –The field to be added.
Returns:
-
Adder
–The new adder.
Source code in pyobsidian/adder.py
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
AdderField(key: AdderKey, value: AdderValue, where: AdderFieldWhere)
dataclass
Class that represents an adder field.
AdderRegistry
Adder registry.
Consolidates AdderWhere along with its possible formatters. T
add_formatter(by: str, where: str, formatter: Formatter) -> dict[tuple[str, str], Formatter]
classmethod
Add a new adder formatter to Adder class.
Parameters:
-
by
(str
) –The key of the formatter.
-
where
(str
) –The where of the formatter.
-
formatter
(Formatter
) –The formatter to be added.
Returns:
-
dict[tuple[str, str], Formatter]
–The updated formatters.
Source code in pyobsidian/adder.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
|
add_registry(key: str, where: AdderWhere) -> dict[str, AdderWhere]
classmethod
Add a new where to the registry.
Parameters:
-
key
(str
) –The key of the where.
-
where
(AdderWhere
) –The where to add.
Source code in pyobsidian/adder.py
227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
get_formatter(by: str, where: AdderFieldWhere) -> Optional[Formatter]
classmethod
Get the adder formatter.
Parameters:
-
by
(str
) –The key of the formatter.
-
where
(AdderFieldWhere
) –The where of the formatter.
Returns:
-
Optional[Formatter]
–The formatter.
Source code in pyobsidian/adder.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
|
get_where(key: str | tuple) -> Optional[AdderWhere]
classmethod
Get the adder where.
Parameters:
-
key
(str
) –The key of the where.
Source code in pyobsidian/adder.py
214 215 216 217 218 219 220 221 222 223 224 225 |
|
AdderWhere
Bases: Protocol
Interface for adder where.
exec(note: Note, field: AdderField) -> Optional[str]
Execute the adder where.
Parameters:
-
note
(Note
) –The note to add the content to.
-
field
(AdderField
) –The field to add the content to.
Returns:
-
Optional[str]
–The content to add to the note.
Source code in pyobsidian/adder.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|