lpod.note

class lpod.note.odf_annotation(native_element, cache=None)

Bases: lpod.element.odf_element

check_validity()
delete(child=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 odf_annotation : delete the annotation-end tag if exists.

Arguments:

child – odf_element
get_annotated(as_text=False, no_header=True, clean=True)

Returns the annotated content from an annotation.

If no content exists (single position annotation or annotation-end not found), returns [] (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 without headers.

Arguments:

as_text – boolean

clean – boolean

no_header – boolean

Return: list or odf_element or text

get_body()
get_end()

Return the corresponding annotation-end tag or None.

get_name()
get_start()

Return self.

set_body(text_or_element)
set_name(name)
class lpod.note.odf_annotation_end(native_element, cache=None)

Bases: lpod.element.odf_element

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.

get_end()

Return self.

get_name()
get_start()

Return the corresponding annotation starting tag or None.

set_name(name)
class lpod.note.odf_note(native_element, cache=None)

Bases: lpod.element.odf_element

check_validity()
get_body()
get_citation()
get_class()
get_id()
set_body(text_or_element)
set_citation(text)
set_class(note_class)
set_id(note_id, *args, **kw)
lpod.note.get_unique_office_name(element=None)

Provide an autogenerated unique <office:name> for the document.

lpod.note.odf_create_annotation(text_or_element=None, creator=None, date=None, name=None, parent=None)

Create an 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 – unicode or odf_element

creator – unicode

date – datetime

name – unicode

parent – odf_element

Return: odf_element

lpod.note.odf_create_annotation_end(annotation=None, name=None)

Create an annotation-end element. Either annotation or name must be provided to have proper reference for the annotation-end.

Arguments:

annotation – odf_annotation element

name – unicode

Return: odf_element

lpod.note.odf_create_note(note_class='footnote', note_id=None, citation=None, body=None)

Create either a footnote or a endnote element with the given text, optionally referencing it using the given note_id.

Arguments:

note_class – ‘footnote’ or ‘endnote’

note_id – str

citation – unicode

body – unicode or odf_element

Return: odf_element

Previous topic

lpod.meta

Next topic

lpod.paragraph

This Page