OpenDocHTMLImport: Import ODF HTML documents into Sigil as epubs.

Input: ODF HTML file(derived from LibreOffice or OpenOffice only) 
Output: Epub 2
Licence: MIT 
Minimum Sigil requirement: v0.9.0 or higher
Python Requirements: Python 3.4+ (Bundled or External)
OS Requirements: Windows/OSX/Linux
** Tested on Windows 7, 8 & 10 only **
** Tested on OSX, Linux32 & Linux64 **

Current Version: "0.4.0"

**Acknowlegements** A huge thank you to both KevinH and DiapDealer for all their helpful advice and testing. Without their expert guidance and invaluable help there would be no OSX or Linux versions for this plugin. 

Installation
* Select Manage Plugins from the Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.4+ should be installed on your computer to run this plugin externally). 
* Click Add Plugin and select OpenDocHTMLImport_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run using Plugins > Input > OpenDocHTMLImport.

Description
The purpose of the plugin is to help users of LibreOffice(LO) and OpenOffice(OO) more easily convert their ODF html documents directly to epub. This plugin should give a full conversion and also acts to get rid of all the drudge jobs like cleaning the html, re-styling your epub from scratch, creating a toc, adding images, creating a stylesheet, adding metadata etc and acts to quickly set up an ideal start point for important Sigil finishing-off tasks like final re-styling, toc change, adding embedded fonts etc.

This plugin converter should also be useful for non-techies as well, since it should also produce an uploadable basic epub, with no frills, after conversion. 

Features
As well as converting an html doc to epub, this plugin will do the following additional tasks:

* Thoroughly cleans out and reformats the html file.
* Fixes common mixed encoding problems.
* Now preserves all internal links and bookmarks(changed in v0.1.7)
* Creates a stylesheet that preserves all layout and formatting after conversion to epub.
* Preserves all original style names in the CSS(does not use indexing).
* Ports and transforms in-tag text styling to the stylesheet as named classes(no indexing).
* Adds an ebook cover image to the epub.
* Imports all html ebook images as inline images.
* Uses special formatting to help preserve and normalize smaller image size across all reading devices. 
* Creates a Level 1 doc TOC(in Git Markdown style) and a Nav TOC(device TOC). 
* Adds the necessary metadata to the epub.
* Preserves all internet links.
* Cleans up the stylesheet - removes all font-family, line-height, page-break properties etc. 
* Formats all epub text as default serif throughout.
* Adds the Go To guides for toc, cover and begin read(set to 'Chapter 1' or default).
* Converts all "in", "cm", "mm", pc" and "pt" values to relative "em" values in the CSS.
* Adds globals and presets to the CSS to guard against common Look Inside issues for KDP uploads.
* Cannot render tables.

This plugin effectively converts and prepares your html doc(as you have styled it in OO or LO) for upload as a basic epub with no frills.

Plugin Run
Create a named directory on your desktop and save your ODT Document as 'HTML Document(Writer)' + all html images(if applicable) to this directory. Now run the plugin in Sigil to convert your html doc to epub. 

Metadata
The Edit eBook Details dialog window collects all necessary epub metadata.

Styling Info
The plugin interface is simple to use and there are only 2 style rules: 

First rule: Make sure that you only use 'Heading 1'(h1) paragraph style for all the main headings and chapter headings that you want to see in the generated epub TOC. In the plugin, h1 style is used as a marker for selecting and generating the TOC links and is also used for XML structure creation within the epub. 

Second rule(optional): If you can, try and use named paragraph styles for formatting all text in your doc. This is really best practice and this also reduces the number of indexed inline styles ported to the CSS, which helps to make the stylesheet and html more easily readable. This plugin will nevertheless port and preserve most default styles and will preserve all heading styles, font styles and named paragraph styles from your doc to your new epub stylesheet. 

Don't put decorative images above your ebook title or chapter headings. After conversion to epub, any images above your book title or chapter headings will not show. You can add in these decorative images using Sigil after you have converted to epub. 

User Styles - Important!
If you want all your own text style names to show in the generated epub ensure that you do the following for all your text styles:

In OO or LO, go to Styles and Formatting > Organizer > Linked With and make sure that your text style is linked with "Text body"(OO) or "Text Body"(LO). If your text style is linked with "Default" or "Default Style" then it will become an inline style on conversion from a doc to HTML which will become an indexed style on converion to epub. But if your named text style is linked with or inherits "Text Body" then your style names will show in the HTML doc as a proper class. And if they show in the HTML then your style names will also show in the generated epub html. So just make sure that all your named text styles are linked with "Text body" in OO or "Text Body" in LO for them to show in the generated epub.

**Important**: Please ensure that you are using the most recent versions of OO and LO and always Insert your ebook images as a File(do not tick Link). 

The auto-generated epub TOC links will be formatted in the following way: AllCaps, 11pt, bold font, blue with no underline. On mouse over the formatting changes to: dark orange with underline. Internet links will also be displayed in the same way without bold or AllCaps. This styling will work for epub vendors like iBooks and Nook. For Kindle, the toc formatting will display, as it is, in the following way: AllCaps, 11pt, bold font, blue with underline. Internet links will not have bold or AllCaps. Kindle does not support link hover capability.

I would also be the first to admit that this plugin is far from perfect, but at least it should provide OpenDoc epubbers with a more useful start-point, in quick time, for manually finishing off their epubs as they see fit in Sigil before vendor upload. Using this plugin should hopefully save you a significant amount of time and effort in your conversion workflow. I don't really think of this plugin as a converter. I think of it more as a useful time saver.