Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 01-30-2017, 11:40 PM   #1
slowsmile
Witchman
slowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of light
 
Posts: 209
Karma: 12036
Join Date: May 2013
Location: Philippines
Device: Android S5
[Plugin] GoogleZipImport

Import Google Doc HTML documents into Sigil as epubs.

Requirements
Input: Google Doc HTML file saved as 'Web Page(html, zipped)'
MIT(OSI) Licence
Output: Epub 2
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.2.1"

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 GoogleZipImport_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run using Plugins > Input > GoogleZipImport.

Description
The purpose of this input plugin is to help Google Doc users more easily convert their Google html documents directly to epub. This plugin should give a full conversion and also 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 converts your document to epub 2 format and 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 also do the following additional tasks:

* Thoroughly cleans out and reformats the html file.
* Fixes common mixed encoding problems.
* Initially removes the doc TOC(if present) and removes all page links and bookmarks.
* Creates a stylesheet that preserves all layout and formatting after conversion to epub.
* Adds an ebook cover image to the epub.
* Imports all html ebook images as inline images.
* Uses special formatting to help preserve smaller image sizes 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.
* Trims the stylesheet - removes all redundant or unneeded style properties.
* 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 or complex lists.

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

Plugin Run
Download and Save your Google Document as 'Web Page(html, zipped)' and extract your html document and 'images' folder(if applicable) to your desktop. 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 quite simple to use and there is only one style rule:

Most Important 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.

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.

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.

This plugin is similar to my other plugin -- OpenDocHTMLImport -- but is more limited in its ability to manipulate html styles and in-tag styling because of the differences in how Google converts a Google Doc to HTML. Nevertheless this plugin should give you an uploadable basic epub or it will help to give you a quick start point to complete any personal finishing-off tasks in Sigil before upload.

Change Log

Spoiler:

v0.2.1
-- Fixed superscript and subscript issues
v0.2.0
-- Fixed a problem with line-height
v0.1.9
-- Now automatically removes the html doc TOC if present
v0.1.8
-- Added MIT SW Licence
v0.1.7
-- Fixed a bug with the anchor tag
-- The long and shorthand values of 'padding' and 'margin' will both now automatically be converted from their absolute to relative 'em' values in the css. The em values will also have better precision.
-- Changed Book Browser file names to lower case
-- Other minor plugin changes to improve checks, protection and cleanup on exit.
v0.1.6:
-- Added warning message for "images" folder not found.
v0.1.5:
-- Initial release
Attached Files
File Type: zip GoogleZipImport_021.zip (981.2 KB, 19 views)

Last edited by slowsmile; 09-27-2017 at 05:40 AM.
slowsmile is offline   Reply With Quote
Advert
Old 02-27-2017, 05:37 PM   #2
JakeK
Junior Member
JakeK began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Feb 2017
Device: Android Tablet
Error using.. I included error text

Hi,
Just tried your plugin for sigil. I have a book in Google Docs and saved it out then tried to import using your plugin.. I get the following when I do:

Status: failed

Python version: 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)]

Running GoogleZipImport...

-- User input validation checks...
-- Main html file found...PASS
-- eBook cover file found...PASS

-- Start conversion to epub...

-- Gathering metadata...
-- Input file name = C:/Users/MalakieUSN/Documents/Star Citizen Novel/StarCitizen-AFamiliesSingularity/StarCitizenAFamiliesSingularity.html
-- Author name = test
-- Title = test
-- Cover file name = image29.jpg
-- An associated image folder was found for the html file
-- Found 71 ebook images in your local dir
-- Input file encoding is: UTF-8
-- Convert input file to utf-8 if required

-- Input file validation checks...
-- Input html file is in Google HTML format...PASS
-- "Heading 1" style is used in the input html file....PASS

-- Clean, fix and sanitize html garbage code...
-- Fix mixed encoding errors
-- Remove adhoc garbage code...
-- Remove all extraneous text spaces
-- Remove all hard line breaks(<br/>)
-- Remove all tab spaces
-- Remove all "dir", "lang", "name", "id", "align" and "link" attributes
-- Remove all anchors, bookmarks and page links

-- Remove all proprietary garbage code from the html file
-- Preserve and keep all external internet links
-- Remove all internal page links
-- Remove all line-height and font family declarations
-- Remove all isolated </p> tags and </span> tags
-- Remove div tags
-- Remove all page-break refs in styles

-- Cleanup punctuation...
-- Change dumb quotes to curly quotes
-- Convert triple periods to ellipsis
-- Remove the doc TOC if present

-- Create the stylesheet...
-- Creating the CSS file
-- Format the CSS file

-- Move HTML inline styles to CSS
-- Reformat and insert ebook images
-- Split all chapters/headers into separate xhtml files
-- Add meta headers to all the new html header files
Traceback (most recent call last):
File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 135, in launch
self.exitcode = target_script.run(container)
File "C:\Users\MalakieUSN\AppData\Local\sigil-ebook\sigil\plugins\GoogleZipImport\plugin.py", line 79, in run
epub_path = convert2Epub(html_file_path)
File "C:\Users\MalakieUSN\AppData\Local\sigil-ebook\sigil\plugins\GoogleZipImport\convert.py", line 118, in convert2Epub
file_name_paths, pure_file_names = splitHeaders2Files(WDIR, file, newfile, title)
File "C:\Users\MalakieUSN\AppData\Local\sigil-ebook\sigil\plugins\GoogleZipImport\cutils.py", line 338, in splitHeaders2Files
outfp = open(out_path, 'wt', encoding=('utf-8'))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\MALAKI~1\\AppData\\Local\\Temp\\tmp167 bongs\\Copyright_2015_2017_by_Jake_Kinkaid,_All_Ri ghts_Reserved._No_part_of_this_story_or_the_docume nt_containing_the_story_may_be_reproduced_in_part_ or_whole,_without_the_express_permission_of_Jake_K inkaid_Malakie..xhtml'
Error: [Errno 2] No such file or directory: 'C:\\Users\\MALAKI~1\\AppData\\Local\\Temp\\tmp167 bongs\\Copyright_2015_2017_by_Jake_Kinkaid,_All_Ri ghts_Reserved._No_part_of_this_story_or_the_docume nt_containing_the_story_may_be_reproduced_in_part_ or_whole,_without_the_express_permission_of_Jake_K inkaid_Malakie..xhtml'



Any ideas?
JakeK is offline   Reply With Quote
Old 02-27-2017, 08:02 PM   #3
slowsmile
Witchman
slowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of light
 
Posts: 209
Karma: 12036
Join Date: May 2013
Location: Philippines
Device: Android S5
Hi Jake...Concerning your problem, you appear not to have a proper title in your Google HTML Doc. If you don't have the title as the very first text line in your doc then the plugin will fail. What appears to have happened in your conversion is that it found the Copyright text instead and created a title section section file from the copyright text.

You must make sure that the very first line of text in your Google Doc is the ebook title, otherwise the plugin will fail.

I've also just downloaded the plugin from MR and tested it with several google html docs and it seems to be working fine.

Just make sure that your ebook title text is the first line of text on the first page of your ebook. Also make sure that all your chapter and main heading sections that you want to see in the auto-generated TOC are all formatted as 'Heading 1' paragraph style in Google Docs. Try this and let me know the outcome.

Last edited by slowsmile; 02-27-2017 at 10:30 PM.
slowsmile is offline   Reply With Quote
Old 09-11-2017, 04:13 AM   #4
slowsmile
Witchman
slowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of light
 
Posts: 209
Karma: 12036
Join Date: May 2013
Location: Philippines
Device: Android S5
The following changes have been made to the plugin(v0.1.7):

* Fixed a bug with anchor tags.

* The long and shorthand values of 'padding' and 'margin' will both automatically be converted from their absolute to relative 'em' values in the css. The em values will also have better precision.

* Changed epub file names to lower case

* Other minor plugin changes to improve checks, protection and cleanup on exit.
slowsmile is offline   Reply With Quote
Old 09-11-2017, 04:29 AM   #5
slowsmile
Witchman
slowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of light
 
Posts: 209
Karma: 12036
Join Date: May 2013
Location: Philippines
Device: Android S5
Added MIT Licence in plugin version 0.1.8
slowsmile is offline   Reply With Quote
Advert
Old 09-25-2017, 08:25 PM   #6
slowsmile
Witchman
slowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of lightslowsmile is a glorious beacon of light
 
Posts: 209
Karma: 12036
Join Date: May 2013
Location: Philippines
Device: Android S5
Update: Now automatically removes the html doc TOC if present(v0.1.9).

Last edited by slowsmile; 09-25-2017 at 08:36 PM.
slowsmile is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with my ScrambleEbook plugin and the Plugin Updater tool jackie_w Development 14 01-19-2017 10:49 PM
[FileType Plugin] YVES Bible Plugin ClashTheBunny Plugins 23 08-16-2016 06:53 AM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM


All times are GMT -4. The time now is 11:20 AM.


MobileRead.com is a privately owned, operated and funded community.