OPFSpine

The OPF <spine> element.

class yael.opfspine.OPFSpine(internal_path=None, obj=None, string=None)[source]

Build the OPF <spine> element or parse it from obj or string.

add_itemref(itemref)[source]

Add the given <itemref> to the spine.

Parameters:item (yael.opfitemref.OPFItemref) – the <itemref> to be added
index_by_idref(v_idref)[source]

Return the index in the spine of the <itemref> child with given idref.

Parameters:v_idref (str) – the desired idref
Returns:the index, or -1 if not found
Return type:int
itemref_by_id(v_id)[source]

Return the <itemref> child with given id.

Parameters:v_id (str) – the desired id
Returns:the child with given id, or None if not found
Return type:yael.opfitemref.OPFItemref
itemref_by_idref(v_idref)[source]

Return the <itemref> child with given idref.

Parameters:v_idref (str) – the desired idref
Returns:the child with given id, or None if not found
Return type:yael.opfitemref.OPFItemref
itemrefs

The list of <itemref> objects in this spine.

Return type:list of yael.opfitemref.OPFItemref objects
linear_index_by_idref(v_idref)[source]

Return the index in the linear spine of the <itemref> child with given idref.

Parameters:v_idref (str) – the desired idref
Returns:the index, or -1 if not found
Return type:int
linear_itemrefs

The list of <itemref> objects in this spine, with linear=”yes” (or omitted) attribute.

Return type:list of yael.opfitemref.OPFItemref objects
v_id

The value of the id attribute.

Return type:str
v_ppd

The value of the page-progression-direction attribute.

Return type:str
v_toc

The value of the toc attribute.

Return type:str