ODFPY 1.2.0
 
Loading...
Searching...
No Matches
odf.odf2xhtml.ODF2XHTML Class Reference

The ODF2XHTML parses an ODF file and produces XHTML. More...

Inheritance diagram for odf.odf2xhtml.ODF2XHTML:
Collaboration diagram for odf.odf2xhtml.ODF2XHTML:

Public Member Functions

 __init__ (self, generate_css=True, embedable=False)
 
 set_plain (self)
 Tell the parser to not generate CSS.
 
 set_embedable (self)
 Tells the converter to only output the parts inside the <body>
 
 add_style_file (self, stylefilename, media=None)
 Add a link to an external style file.
 
 writeout (self, s)
 
 writedata (self)
 
 opentag (self, tag, attrs={}, block=False)
 Create an open HTML tag.
 
 closetag (self, tag, block=True)
 Close an open HTML tag.
 
 emptytag (self, tag, attrs={})
 
 characters (self, data)
 
 startElementNS (self, tag, qname, attrs)
 
 endElementNS (self, tag, qname)
 
 handle_starttag (self, tag, method, attrs)
 
 handle_endtag (self, tag, attrs, method)
 
 unknown_starttag (self, tag, attrs)
 
 unknown_endtag (self, tag, attrs)
 
 s_ignorexml (self, tag, attrs)
 Ignore this xml element and all children of it It will automatically stop ignoring.
 
 s_ignorecont (self, tag, attrs)
 Stop processing the text nodes.
 
 s_processcont (self, tag, attrs)
 Start processing the text nodes.
 
 classname (self, attrs)
 Generate a class name from a style name.
 
 get_anchor (self, name)
 Create a unique anchor id for a href name.
 
 purgedata (self)
 
 e_dc_title (self, tag, attrs)
 Get the title from the meta data and create a HTML <title>
 
 e_dc_metatag (self, tag, attrs)
 Any other meta data is added as a <meta> element.
 
 e_dc_contentlanguage (self, tag, attrs)
 Set the content language.
 
 e_dc_creator (self, tag, attrs)
 Set the content creator.
 
 s_custom_shape (self, tag, attrs)
 A <draw:custom-shape> is made into a.
 
 e_custom_shape (self, tag, attrs)
 End the <draw:frame>
 
 s_draw_frame (self, tag, attrs)
 A <draw:frame> is made into a.
 
 e_draw_frame (self, tag, attrs)
 End the <draw:frame>
 
 s_draw_fill_image (self, tag, attrs)
 
 rewritelink (self, imghref)
 Intended to be overloaded if you don't store your pictures in a Pictures subfolder.
 
 s_draw_image (self, tag, attrs)
 A <draw:image> becomes an element.
 
 s_draw_object (self, tag, attrs)
 A <draw:object> is embedded object in the document (e.g.
 
 s_draw_object_ole (self, tag, attrs)
 A <draw:object-ole> is embedded OLE object in the document (e.g.
 
 s_draw_page (self, tag, attrs)
 A <draw:page> is a slide in a presentation.
 
 e_draw_page (self, tag, attrs)
 
 s_draw_textbox (self, tag, attrs)
 
 e_draw_textbox (self, tag, attrs)
 End the <draw:text-box>
 
 html_body (self, tag, attrs)
 
 generate_stylesheet (self)
 
 generate_footnotes (self)
 
 s_office_automatic_styles (self, tag, attrs)
 
 s_office_document_content (self, tag, attrs)
 First tag in the content.xml file.
 
 e_office_document_content (self, tag, attrs)
 Last tag.
 
 s_office_master_styles (self, tag, attrs)
 
 s_office_presentation (self, tag, attrs)
 For some odd reason, OpenOffice Impress doesn't define a default-style for the 'paragraph'.
 
 e_office_presentation (self, tag, attrs)
 
 s_office_spreadsheet (self, tag, attrs)
 
 e_office_spreadsheet (self, tag, attrs)
 
 s_office_styles (self, tag, attrs)
 
 s_office_text (self, tag, attrs)
 OpenDocument text.
 
 e_office_text (self, tag, attrs)
 
 s_style_handle_properties (self, tag, attrs)
 Copy all attributes to a struct.
 
 s_style_default_style (self, tag, attrs)
 A default style is like a style on an HTML tag.
 
 e_style_default_style (self, tag, attrs)
 
 s_style_font_face (self, tag, attrs)
 It is possible that the HTML browser doesn't know how to show a particular font.
 
 s_style_footer (self, tag, attrs)
 
 e_style_footer (self, tag, attrs)
 
 s_style_footer_style (self, tag, attrs)
 
 s_style_header (self, tag, attrs)
 
 e_style_header (self, tag, attrs)
 
 s_style_header_style (self, tag, attrs)
 
 s_style_default_page_layout (self, tag, attrs)
 Collect the formatting for the default page layout style.
 
 s_style_page_layout (self, tag, attrs)
 Collect the formatting for the page layout style.
 
 e_style_page_layout (self, tag, attrs)
 End this style.
 
 s_style_master_page (self, tag, attrs)
 Collect the formatting for the page layout style.
 
 s_style_style (self, tag, attrs)
 Collect the formatting for the style.
 
 e_style_style (self, tag, attrs)
 End this style.
 
 s_table_table (self, tag, attrs)
 Start a table.
 
 e_table_table (self, tag, attrs)
 End a table.
 
 s_table_table_cell (self, tag, attrs)
 Start a table cell.
 
 e_table_table_cell (self, tag, attrs)
 End a table cell.
 
 s_table_table_column (self, tag, attrs)
 Start a table column.
 
 s_table_table_row (self, tag, attrs)
 Start a table row.
 
 e_table_table_row (self, tag, attrs)
 End a table row.
 
 s_text_a (self, tag, attrs)
 Anchors start.
 
 e_text_a (self, tag, attrs)
 End an anchor or bookmark reference.
 
 s_text_bookmark (self, tag, attrs)
 Bookmark definition.
 
 s_text_bookmark_ref (self, tag, attrs)
 Bookmark reference.
 
 s_text_h (self, tag, attrs)
 Headings start.
 
 e_text_h (self, tag, attrs)
 Headings end Side If there is no title in the metadata, then it is taken from the first heading of any level.
 
 s_text_line_break (self, tag, attrs)
 Force a line break (
)
 
 s_text_list (self, tag, attrs)
 Start a list (.
 
 e_text_list (self, tag, attrs)
 End a list.
 
 s_text_list_item (self, tag, attrs)
 Start list item.
 
 e_text_list_item (self, tag, attrs)
 End list item.
 
 s_text_list_level_style_bullet (self, tag, attrs)
 CSS doesn't have the ability to set the glyph to a particular character, so we just go through the available glyphs.
 
 e_text_list_level_style_bullet (self, tag, attrs)
 
 s_text_list_level_style_number (self, tag, attrs)
 
 e_text_list_level_style_number (self, tag, attrs)
 
 s_text_note (self, tag, attrs)
 
 e_text_note (self, tag, attrs)
 
 collectnote (self, s)
 
 s_text_note_body (self, tag, attrs)
 
 e_text_note_body (self, tag, attrs)
 
 e_text_note_citation (self, tag, attrs)
 
 s_text_p (self, tag, attrs)
 Paragraph.
 
 e_text_p (self, tag, attrs)
 End Paragraph.
 
 s_text_s (self, tag, attrs)
 Generate a number of spaces.
 
 s_text_span (self, tag, attrs)
 The <text:span> element matches the element in HTML.
 
 e_text_span (self, tag, attrs)
 End the <text:span>
 
 s_text_tab (self, tag, attrs)
 Move to the next tabstop.
 
 s_text_x_source (self, tag, attrs)
 Various indexes and tables of contents.
 
 e_text_x_source (self, tag, attrs)
 Various indexes and tables of contents.
 
 load (self, odffile)
 Loads a document into the parser and parses it.
 
 odf2xhtml (self, odffile)
 Load a file and return the XHTML.
 
 xhtml (self)
 Returns the xhtml.
 
 css (self)
 Returns the CSS content.
 
 save (self, outputfile, addsuffix=False)
 Save the HTML under the filename.
 

Public Attributes

bool generate_css = generate_css
 
dict elements
 
bool use_internal_css = False
 
 stylefilename = stylefilename
 
dict notedict = {}
 
int currentnote = 0
 
str notebody = ''
 
list lines = []
 
str xmlfile = ''
 
str title = ''
 
str language = ''
 
str creator = ''
 
list data = []
 
 tagstack = TagStack()
 
list htmlstack = []
 
list pstack = []
 
bool processelem = True
 
bool processcont = True
 
dict listtypes = {}
 
list headinglevels = [0, 0,0,0,0,0, 0,0,0,0,0]
 
 cs = StyleToCSS()
 
dict anchors = {}
 
list stylestack = []
 
dict styledict = {}
 
str currentstyle = None
 
list metatags = []
 
list processcont
 
dict processelem = self.elements.get(tag, (None, None) )[0]
 
str anchors = "anchor%03d" % (len(self.anchors) + 1)
 
str generate_css = "char":
 
dict stylestack = self.styledict.get(name)
 
dict generate_css = self.notedict[key]
 
str autoprefix = "A"
 
dict currentstyle = {}
 
str prevstyle = self.currentstyle
 
dict currentnote = {}
 
str _wfunc = ''.join(self.notebody)
 
 document = load(odffile)
 

Static Public Attributes

str default_styles
 
dict familymap
 

Protected Member Functions

 _resetfootnotes (self)
 
 _resetobject (self)
 
 _walknode (self, node)
 
 _wlines (self, s)
 
 _writecss (self, s)
 
 _writenothing (self, s)
 

Protected Attributes

 _wfunc = self._wlines
 
 _orgwfunc = self._wfunc
 
list _csslines = []
 

Static Protected Attributes

dict _familyshort
 

Detailed Description

The ODF2XHTML parses an ODF file and produces XHTML.

Definition at line 346 of file odf2xhtml.py.

Constructor & Destructor Documentation

◆ __init__()

odf.odf2xhtml.ODF2XHTML.__init__ ( self,
generate_css = True,
embedable = False )

Reimplemented in odf.odf2xhtml.ODF2XHTMLembedded.

Definition at line 348 of file odf2xhtml.py.

Member Function Documentation

◆ _resetfootnotes()

odf.odf2xhtml.ODF2XHTML._resetfootnotes ( self)
protected

Definition at line 474 of file odf2xhtml.py.

◆ _resetobject()

odf.odf2xhtml.ODF2XHTML._resetobject ( self)
protected

Definition at line 480 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ _walknode()

odf.odf2xhtml.ODF2XHTML._walknode ( self,
node )
protected

Definition at line 1454 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _wlines()

odf.odf2xhtml.ODF2XHTML._wlines ( self,
s )
protected

Definition at line 1483 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ _writecss()

odf.odf2xhtml.ODF2XHTML._writecss ( self,
s )
protected

Definition at line 1491 of file odf2xhtml.py.

◆ _writenothing()

odf.odf2xhtml.ODF2XHTML._writenothing ( self,
s )
protected

Definition at line 1494 of file odf2xhtml.py.

◆ add_style_file()

odf.odf2xhtml.ODF2XHTML.add_style_file ( self,
stylefilename,
media = None )

Add a link to an external style file.

Also turns of the embedding of styles in the HTML

Definition at line 466 of file odf2xhtml.py.

◆ characters()

odf.odf2xhtml.ODF2XHTML.characters ( self,
data )

Definition at line 548 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ classname()

odf.odf2xhtml.ODF2XHTML.classname ( self,
attrs )

Generate a class name from a style name.

Definition at line 600 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ closetag()

odf.odf2xhtml.ODF2XHTML.closetag ( self,
tag,
block = True )

Close an open HTML tag.

Definition at line 533 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collectnote()

odf.odf2xhtml.ODF2XHTML.collectnote ( self,
s )

Definition at line 1325 of file odf2xhtml.py.

◆ css()

odf.odf2xhtml.ODF2XHTML.css ( self)

Returns the CSS content.

Definition at line 1498 of file odf2xhtml.py.

◆ e_custom_shape()

odf.odf2xhtml.ODF2XHTML.e_custom_shape ( self,
tag,
attrs )

End the <draw:frame>

Definition at line 682 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_dc_contentlanguage()

odf.odf2xhtml.ODF2XHTML.e_dc_contentlanguage ( self,
tag,
attrs )

Set the content language.

Identifies the targeted audience

Definition at line 637 of file odf2xhtml.py.

◆ e_dc_creator()

odf.odf2xhtml.ODF2XHTML.e_dc_creator ( self,
tag,
attrs )

Set the content creator.

Identifies the targeted audience

Definition at line 644 of file odf2xhtml.py.

◆ e_dc_metatag()

odf.odf2xhtml.ODF2XHTML.e_dc_metatag ( self,
tag,
attrs )

Any other meta data is added as a <meta> element.

Definition at line 631 of file odf2xhtml.py.

◆ e_dc_title()

odf.odf2xhtml.ODF2XHTML.e_dc_title ( self,
tag,
attrs )

Get the title from the meta data and create a HTML <title>

Definition at line 624 of file odf2xhtml.py.

◆ e_draw_frame()

odf.odf2xhtml.ODF2XHTML.e_draw_frame ( self,
tag,
attrs )

End the <draw:frame>

Definition at line 718 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_draw_page()

odf.odf2xhtml.ODF2XHTML.e_draw_page ( self,
tag,
attrs )

Definition at line 790 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_draw_textbox()

odf.odf2xhtml.ODF2XHTML.e_draw_textbox ( self,
tag,
attrs )

End the <draw:text-box>

Definition at line 802 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_office_document_content()

odf.odf2xhtml.ODF2XHTML.e_office_document_content ( self,
tag,
attrs )

Last tag.

Definition at line 888 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_office_presentation()

odf.odf2xhtml.ODF2XHTML.e_office_presentation ( self,
tag,
attrs )

Definition at line 903 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_office_spreadsheet()

odf.odf2xhtml.ODF2XHTML.e_office_spreadsheet ( self,
tag,
attrs )

Definition at line 910 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_office_text()

odf.odf2xhtml.ODF2XHTML.e_office_text ( self,
tag,
attrs )

Definition at line 922 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_style_default_style()

odf.odf2xhtml.ODF2XHTML.e_style_default_style ( self,
tag,
attrs )

Definition at line 948 of file odf2xhtml.py.

◆ e_style_footer()

odf.odf2xhtml.ODF2XHTML.e_style_footer ( self,
tag,
attrs )

Definition at line 967 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_style_header()

odf.odf2xhtml.ODF2XHTML.e_style_header ( self,
tag,
attrs )

Definition at line 981 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_style_page_layout()

odf.odf2xhtml.ODF2XHTML.e_style_page_layout ( self,
tag,
attrs )

End this style.

Definition at line 1011 of file odf2xhtml.py.

◆ e_style_style()

odf.odf2xhtml.ODF2XHTML.e_style_style ( self,
tag,
attrs )

End this style.

Definition at line 1078 of file odf2xhtml.py.

◆ e_table_table()

odf.odf2xhtml.ODF2XHTML.e_table_table ( self,
tag,
attrs )

End a table.

Definition at line 1094 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_table_table_cell()

odf.odf2xhtml.ODF2XHTML.e_table_table_cell ( self,
tag,
attrs )

End a table cell.

Definition at line 1118 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_table_table_row()

odf.odf2xhtml.ODF2XHTML.e_table_table_row ( self,
tag,
attrs )

End a table row.

Definition at line 1145 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_a()

odf.odf2xhtml.ODF2XHTML.e_text_a ( self,
tag,
attrs )

End an anchor or bookmark reference.

Definition at line 1160 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_h()

odf.odf2xhtml.ODF2XHTML.e_text_h ( self,
tag,
attrs )

Headings end Side If there is no title in the metadata, then it is taken from the first heading of any level.

Definition at line 1202 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_list()

odf.odf2xhtml.ODF2XHTML.e_text_list ( self,
tag,
attrs )

End a list.

Definition at line 1245 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_list_item()

odf.odf2xhtml.ODF2XHTML.e_text_list_item ( self,
tag,
attrs )

End list item.

Definition at line 1266 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_list_level_style_bullet()

odf.odf2xhtml.ODF2XHTML.e_text_list_level_style_bullet ( self,
tag,
attrs )

Definition at line 1289 of file odf2xhtml.py.

◆ e_text_list_level_style_number()

odf.odf2xhtml.ODF2XHTML.e_text_list_level_style_number ( self,
tag,
attrs )

Definition at line 1311 of file odf2xhtml.py.

◆ e_text_note()

odf.odf2xhtml.ODF2XHTML.e_text_note ( self,
tag,
attrs )

Definition at line 1322 of file odf2xhtml.py.

◆ e_text_note_body()

odf.odf2xhtml.ODF2XHTML.e_text_note_body ( self,
tag,
attrs )

Definition at line 1333 of file odf2xhtml.py.

◆ e_text_note_citation()

odf.odf2xhtml.ODF2XHTML.e_text_note_citation ( self,
tag,
attrs )

Definition at line 1339 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_p()

odf.odf2xhtml.ODF2XHTML.e_text_p ( self,
tag,
attrs )

End Paragraph.

Definition at line 1372 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_span()

odf.odf2xhtml.ODF2XHTML.e_text_span ( self,
tag,
attrs )

End the <text:span>

Definition at line 1408 of file odf2xhtml.py.

Here is the call graph for this function:

◆ e_text_x_source()

odf.odf2xhtml.ODF2XHTML.e_text_x_source ( self,
tag,
attrs )

Various indexes and tables of contents.

We ignore those.

Definition at line 1429 of file odf2xhtml.py.

Here is the call graph for this function:

◆ emptytag()

odf.odf2xhtml.ODF2XHTML.emptytag ( self,
tag,
attrs = {} )

Definition at line 539 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ endElementNS()

odf.odf2xhtml.ODF2XHTML.endElementNS ( self,
tag,
qname )

Definition at line 562 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_footnotes()

odf.odf2xhtml.ODF2XHTML.generate_footnotes ( self)

Definition at line 852 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ generate_stylesheet()

odf.odf2xhtml.ODF2XHTML.generate_stylesheet ( self)

Definition at line 824 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ get_anchor()

odf.odf2xhtml.ODF2XHTML.get_anchor ( self,
name )

Create a unique anchor id for a href name.

Definition at line 606 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ handle_endtag()

odf.odf2xhtml.ODF2XHTML.handle_endtag ( self,
tag,
attrs,
method )

Definition at line 576 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ handle_starttag()

odf.odf2xhtml.ODF2XHTML.handle_starttag ( self,
tag,
method,
attrs )

Definition at line 573 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ html_body()

odf.odf2xhtml.ODF2XHTML.html_body ( self,
tag,
attrs )

Definition at line 805 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ load()

odf.odf2xhtml.ODF2XHTML.load ( self,
odffile )

Loads a document into the parser and parses it.

The argument can either be a filename or a document in memory.

Parameters
odffileif the type is unicode string: name of a file; else it must be an open file type

Definition at line 1446 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ odf2xhtml()

odf.odf2xhtml.ODF2XHTML.odf2xhtml ( self,
odffile )

Load a file and return the XHTML.

Parameters
odffileif the type is unicode string: name of a file; else it must be an open file type
Returns
XHTML code as a a unicode string

Definition at line 1473 of file odf2xhtml.py.

Here is the call graph for this function:

◆ opentag()

odf.odf2xhtml.ODF2XHTML.opentag ( self,
tag,
attrs = {},
block = False )

Create an open HTML tag.

Definition at line 520 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ purgedata()

odf.odf2xhtml.ODF2XHTML.purgedata ( self)

Definition at line 614 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ rewritelink()

odf.odf2xhtml.ODF2XHTML.rewritelink ( self,
imghref )

Intended to be overloaded if you don't store your pictures in a Pictures subfolder.

Definition at line 730 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ s_custom_shape()

odf.odf2xhtml.ODF2XHTML.s_custom_shape ( self,
tag,
attrs )

A <draw:custom-shape> is made into a.

in HTML which is then styled

Definition at line 651 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_fill_image()

odf.odf2xhtml.ODF2XHTML.s_draw_fill_image ( self,
tag,
attrs )

Definition at line 721 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_frame()

odf.odf2xhtml.ODF2XHTML.s_draw_frame ( self,
tag,
attrs )

A <draw:frame> is made into a.

in HTML which is then styled

Definition at line 687 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_image()

odf.odf2xhtml.ODF2XHTML.s_draw_image ( self,
tag,
attrs )

A <draw:image> becomes an element.

Definition at line 735 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_object()

odf.odf2xhtml.ODF2XHTML.s_draw_object ( self,
tag,
attrs )

A <draw:object> is embedded object in the document (e.g.

spreadsheet in presentation).

Definition at line 748 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_object_ole()

odf.odf2xhtml.ODF2XHTML.s_draw_object_ole ( self,
tag,
attrs )

A <draw:object-ole> is embedded OLE object in the document (e.g.

MS Graph).

Definition at line 765 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_page()

odf.odf2xhtml.ODF2XHTML.s_draw_page ( self,
tag,
attrs )

A <draw:page> is a slide in a presentation.

We use a <fieldset> element in HTML. Therefore if you convert a ODP file, you get a series of <fieldset>s. Override this for your own purpose.

Definition at line 776 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_draw_textbox()

odf.odf2xhtml.ODF2XHTML.s_draw_textbox ( self,
tag,
attrs )

Definition at line 793 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_ignorecont()

odf.odf2xhtml.ODF2XHTML.s_ignorecont ( self,
tag,
attrs )

Stop processing the text nodes.

Definition at line 592 of file odf2xhtml.py.

◆ s_ignorexml()

odf.odf2xhtml.ODF2XHTML.s_ignorexml ( self,
tag,
attrs )

Ignore this xml element and all children of it It will automatically stop ignoring.

Definition at line 588 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ s_office_automatic_styles()

odf.odf2xhtml.ODF2XHTML.s_office_automatic_styles ( self,
tag,
attrs )

Definition at line 870 of file odf2xhtml.py.

◆ s_office_document_content()

odf.odf2xhtml.ODF2XHTML.s_office_document_content ( self,
tag,
attrs )

First tag in the content.xml file.

Definition at line 877 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_office_master_styles()

odf.odf2xhtml.ODF2XHTML.s_office_master_styles ( self,
tag,
attrs )
 

Definition at line 891 of file odf2xhtml.py.

◆ s_office_presentation()

odf.odf2xhtml.ODF2XHTML.s_office_presentation ( self,
tag,
attrs )

For some odd reason, OpenOffice Impress doesn't define a default-style for the 'paragraph'.

We therefore force a standard when we see it is a presentation

Definition at line 898 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_office_spreadsheet()

odf.odf2xhtml.ODF2XHTML.s_office_spreadsheet ( self,
tag,
attrs )

Definition at line 907 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_office_styles()

odf.odf2xhtml.ODF2XHTML.s_office_styles ( self,
tag,
attrs )

Definition at line 914 of file odf2xhtml.py.

◆ s_office_text()

odf.odf2xhtml.ODF2XHTML.s_office_text ( self,
tag,
attrs )

OpenDocument text.

Definition at line 918 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_processcont()

odf.odf2xhtml.ODF2XHTML.s_processcont ( self,
tag,
attrs )

Start processing the text nodes.

Definition at line 596 of file odf2xhtml.py.

◆ s_style_default_page_layout()

odf.odf2xhtml.ODF2XHTML.s_style_default_page_layout ( self,
tag,
attrs )

Collect the formatting for the default page layout style.

Definition at line 993 of file odf2xhtml.py.

◆ s_style_default_style()

odf.odf2xhtml.ODF2XHTML.s_style_default_style ( self,
tag,
attrs )

A default style is like a style on an HTML tag.

Definition at line 941 of file odf2xhtml.py.

◆ s_style_font_face()

odf.odf2xhtml.ODF2XHTML.s_style_font_face ( self,
tag,
attrs )

It is possible that the HTML browser doesn't know how to show a particular font.

Luckily ODF provides generic fallbacks Unfortunately they are not the same as CSS2. CSS2 serif, sans-serif, cursive, fantasy, monospace ODF roman, swiss, modern, decorative, script, system

Definition at line 957 of file odf2xhtml.py.

◆ s_style_footer()

odf.odf2xhtml.ODF2XHTML.s_style_footer ( self,
tag,
attrs )

Definition at line 963 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_style_footer_style()

odf.odf2xhtml.ODF2XHTML.s_style_footer_style ( self,
tag,
attrs )

Definition at line 972 of file odf2xhtml.py.

◆ s_style_handle_properties()

odf.odf2xhtml.ODF2XHTML.s_style_handle_properties ( self,
tag,
attrs )

Copy all attributes to a struct.

We will later convert them to CSS2

Definition at line 929 of file odf2xhtml.py.

◆ s_style_header()

odf.odf2xhtml.ODF2XHTML.s_style_header ( self,
tag,
attrs )

Definition at line 977 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_style_header_style()

odf.odf2xhtml.ODF2XHTML.s_style_header_style ( self,
tag,
attrs )

Definition at line 986 of file odf2xhtml.py.

◆ s_style_master_page()

odf.odf2xhtml.ODF2XHTML.s_style_master_page ( self,
tag,
attrs )

Collect the formatting for the page layout style.

Definition at line 1016 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_style_page_layout()

odf.odf2xhtml.ODF2XHTML.s_style_page_layout ( self,
tag,
attrs )

Collect the formatting for the page layout style.

This won't work in CSS 2.1, as page identifiers are not allowed. It is legal in CSS3, but the rest of the application doesn't specify when to use what page layout

Definition at line 1002 of file odf2xhtml.py.

◆ s_style_style()

odf.odf2xhtml.ODF2XHTML.s_style_style ( self,
tag,
attrs )

Collect the formatting for the style.

Styles have scope. The same name can be used for both paragraph and character styles Since CSS has no scope we use a prefix. (Not elegant) In ODF a style can have a parent, these parents can be chained. We may not have encountered the parent yet, but if we have, we resolve it.

Definition at line 1050 of file odf2xhtml.py.

◆ s_table_table()

odf.odf2xhtml.ODF2XHTML.s_table_table ( self,
tag,
attrs )

Start a table.

Definition at line 1083 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_table_table_cell()

odf.odf2xhtml.ODF2XHTML.s_table_table_cell ( self,
tag,
attrs )

Start a table cell.

Definition at line 1100 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_table_table_column()

odf.odf2xhtml.ODF2XHTML.s_table_table_column ( self,
tag,
attrs )

Start a table column.

Definition at line 1124 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_table_table_row()

odf.odf2xhtml.ODF2XHTML.s_table_table_row ( self,
tag,
attrs )

Start a table row.

Definition at line 1135 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_a()

odf.odf2xhtml.ODF2XHTML.s_text_a ( self,
tag,
attrs )

Anchors start.

Definition at line 1151 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_bookmark()

odf.odf2xhtml.ODF2XHTML.s_text_bookmark ( self,
tag,
attrs )

Bookmark definition.

Definition at line 1166 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_bookmark_ref()

odf.odf2xhtml.ODF2XHTML.s_text_bookmark_ref ( self,
tag,
attrs )

Bookmark reference.

Definition at line 1175 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_h()

odf.odf2xhtml.ODF2XHTML.s_text_h ( self,
tag,
attrs )

Headings start.

Definition at line 1183 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_line_break()

odf.odf2xhtml.ODF2XHTML.s_text_line_break ( self,
tag,
attrs )

Force a line break (
)

Definition at line 1218 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_list()

odf.odf2xhtml.ODF2XHTML.s_text_list ( self,
tag,
attrs )

Start a list (.

To know which level we're at, we have to count the number of <text:list> elements on the tagstack.

Definition at line 1227 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_list_item()

odf.odf2xhtml.ODF2XHTML.s_text_list_item ( self,
tag,
attrs )

Start list item.

Definition at line 1261 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_list_level_style_bullet()

odf.odf2xhtml.ODF2XHTML.s_text_list_level_style_bullet ( self,
tag,
attrs )

CSS doesn't have the ability to set the glyph to a particular character, so we just go through the available glyphs.

Definition at line 1275 of file odf2xhtml.py.

◆ s_text_list_level_style_number()

odf.odf2xhtml.ODF2XHTML.s_text_list_level_style_number ( self,
tag,
attrs )

Definition at line 1293 of file odf2xhtml.py.

◆ s_text_note()

odf.odf2xhtml.ODF2XHTML.s_text_note ( self,
tag,
attrs )

Definition at line 1315 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_note_body()

odf.odf2xhtml.ODF2XHTML.s_text_note_body ( self,
tag,
attrs )

Definition at line 1329 of file odf2xhtml.py.

◆ s_text_p()

odf.odf2xhtml.ODF2XHTML.s_text_p ( self,
tag,
attrs )

Paragraph.

Definition at line 1356 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_s()

odf.odf2xhtml.ODF2XHTML.s_text_s ( self,
tag,
attrs )

Generate a number of spaces.

ODF has an element; HTML uses   We use &#160; so we can send the output through an XML parser if we desire to

Definition at line 1387 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_span()

odf.odf2xhtml.ODF2XHTML.s_text_span ( self,
tag,
attrs )

The <text:span> element matches the element in HTML.

It is typically used to properties of the text.

Definition at line 1395 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_tab()

odf.odf2xhtml.ODF2XHTML.s_text_tab ( self,
tag,
attrs )

Move to the next tabstop.

We ignore this in HTML

Definition at line 1415 of file odf2xhtml.py.

Here is the call graph for this function:

◆ s_text_x_source()

odf.odf2xhtml.ODF2XHTML.s_text_x_source ( self,
tag,
attrs )

Various indexes and tables of contents.

We ignore those.

Definition at line 1422 of file odf2xhtml.py.

Here is the call graph for this function:

◆ save()

odf.odf2xhtml.ODF2XHTML.save ( self,
outputfile,
addsuffix = False )

Save the HTML under the filename.

If the filename is '-' then save to stdout We have the last style filename in self.stylefilename

Definition at line 1511 of file odf2xhtml.py.

Here is the call graph for this function:

◆ set_embedable()

odf.odf2xhtml.ODF2XHTML.set_embedable ( self)

Tells the converter to only output the parts inside the <body>

Definition at line 456 of file odf2xhtml.py.

◆ set_plain()

odf.odf2xhtml.ODF2XHTML.set_plain ( self)

Tell the parser to not generate CSS.

Definition at line 452 of file odf2xhtml.py.

◆ startElementNS()

odf.odf2xhtml.ODF2XHTML.startElementNS ( self,
tag,
qname,
attrs )

Definition at line 552 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ unknown_endtag()

odf.odf2xhtml.ODF2XHTML.unknown_endtag ( self,
tag,
attrs )

Definition at line 582 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ unknown_starttag()

odf.odf2xhtml.ODF2XHTML.unknown_starttag ( self,
tag,
attrs )

Definition at line 579 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ writedata()

odf.odf2xhtml.ODF2XHTML.writedata ( self)

Definition at line 514 of file odf2xhtml.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeout()

odf.odf2xhtml.ODF2XHTML.writeout ( self,
s )

Definition at line 510 of file odf2xhtml.py.

Here is the caller graph for this function:

◆ xhtml()

odf.odf2xhtml.ODF2XHTML.xhtml ( self)

Returns the xhtml.

Definition at line 1488 of file odf2xhtml.py.

Here is the caller graph for this function:

Member Data Documentation

◆ _csslines

list odf.odf2xhtml.ODF2XHTML._csslines = []
protected

Definition at line 1499 of file odf2xhtml.py.

◆ _familyshort

dict odf.odf2xhtml.ODF2XHTML._familyshort
staticprotected

Definition at line 1039 of file odf2xhtml.py.

◆ _orgwfunc

odf.odf2xhtml.ODF2XHTML._orgwfunc = self._wfunc
protected

Definition at line 1330 of file odf2xhtml.py.

◆ _wfunc [1/2]

str odf.odf2xhtml.ODF2XHTML._wfunc = self._wlines
protected

Definition at line 482 of file odf2xhtml.py.

◆ _wfunc [2/2]

str odf.odf2xhtml.ODF2XHTML._wfunc = ''.join(self.notebody)

Definition at line 1334 of file odf2xhtml.py.

◆ anchors [1/2]

dict odf.odf2xhtml.ODF2XHTML.anchors = {}

Definition at line 497 of file odf2xhtml.py.

◆ anchors [2/2]

str odf.odf2xhtml.ODF2XHTML.anchors = "anchor%03d" % (len(self.anchors) + 1)

Definition at line 607 of file odf2xhtml.py.

◆ autoprefix

str odf.odf2xhtml.ODF2XHTML.autoprefix = "A"

Definition at line 872 of file odf2xhtml.py.

◆ creator

odf.odf2xhtml.ODF2XHTML.creator = ''

Definition at line 486 of file odf2xhtml.py.

◆ cs

odf.odf2xhtml.ODF2XHTML.cs = StyleToCSS()

Definition at line 496 of file odf2xhtml.py.

◆ currentnote [1/2]

odf.odf2xhtml.ODF2XHTML.currentnote = 0

Definition at line 477 of file odf2xhtml.py.

◆ currentnote [2/2]

dict odf.odf2xhtml.ODF2XHTML.currentnote = {}

Definition at line 1318 of file odf2xhtml.py.

◆ currentstyle [1/2]

str odf.odf2xhtml.ODF2XHTML.currentstyle = None

Definition at line 502 of file odf2xhtml.py.

◆ currentstyle [2/2]

dict odf.odf2xhtml.ODF2XHTML.currentstyle = {}

Definition at line 944 of file odf2xhtml.py.

◆ data

list odf.odf2xhtml.ODF2XHTML.data = []

Definition at line 487 of file odf2xhtml.py.

◆ default_styles

odf.odf2xhtml.ODF2XHTML.default_styles
static
Initial value:
= """
img { width: 100%; height: 100%; }
* { padding: 0; margin: 0; background-color:white; }
body { margin: 0 1em; }
ol, ul { padding-left: 2em; }
"""

Definition at line 817 of file odf2xhtml.py.

◆ document

odf.odf2xhtml.ODF2XHTML.document = load(odffile)

Definition at line 1451 of file odf2xhtml.py.

◆ elements

dict odf.odf2xhtml.ODF2XHTML.elements

Definition at line 351 of file odf2xhtml.py.

◆ familymap

dict odf.odf2xhtml.ODF2XHTML.familymap
static
Initial value:
= {'frame':'frame', 'paragraph':'p', 'presentation':'presentation',
'text':'span','section':'div',
'table':'table','table-cell':'td','table-column':'col',
'table-row':'tr','graphic':'graphic' }

Definition at line 934 of file odf2xhtml.py.

◆ generate_css [1/3]

str odf.odf2xhtml.ODF2XHTML.generate_css = generate_css

Definition at line 350 of file odf2xhtml.py.

◆ generate_css [2/3]

str odf.odf2xhtml.ODF2XHTML.generate_css = "char":

Definition at line 741 of file odf2xhtml.py.

◆ generate_css [3/3]

dict odf.odf2xhtml.ODF2XHTML.generate_css = self.notedict[key]

Definition at line 855 of file odf2xhtml.py.

◆ headinglevels

list odf.odf2xhtml.ODF2XHTML.headinglevels = [0, 0,0,0,0,0, 0,0,0,0,0]

Definition at line 494 of file odf2xhtml.py.

◆ htmlstack

list odf.odf2xhtml.ODF2XHTML.htmlstack = []

Definition at line 489 of file odf2xhtml.py.

◆ language

odf.odf2xhtml.ODF2XHTML.language = ''

Definition at line 485 of file odf2xhtml.py.

◆ lines

odf.odf2xhtml.ODF2XHTML.lines = []

Definition at line 481 of file odf2xhtml.py.

◆ listtypes

dict odf.odf2xhtml.ODF2XHTML.listtypes = {}

Definition at line 493 of file odf2xhtml.py.

◆ metatags

list odf.odf2xhtml.ODF2XHTML.metatags = []

Definition at line 507 of file odf2xhtml.py.

◆ notebody

str odf.odf2xhtml.ODF2XHTML.notebody = ''

Definition at line 478 of file odf2xhtml.py.

◆ notedict

dict odf.odf2xhtml.ODF2XHTML.notedict = {}

Definition at line 476 of file odf2xhtml.py.

◆ prevstyle

str odf.odf2xhtml.ODF2XHTML.prevstyle = self.currentstyle

Definition at line 1278 of file odf2xhtml.py.

◆ processcont [1/2]

bool odf.odf2xhtml.ODF2XHTML.processcont = True

Definition at line 492 of file odf2xhtml.py.

◆ processcont [2/2]

list odf.odf2xhtml.ODF2XHTML.processcont

Definition at line 553 of file odf2xhtml.py.

◆ processelem [1/2]

bool odf.odf2xhtml.ODF2XHTML.processelem = True

Definition at line 491 of file odf2xhtml.py.

◆ processelem [2/2]

dict odf.odf2xhtml.ODF2XHTML.processelem = self.elements.get(tag, (None, None) )[0]

Definition at line 554 of file odf2xhtml.py.

◆ pstack

list odf.odf2xhtml.ODF2XHTML.pstack = []

Definition at line 490 of file odf2xhtml.py.

◆ styledict

dict odf.odf2xhtml.ODF2XHTML.styledict = {}

Definition at line 501 of file odf2xhtml.py.

◆ stylefilename

odf.odf2xhtml.ODF2XHTML.stylefilename = stylefilename

Definition at line 468 of file odf2xhtml.py.

◆ stylestack [1/2]

dict odf.odf2xhtml.ODF2XHTML.stylestack = []

Definition at line 500 of file odf2xhtml.py.

◆ stylestack [2/2]

dict odf.odf2xhtml.ODF2XHTML.stylestack = self.styledict.get(name)

Definition at line 825 of file odf2xhtml.py.

◆ tagstack

odf.odf2xhtml.ODF2XHTML.tagstack = TagStack()

Definition at line 488 of file odf2xhtml.py.

◆ title

str odf.odf2xhtml.ODF2XHTML.title = ''

Definition at line 484 of file odf2xhtml.py.

◆ use_internal_css

bool odf.odf2xhtml.ODF2XHTML.use_internal_css = False

Definition at line 467 of file odf2xhtml.py.

◆ xmlfile

str odf.odf2xhtml.ODF2XHTML.xmlfile = ''

Definition at line 483 of file odf2xhtml.py.


The documentation for this class was generated from the following file: