The ODF2XHTML parses an ODF file and produces XHTML. More...
Public Member Functions | |
__init__ (self, lines, 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 | |
lines = lines | |
generate_css = generate_css | |
![]() | |
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) | |
Additional Inherited Members | |
![]() | |
str | default_styles |
dict | familymap |
![]() | |
_resetfootnotes (self) | |
_resetobject (self) | |
_walknode (self, node) | |
_wlines (self, s) | |
_writecss (self, s) | |
_writenothing (self, s) | |
![]() | |
_wfunc = self._wlines | |
_orgwfunc = self._wfunc | |
list | _csslines = [] |
![]() | |
dict | _familyshort |
The ODF2XHTML parses an ODF file and produces XHTML.
Definition at line 1523 of file odf2xhtml.py.
odf.odf2xhtml.ODF2XHTMLembedded.__init__ | ( | self, | |
lines, | |||
generate_css = True, | |||
embedable = False ) |
Reimplemented from odf.odf2xhtml.ODF2XHTML.
Definition at line 1525 of file odf2xhtml.py.
odf.odf2xhtml.ODF2XHTMLembedded.generate_css = generate_css |
Definition at line 1530 of file odf2xhtml.py.
odf.odf2xhtml.ODF2XHTMLembedded.lines = lines |
Definition at line 1527 of file odf2xhtml.py.