66
@@ -10327,6 +10342,11 @@
smil_fadeColor – forward, reverse
smil_mode – in, out
+
+
+
+
+
Source code in odfdo/smil.py
94
@@ -10470,7 +10490,7 @@
- Bases: Element , DcCreatorMixin , DcDateMixin
+ Bases: MDTail , Element , DcCreatorMixin , DcDateMixin
Annotation element credited to the given creator with the
@@ -10489,10 +10509,14 @@
parent -- Element
+
+
+
+
+
Source code in odfdo/note.py
- 148
-149
+ 149
150
151
152
@@ -10654,170 +10678,171 @@
308
309
310
-311 | class Annotation(Element, DcCreatorMixin, DcDateMixin):
- """Annotation element credited to the given creator with the
- given text, optionally dated (current date by default).
- If name not provided and some parent is provided, the name is
- autogenerated.
-
- Arguments:
-
- text -- str or odf_element
-
- creator -- str
-
- date -- datetime
-
- name -- str
-
- parent -- Element
- """
-
- _tag = "office:annotation"
- _properties = (
- PropDef("name", "office:name"),
- PropDef("note_id", "text:id"),
- )
-
- def __init__(
- self,
- text_or_element: Element | str | None = None,
- creator: str | None = None,
- date: datetime | None = None,
- name: str | None = None,
- parent: Element | None = None,
- **kwargs: Any,
- ) -> None:
- # fixme : use offset
- # TODO allow paragraph and text styles
- super().__init__(**kwargs)
-
- if self._do_init:
- self.note_body = text_or_element # type:ignore
- if creator:
- self.creator = creator
- if date is None:
- date = datetime.now()
- self.date = date
- if not name:
- name = get_unique_office_name(parent)
- self.name = name
-
- @property
- def dc_creator(self) -> str | None:
- """Alias for self.creator property."""
- return self.creator
-
- @dc_creator.setter
- def dc_creator(self, creator: str) -> None:
- self.creator = creator
-
- @property
- def dc_date(self) -> datetime | None:
- """Alias for self.date property."""
- return self.date
-
- @dc_date.setter
- def dc_date(self, dtdate: datetime) -> None:
- self.date = dtdate
-
- @property
- def note_body(self) -> str:
- return self.text_content
-
- @note_body.setter
- def note_body(self, text_or_element: Element | str | None) -> None:
- if text_or_element is None:
- self.text_content = ""
- elif isinstance(text_or_element, str):
- self.text_content = text_or_element
- elif isinstance(text_or_element, Element):
- self.clear()
- self.append(text_or_element)
- else:
- raise TypeError(f'Unexpected type for body: "{type(text_or_element)}"')
-
- @property
- def start(self) -> Element:
- """Return self."""
- return self
-
- @property
- def end(self) -> Element | None:
- """Return the corresponding annotation-end tag or None."""
- name = self.name
- parent = self.parent
- if parent is None:
- raise ValueError("Can't find end tag: no parent available")
- body = self.document_body
- if not body:
- body = parent
- return body.get_annotation_end(name=name)
-
- def get_annotated(
- self,
- as_text: bool = False,
- no_header: bool = True,
- clean: bool = True,
- ) -> Element | list | str | None:
- """Returns the annotated content from an annotation.
-
- If no content exists (single position annotation or annotation-end not
- found), returns [] (or "" if text flag is True).
- If as_text is True: returns the text content.
- If clean is True: suppress unwanted tags (deletions marks, ...)
- If no_header is True: existing text:h are changed in text:p
- By default: returns a list of odf_element, cleaned and without headers.
-
- Arguments:
-
- as_text -- boolean
-
- clean -- boolean
-
- no_header -- boolean
-
- Return: list or Element or text or None
- """
- end = self.end
- if end is None:
- if as_text:
- return ""
- return None
- body = self.document_body
- if not body:
- body = self.root
- return body.get_between(
- self, end, as_text=as_text, no_header=no_header, clean=clean
- )
-
- def delete(self, child: Element | None = None, keep_tail: bool = True) -> None:
- """Delete the given element from the XML tree. If no element is given,
- "self" is deleted. The XML library may allow to continue to use an
- element now "orphan" as long as you have a reference to it.
-
- For Annotation : delete the annotation-end tag if exists.
-
- Arguments:
-
- child -- Element or None
- """
- if child is not None: # act like normal delete
- super().delete(child)
- return
- end = self.end
- if end:
- end.delete()
- # act like normal delete
- super().delete()
-
- def check_validity(self) -> None:
- if not self.note_body:
- raise ValueError("Annotation must have a body")
- if not self.dc_creator:
- raise ValueError("Annotation must have a creator")
- if not self.dc_date:
- self.dc_date = datetime.now()
+311
+312
| class Annotation(MDTail, Element, DcCreatorMixin, DcDateMixin):
+ """Annotation element credited to the given creator with the
+ given text, optionally dated (current date by default).
+ If name not provided and some parent is provided, the name is
+ autogenerated.
+
+ Arguments:
+
+ text -- str or odf_element
+
+ creator -- str
+
+ date -- datetime
+
+ name -- str
+
+ parent -- Element
+ """
+
+ _tag = "office:annotation"
+ _properties = (
+ PropDef("name", "office:name"),
+ PropDef("note_id", "text:id"),
+ )
+
+ def __init__(
+ self,
+ text_or_element: Element | str | None = None,
+ creator: str | None = None,
+ date: datetime | None = None,
+ name: str | None = None,
+ parent: Element | None = None,
+ **kwargs: Any,
+ ) -> None:
+ # fixme : use offset
+ # TODO allow paragraph and text styles
+ super().__init__(**kwargs)
+
+ if self._do_init:
+ self.note_body = text_or_element # type:ignore
+ if creator:
+ self.creator = creator
+ if date is None:
+ date = datetime.now()
+ self.date = date
+ if not name:
+ name = get_unique_office_name(parent)
+ self.name = name
+
+ @property
+ def dc_creator(self) -> str | None:
+ """Alias for self.creator property."""
+ return self.creator
+
+ @dc_creator.setter
+ def dc_creator(self, creator: str) -> None:
+ self.creator = creator
+
+ @property
+ def dc_date(self) -> datetime | None:
+ """Alias for self.date property."""
+ return self.date
+
+ @dc_date.setter
+ def dc_date(self, dtdate: datetime) -> None:
+ self.date = dtdate
+
+ @property
+ def note_body(self) -> str:
+ return self.text_content
+
+ @note_body.setter
+ def note_body(self, text_or_element: Element | str | None) -> None:
+ if text_or_element is None:
+ self.text_content = ""
+ elif isinstance(text_or_element, str):
+ self.text_content = text_or_element
+ elif isinstance(text_or_element, Element):
+ self.clear()
+ self.append(text_or_element)
+ else:
+ raise TypeError(f'Unexpected type for body: "{type(text_or_element)}"')
+
+ @property
+ def start(self) -> Element:
+ """Return self."""
+ return self
+
+ @property
+ def end(self) -> Element | None:
+ """Return the corresponding annotation-end tag or None."""
+ name = self.name
+ parent = self.parent
+ if parent is None:
+ raise ValueError("Can't find end tag: no parent available")
+ body = self.document_body
+ if not body:
+ body = parent
+ return body.get_annotation_end(name=name)
+
+ def get_annotated(
+ self,
+ as_text: bool = False,
+ no_header: bool = True,
+ clean: bool = True,
+ ) -> Element | list | str | None:
+ """Returns the annotated content from an annotation.
+
+ If no content exists (single position annotation or annotation-end not
+ found), returns [] (or "" if text flag is True).
+ If as_text is True: returns the text content.
+ If clean is True: suppress unwanted tags (deletions marks, ...)
+ If no_header is True: existing text:h are changed in text:p
+ By default: returns a list of odf_element, cleaned and without headers.
+
+ Arguments:
+
+ as_text -- boolean
+
+ clean -- boolean
+
+ no_header -- boolean
+
+ Return: list or Element or text or None
+ """
+ end = self.end
+ if end is None:
+ if as_text:
+ return ""
+ return None
+ body = self.document_body
+ if not body:
+ body = self.root
+ return body.get_between(
+ self, end, as_text=as_text, no_header=no_header, clean=clean
+ )
+
+ def delete(self, child: Element | None = None, keep_tail: bool = True) -> None:
+ """Delete the given element from the XML tree. If no element is given,
+ "self" is deleted. The XML library may allow to continue to use an
+ element now "orphan" as long as you have a reference to it.
+
+ For Annotation : delete the annotation-end tag if exists.
+
+ Arguments:
+
+ child -- Element or None
+ """
+ if child is not None: # act like normal delete
+ super().delete(child)
+ return
+ end = self.end
+ if end:
+ end.delete()
+ # act like normal delete
+ super().delete()
+
+ def check_validity(self) -> None:
+ if not self.note_body:
+ raise ValueError("Annotation must have a body")
+ if not self.dc_creator:
+ raise ValueError("Annotation must have a creator")
+ if not self.dc_date:
+ self.dc_date = datetime.now()
|
@@ -10940,8 +10965,7 @@
Source code in odfdo/note.py
- 285
-286
+ 286
287
288
289
@@ -10958,25 +10982,26 @@
300
301
302
-303 | def delete(self, child: Element | None = None, keep_tail: bool = True) -> None:
- """Delete the given element from the XML tree. If no element is given,
- "self" is deleted. The XML library may allow to continue to use an
- element now "orphan" as long as you have a reference to it.
-
- For Annotation : delete the annotation-end tag if exists.
-
- Arguments:
-
- child -- Element or None
- """
- if child is not None: # act like normal delete
- super().delete(child)
- return
- end = self.end
- if end:
- end.delete()
- # act like normal delete
- super().delete()
+303
+304
| def delete(self, child: Element | None = None, keep_tail: bool = True) -> None:
+ """Delete the given element from the XML tree. If no element is given,
+ "self" is deleted. The XML library may allow to continue to use an
+ element now "orphan" as long as you have a reference to it.
+
+ For Annotation : delete the annotation-end tag if exists.
+
+ Arguments:
+
+ child -- Element or None
+ """
+ if child is not None: # act like normal delete
+ super().delete(child)
+ return
+ end = self.end
+ if end:
+ end.delete()
+ # act like normal delete
+ super().delete()
|
@@ -11012,8 +11037,7 @@
Source code in odfdo/note.py
- 248
-249
+ 249
250
251
252
@@ -11047,42 +11071,43 @@
280
281
282
-283 | def get_annotated(
- self,
- as_text: bool = False,
- no_header: bool = True,
- clean: bool = True,
-) -> Element | list | str | None:
- """Returns the annotated content from an annotation.
-
- If no content exists (single position annotation or annotation-end not
- found), returns [] (or "" if text flag is True).
- If as_text is True: returns the text content.
- If clean is True: suppress unwanted tags (deletions marks, ...)
- If no_header is True: existing text:h are changed in text:p
- By default: returns a list of odf_element, cleaned and without headers.
-
- Arguments:
-
- as_text -- boolean
-
- clean -- boolean
-
- no_header -- boolean
-
- Return: list or Element or text or None
- """
- end = self.end
- if end is None:
- if as_text:
- return ""
- return None
- body = self.document_body
- if not body:
- body = self.root
- return body.get_between(
- self, end, as_text=as_text, no_header=no_header, clean=clean
- )
+283
+284
| def get_annotated(
+ self,
+ as_text: bool = False,
+ no_header: bool = True,
+ clean: bool = True,
+) -> Element | list | str | None:
+ """Returns the annotated content from an annotation.
+
+ If no content exists (single position annotation or annotation-end not
+ found), returns [] (or "" if text flag is True).
+ If as_text is True: returns the text content.
+ If clean is True: suppress unwanted tags (deletions marks, ...)
+ If no_header is True: existing text:h are changed in text:p
+ By default: returns a list of odf_element, cleaned and without headers.
+
+ Arguments:
+
+ as_text -- boolean
+
+ clean -- boolean
+
+ no_header -- boolean
+
+ Return: list or Element or text or None
+ """
+ end = self.end
+ if end is None:
+ if as_text:
+ return ""
+ return None
+ body = self.document_body
+ if not body:
+ body = self.root
+ return body.get_between(
+ self, end, as_text=as_text, no_header=no_header, clean=clean
+ )
|
@@ -11110,7 +11135,7 @@
- Bases: Element
+ Bases: MDTail , Element
AnnotationEnd: the “office:annotation-end” element may be used to
@@ -11123,10 +11148,14 @@
element. An “office:annotation-end” element without a preceding
“office:annotation” element that has the same name assigned is ignored.
+
+
+
+
+
Source code in odfdo/note.py
- 317
-318
+ 318
319
320
321
@@ -11180,62 +11209,63 @@
369
370
371
-372 | class AnnotationEnd(Element):
- """AnnotationEnd: the "office:annotation-end" element may be used to
- define the end of a text range of document content that spans element
- boundaries. In that case, an "office:annotation" element shall precede
- the "office:annotation-end" element. Both elements shall have the same
- value for their office:name attribute. The "office:annotation-end" element
- shall be preceded by an "office:annotation" element that has the same
- value for its office:name attribute as the "office:annotation-end"
- element. An "office:annotation-end" element without a preceding
- "office:annotation" element that has the same name assigned is ignored.
- """
-
- _tag = "office:annotation-end"
- _properties = (PropDef("name", "office:name"),)
-
- def __init__(
- self,
- annotation: Element | None = None,
- name: str | None = None,
- **kwargs: Any,
- ) -> None:
- """Initialize an AnnotationEnd element. Either annotation or name must be
- provided to have proper reference for the annotation-end.
-
- Arguments:
-
- annotation -- odf_annotation element
-
- name -- str
- """
- # fixme : use offset
- # TODO allow paragraph and text styles
- super().__init__(**kwargs)
- if self._do_init:
- if annotation:
- name = annotation.name # type: ignore
- if not name:
- raise ValueError("Annotation-end must have a name")
- self.name = name
-
- @property
- def start(self) -> Element | None:
- """Return the corresponding annotation starting tag or None."""
- name = self.name
- parent = self.parent
- if parent is None:
- raise ValueError("Can't find start tag: no parent available")
- body = self.document_body
- if not body:
- body = parent
- return body.get_annotation(name=name)
-
- @property
- def end(self) -> Element:
- """Return self."""
- return self
+372
+373
| class AnnotationEnd(MDTail, Element):
+ """AnnotationEnd: the "office:annotation-end" element may be used to
+ define the end of a text range of document content that spans element
+ boundaries. In that case, an "office:annotation" element shall precede
+ the "office:annotation-end" element. Both elements shall have the same
+ value for their office:name attribute. The "office:annotation-end" element
+ shall be preceded by an "office:annotation" element that has the same
+ value for its office:name attribute as the "office:annotation-end"
+ element. An "office:annotation-end" element without a preceding
+ "office:annotation" element that has the same name assigned is ignored.
+ """
+
+ _tag = "office:annotation-end"
+ _properties = (PropDef("name", "office:name"),)
+
+ def __init__(
+ self,
+ annotation: Element | None = None,
+ name: str | None = None,
+ **kwargs: Any,
+ ) -> None:
+ """Initialize an AnnotationEnd element. Either annotation or name must be
+ provided to have proper reference for the annotation-end.
+
+ Arguments:
+
+ annotation -- odf_annotation element
+
+ name -- str
+ """
+ # fixme : use offset
+ # TODO allow paragraph and text styles
+ super().__init__(**kwargs)
+ if self._do_init:
+ if annotation:
+ name = annotation.name # type: ignore
+ if not name:
+ raise ValueError("Annotation-end must have a name")
+ self.name = name
+
+ @property
+ def start(self) -> Element | None:
+ """Return the corresponding annotation starting tag or None."""
+ name = self.name
+ parent = self.parent
+ if parent is None:
+ raise ValueError("Can't find start tag: no parent available")
+ body = self.document_body
+ if not body:
+ body = parent
+ return body.get_annotation(name=name)
+
+ @property
+ def end(self) -> Element:
+ """Return self."""
+ return self
|
@@ -11314,8 +11344,7 @@
Source code in odfdo/note.py
- 332
-333
+ 333
334
335
336
@@ -11337,30 +11366,31 @@
352
353
354
-355 | def __init__(
- self,
- annotation: Element | None = None,
- name: str | None = None,
- **kwargs: Any,
-) -> None:
- """Initialize an AnnotationEnd element. Either annotation or name must be
- provided to have proper reference for the annotation-end.
-
- Arguments:
-
- annotation -- odf_annotation element
-
- name -- str
- """
- # fixme : use offset
- # TODO allow paragraph and text styles
- super().__init__(**kwargs)
- if self._do_init:
- if annotation:
- name = annotation.name # type: ignore
- if not name:
- raise ValueError("Annotation-end must have a name")
- self.name = name
+355
+356
| def __init__(
+ self,
+ annotation: Element | None = None,
+ name: str | None = None,
+ **kwargs: Any,
+) -> None:
+ """Initialize an AnnotationEnd element. Either annotation or name must be
+ provided to have proper reference for the annotation-end.
+
+ Arguments:
+
+ annotation -- odf_annotation element
+
+ name -- str
+ """
+ # fixme : use offset
+ # TODO allow paragraph and text styles
+ super().__init__(**kwargs)
+ if self._do_init:
+ if annotation:
+ name = annotation.name # type: ignore
+ if not name:
+ raise ValueError("Annotation-end must have a name")
+ self.name = name
|
@@ -11394,6 +11424,11 @@
Body, specialized class of Element in charge of actual content
management.
+
+
+
+
+
Source code in odfdo/body.py
27
@@ -11735,6 +11770,11 @@
+
+
+
+
+
Source code in odfdo/bookmark.py
30
@@ -11812,6 +11852,11 @@
+
+
+
+
+
Source code in odfdo/bookmark.py
72
@@ -11889,6 +11934,11 @@
+
+
+
+
+
Source code in odfdo/bookmark.py
51
@@ -11963,6 +12013,11 @@
“table:table-cell” table cell element.
+
+
+
+
+
Source code in odfdo/cell.py
43
@@ -13274,6 +13329,11 @@
creator – str (or None)
date – datetime (or None)
+
+
+
+
+
Source code in odfdo/tracked_changes.py
37
@@ -13565,6 +13625,11 @@
Chart, specialized class of Element in charge of actual content
management.
+
+
+
+
+
Source code in odfdo/body.py
93
@@ -13623,6 +13688,11 @@
ODF table column “table:table-column”
+
+
+
+
+
Source code in odfdo/table.py
171
@@ -14188,6 +14258,11 @@
p2 -- (str, str)
+
+
+
+
+
Source code in odfdo/shapes.py
241
@@ -14364,6 +14439,11 @@
Representation of the ODF file.
+
+
+
+
+
Source code in odfdo/container.py
62
@@ -15674,6 +15754,11 @@
Bases: XmlPart
+
+
+
+
+
Source code in odfdo/content.py
33
@@ -16017,6 +16102,11 @@
Database, specialized class of Element in charge of actual content
management.
+
+
+
+
+
Source code in odfdo/body.py
103
@@ -16093,10 +16183,14 @@
To explicitly create a document from a custom template, use the
Document.new(path) method whose argument is the path to the template file.
+
+
+
+
+
Source code in odfdo/document.py
- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|