Svg
SvgTitle and SvgDescription classes for “svg:title” and “svg:desc” tags.
Classes:
| Name | Description |
|---|---|
SvgDescription |
Store a prose description of a graphic object that may be used to |
SvgMixin |
Mixin class for elements that can contain “svg:title” and “svg:desc”. |
SvgTitle |
Store a name for a graphic object. |
SvgDescription
Bases: Element
Store a prose description of a graphic object that may be used to support accessibility.
The “svg:desc” element has no ODF attributes, but the following property:
Attributes:
| Name | Type | Description |
|---|---|---|
description |
str
|
the description stored by the SvgDescription. |
Methods:
| Name | Description |
|---|---|
__init__ |
Create a SvgDescription, “svg:desc”. |
get_formatted_text |
Return a formatted text representation of the SvgDescription. |
Source code in odfdo/svg.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = ()
_tag
class-attribute
instance-attribute
_tag: str = 'svg:desc'
description
property
writable
description: str
Get or set the description stored by the SvgTitle.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The description stored. |
__init__
__init__(
description: str | None = None, **kwargs: Any
) -> None
Create a SvgDescription, “svg:desc”.
The “svg:desc” element is usable within the following elements: “dr3d:scene”, “draw:area-circle”, “draw:area-polygon”, “draw:area-rectangle”, “draw:caption”, “draw:circle”, “draw:connector”, “draw:control”, “draw:custom-shape”, “draw:ellipse”, “draw:frame”, “draw:g”, “draw:layer”, “draw:line”, “draw:measure”, “draw:page”, “draw:page-thumbnail”, “draw:path”, “draw:polygon”, “draw:polyline”, “draw:rect” and “draw:regular-polygon”.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
description
|
str | None
|
The description stored by the SvgDescription. |
None
|
Source code in odfdo/svg.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
get_formatted_text
get_formatted_text(context: dict | None = None) -> str
Return a formatted text representation of the SvgDescription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
dict | None
|
A dictionary of context variables for formatting. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The formatted text content. |
Source code in odfdo/svg.py
173 174 175 176 177 178 179 180 181 182 | |
SvgMixin
Bases: Element
Mixin class for elements that can contain “svg:title” and “svg:desc”.
This mixin provides methods to access and manipulate SvgTitle and SvgDescription.
Used by the following implemented classes
- “draw:connector”
- “draw:ellipse”
- “draw:frame”
- “draw:g”
- “draw:line”
- “draw:page”
- “draw:rect”
Attributes:
| Name | Type | Description |
|---|---|---|
svg_description |
str | None
|
Get or set the SVG description of the element. |
svg_title |
str | None
|
Get or set the SVG title of the element. |
Source code in odfdo/svg.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
svg_description
property
writable
svg_description: str | None
Get or set the SVG description of the element.
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The description string, or None if not present. |
svg_title
property
writable
svg_title: str | None
Get or set the SVG title of the element.
Returns:
| Type | Description |
|---|---|
str | None
|
str | None: The title string, or None if not present. |
SvgTitle
Bases: Element
Store a name for a graphic object.
The “svg:title” element has no ODF attributes, but the following property:
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str
|
the name stored by the SvgTitle. |
Methods:
| Name | Description |
|---|---|
__init__ |
Create a SvgTitle, “svg:title”. |
get_formatted_text |
Return a formatted text representation of the SvgTitle. |
Source code in odfdo/svg.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = ()
_tag
class-attribute
instance-attribute
_tag: str = 'svg:title'
title
property
writable
title: str
Get or set the name stored by the SvgTitle.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The name stored. |
__init__
__init__(title: str | None = None, **kwargs: Any) -> None
Create a SvgTitle, “svg:title”.
The “svg:title” element is usable within the following elements: “dr3d:scene”, “draw:area-circle”, “draw:area-polygon”, “draw:area-rectangle”, “draw:caption”, “draw:circle”, “draw:connector”, “draw:control”, “draw:custom-shape”, “draw:ellipse”, “draw:frame”, “draw:g”, “draw:layer”, “draw:line”, “draw:measure”, “draw:page”, “draw:page-thumbnail”, “draw:path”, “draw:polygon”, “draw:polyline”, “draw:rect” and “draw:regular-polygon”.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str | None
|
The name stored by the SvgTitle. |
None
|
Source code in odfdo/svg.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
get_formatted_text
get_formatted_text(context: dict | None = None) -> str
Return a formatted text representation of the SvgTitle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
dict | None
|
A dictionary of context variables for formatting. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The formatted text content. |
Source code in odfdo/svg.py
116 117 118 119 120 121 122 123 124 125 | |