Meta Template
MetaTemplate class for “meta:template” tag.
Classes:
| Name | Description |
|---|---|
MetaTemplate |
Container for the meta template properties, “meta:template”. |
MetaTemplate
Bases: Element
Container for the meta template properties, “meta:template”.
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize a MetaTemplate element. |
__repr__ |
|
__str__ |
|
as_dict |
Return the attributes of the template element as a Python dictionary. |
from_dict |
Set the attributes of the template element from a Python dictionary. |
Attributes:
| Name | Type | Description |
|---|---|---|
actuate |
|
|
href |
|
|
title |
|
|
type |
|
Source code in odfdo/meta_template.py
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 70 71 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 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = (
PropDef("date", "meta:date"),
PropDef("actuate", "xlink:actuate"),
PropDef("href", "xlink:href"),
PropDef("title", "xlink:title"),
PropDef("type", "xlink:type"),
)
_tag
class-attribute
instance-attribute
_tag = 'meta:template'
actuate
instance-attribute
actuate = 'onRequest'
href
instance-attribute
href = href
title
instance-attribute
title = title
type
instance-attribute
type = 'simple'
__init__
__init__(
date: datetime | None = None,
href: str = "",
title: str = "",
**kwargs: Any,
) -> None
Initialize a MetaTemplate element.
The meta:template element specifies a URI for the document template
that was used to create a document. The URI is specified as an XLink.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
datetime | None
|
The date and time when the template was used. |
None
|
href
|
str
|
The URI for the document template (XLink). |
''
|
title
|
str
|
The title of the document template (XLink). |
''
|
**kwargs
|
Any
|
Additional keyword arguments for the parent |
{}
|
Source code in odfdo/meta_template.py
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 | |
__repr__
__repr__() -> str
Source code in odfdo/meta_template.py
70 71 | |
__str__
__str__() -> str
Source code in odfdo/meta_template.py
73 74 75 76 | |
_set_date
_set_date(date: datetime | None) -> None
Set the meta:date attribute from a datetime object.
Converts the datetime to an ODF date-time string. If date is
None, it defaults to the current UTC time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
datetime | None
|
The date and time to set. |
required |
Source code in odfdo/meta_template.py
78 79 80 81 82 83 84 85 86 87 88 89 | |
as_dict
as_dict() -> dict[str, Any]
Return the attributes of the template element as a Python dictionary.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the meta template attributes, with keys like “meta:date”, “xlink:href”, etc. |
Source code in odfdo/meta_template.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
from_dict
from_dict(data: dict[str, Any]) -> None
Set the attributes of the template element from a Python dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
A dictionary containing the meta template attributes (e.g., “meta:date”, “xlink:href”). |
required |
Source code in odfdo/meta_template.py
111 112 113 114 115 116 117 118 119 120 121 122 | |