Bases: lpod.element.odf_element
The <office:change-info> element represents who made a change and when. It may also contain a comment (one or more <text:p> elements) on the change.
The comments available in the <office:change-info> element are available through :
- get_paragraphs and get_paragraph methods for actual odf_paragraph.
- get_comments for a plain text version
Get text content of the comments. If joined is True (default), the text of different paragraphs is concatenated, else a list of strings, one per paragraph, is returned.
Arguments:
joined – boolean (default is True)
Return: unicode or list of unicode.
Set the text content of the comments. If replace is True (default), the new text replace old comments, else it is added at the end.
Arguments:
text – unicode
replace – boolean
Set the creator of the change. Default for creator is ‘Unknown’.
Arguments:
creator – unicode (or None)
Set the date of the change. If date is None, use current time.
Arguments:
date – datetime
Bases: lpod.element.odf_element
The <text:change> element marks a position in an empty region where text has been deleted.
Shortcut to get the deleted informations stored in the <text:deletion> stored in the tracked changes.
Return: odf_paragraph (or None).”
Return None.
Return None.
Return None.
Bases: lpod.tracked_changes.odf_text_change
The <text:change-end> element marks the end of a region with content where text has been inserted or the format has been changed.
Return None.
Return self.
Return the content between text:change-start and text:change-end.
If no content exists (deletion tag), returns None (or u’’ 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 with headers By default: returns a list of odf_text or odf_element.
Arguments:
as_text – boolean
clean – boolean
no_header – boolean
Return: list or odf_paragraph or text
Return the corresponding annotation starting tag or None.
Bases: lpod.tracked_changes.odf_text_change_end
The <text:change-start> element marks the start of a region with content where text has been inserted or the format has been changed.
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 odf_text_change_start : delete also the end tag if exists.
Arguments:
child – odf_element
keep_tail – boolean (default to True), True for most usages.
Return the corresponding change-end tag or None.
Return self.
Bases: lpod.element.odf_element
Each <text:changed-region> element contains a single element, one of <text:insertion>, <text:deletion>, or <text:format-change> that corresponds to a change being tracked within the scope of the <text:tracked-changes> element that contains the <text:changed-region> instance. The xml:id attribute of the <text:changed-region> is referenced from the <text:change>, <text:change-start> and <text:change-end> elements that identify where the change applies to markup in the scope of the <text:tracked-changes> element.
once in the scope, which is different from ODF 1.2 requirement:
” A <text:changed-region> can be referenced by more than one change, but the corresponding referencing change mark elements shall be of the same change type - insertion, format change or deletion. “
Get the change element child. It can be either: <text:insertion>, <text:deletion>, or <text:format-change> as an odf_element object.
Return: odf_element.
Shortcut to get the <office:change-info> element of the change element child.
Return: odf_change_info element.
Get the text:id attribute.
Return: unicode
Shortcut to set the change_info element of the sub change element. See odf_text_insertion.set_change_info() for details.
Set both the text:id and xml:id attributes.
Bases: lpod.tracked_changes.odf_text_insertion
The <text:deletion> element contains information that identifies the person responsible for a deletion and the date of that deletion. This information may also contain one or more <text:p> elements which contains a comment on the deletion. The <text:deletion> element may also contain content that was deleted while change tracking was enabled. The position where the text was deleted is marked by a <text:change> element. Deleted text is contained in a paragraph element. To reconstruct the original text, the paragraph containing the deleted text is merged with its surrounding paragraph or heading element. To reconstruct the text before a deletion took place:
- If the change mark is inside a paragraph, insert the content that was
deleted, but remove all leading start tags up to and including the first <text:p> element and all trailing end tags up to and including the last </text:p> or </text:h> element. If the last trailing element is a </text:h>, change the end tag </text:p> following this insertion to a </text:h> element. - If the change mark is inside a heading, insert the content that was deleted, but remove all leading start tags up to and including the first <text:h> element and all trailing end tags up to and including the last </text:h> or </text:p> element. If the last trailing element is a </text:p>, change the end tag </text:h> following this insertion to a </text:p> element. - Otherwise, copy the text content of the <text:deletion> element in place of the change mark.
Get the deleted informations stored in the <text:deletion>. If as_text is True: returns the text content. If no_header is True: existing text:h are changed in text:p
Arguments:
as_text – boolean
no_header – boolean
Return: odf_paragraph and odf_header list
Return None (or u’‘).
Set the deleted informations stored in the <text:deletion>. An actual content that was deleted is expected, embeded in a odf_paragraph element or odf_header.
Arguments:
paragraph_or_list – odf_paragraph or odf_header element (or list)
Bases: lpod.tracked_changes.odf_text_insertion
The <text:format-change> element represents any change in formatting attributes. The region where the change took place is marked by <text:change-start>, <text:change-end> or <text:change> elements.
Note: This element does not contain formatting changes that have taken place.
Bases: lpod.element.odf_element
The <text:insertion> element contains the information that identifies the person responsible for a change and the date of that change. This information may also contain one or more <text:p> elements which contains a comment on the insertion. The <text:insertion> element’s parent <text:changed-region> element has an xml:id or text:id attribute, the value of which binds that parent element to the text:change-id attribute on the <text:change-start> and <text:change-end> elements.
Get the <office:change-info> child of the element.
Return: odf_change_info element.
Return: None.
Shortcut to text:change-start.get_inserted(). Return the content between text:change-start and text:change-end.
If no content exists (deletion tag), returns None (or u’’ if text flag is True). if pragraph is True: returns the content embedded in a paragraph odf_element. If text is True: returns the annotated text. By default: returns a list of odf_text or odf_element.
Arguments:
paragraph – boolean
text – boolean
Return: list or odf_paragraph or text
Set the change info element for the change element. If change_info is not provided, creator, date and comments will be used to build a suitable change info element. Default for creator is ‘Unknown’, default for date is current time and default for comments is no comment at all. The new change info element will replace any existant chenge info.
Arguments:
change_info – odf_change_info element (or None)
cretor – unicode (or None)
date – datetime (or None)
comments – list of odf_paragraph elements (or None)
Bases: lpod.element.odf_element
The <text:tracked-changes> element acts as a container for <text:changed-region> elements that represent changes in a certain scope of an OpenDocument document. This scope is the element in which the <text:tracked-changes> element occurs. Changes in this scope shall be tracked by <text:changed-region> elements contained in the <text:tracked-changes> element in this scope. If a <text:tracked-changes> element is absent, there are no tracked changes in the corresponding scope. In this case, all change mark elements in this scope shall be ignored.