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 ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
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.2"

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.2
-- Fixed a uuid problem affecting the uuids generated in the content.opf and toc.ncx metadata, which was causing uuid errors during Epubcheck.
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 Thumbnails
Click image for larger version

Name:	Edit_eBook_Details.JPG
Views:	570
Size:	33.0 KB
ID:	163062  
Attached Files
File Type: zip GoogleZipImport_v022.zip (981.2 KB, 972 views)

Last edited by slowsmile; 12-09-2018 at 06:45 PM.
slowsmile is offline   Reply With Quote
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
Advert
Old 02-27-2017, 08:02 PM   #3
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
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 ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
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 ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
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 ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
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
Old 10-23-2017, 03:32 PM   #7
Kadavy
Junior Member
Kadavy began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2017
Device: iPad Air Kindle App
Hi @slowsmile, thanks for making this plugin! I'm going to be crowdsourcing my editing, so I'm pretty set on using Google Docs, however I'm concerned about formatting.

But, I got an error using the plugin. Here's the message:

Status: failed

Traceback (most recent call last):
File "/Applications/Sigil.app/Contents/plugin_launchers/python/launcher.py", line 134, in launch
target_script = __import__(script_module)
File "/Users/kadavy/Library/Application Support/sigil-ebook/sigil/plugins/GoogleZipImport/plugin.py", line 33, in <module>
from convert import convert2Epub
File "/Users/kadavy/Library/Application Support/sigil-ebook/sigil/plugins/GoogleZipImport/convert.py", line 8, in <module>
from cutils import *
File "/Users/kadavy/Library/Application Support/sigil-ebook/sigil/plugins/GoogleZipImport/cutils.py", line 16, in <module>
from epubref import *
File "/Users/kadavy/Library/Application Support/sigil-ebook/sigil/plugins/GoogleZipImport/epubref.py", line 8, in <module>
from hformat import *
File "/Users/kadavy/Library/Application Support/sigil-ebook/sigil/plugins/GoogleZipImport/hformat.py", line 13, in <module>
import tkinter as tk
File "tkinter/__init__.py", line 35, in <module>
ImportError: dlopen(/Applications/Sigil.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl
Referenced from: /Applications/Sigil.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so
Reason: image not found
Error: dlopen(/Applications/Sigil.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl
Referenced from: /Applications/Sigil.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so
Reason: image not found

Know what's wrong? I have python 3.6.3 on my system, and Sigil tells me it's using 3.4 as an interpreter. Does that have anything to do with it?
Kadavy is offline   Reply With Quote
Old 10-23-2017, 04:25 PM   #8
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,463
Karma: 192992430
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by Kadavy View Post
Know what's wrong? I have python 3.6.3 on my system, and Sigil tells me it's using 3.4 as an interpreter. Does that have anything to do with it?
No. Sigil is not telling you it's using 3.4 as an interpreter. It's telling you that 3.4 is the minimum required.

As to your particular issue; I believe it's due to a known limitation with Mac's stock tcl. From the Sigil release notes:

Quote:
**Attention Mac OS X Users**
Per the recommendation of www.python.org (see https://www.python.org/download/mac/tcltk/), due to bugs and the age of Apple's internal Tcl library, you should also download and install ActiveState's ActiveTcl Community Edition. To get the latest bug fixes, Sigil-0.9.8's embedded Python has been linked with the very latest version: Tcl 8.6.4.1

We may *not* redistribute this Package with Sigil due to ActiveState's binary non-redistribution policy.

So please, if you have not already done so download and install this version of ActiveState's Active Tcl Community Edition, until we get a chance to do our own build of Tcl 8.6.4.1 from source for future releases. ActiveState is a primary contributor to www.python.org and a respected and trusted source for python and tcl/tk related binaries on both Windows and Mac OS X.

See: http://www.activestate.com/activetcl/downloads
Version: 8.6.4.1

Last edited by DiapDealer; 10-23-2017 at 04:30 PM.
DiapDealer is offline   Reply With Quote
Old 10-23-2017, 04:28 PM   #9
Kadavy
Junior Member
Kadavy began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Oct 2017
Device: iPad Air Kindle App
I just fixed my own issue, but for posterity, it seems I needed a Python library called "tkinter."

I installed it through something like Activetcl from here: https://www.activestate.com/activetcl/downloads

I have no idea if this was a good approach, but it appears to have fixed my issue.
Kadavy 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
[FileType Plugin] YVES Bible Plugin ClashTheBunny Plugins 27 01-16-2023 01:25 AM
Problem with my ScrambleEbook plugin and the Plugin Updater tool jackie_w Development 14 01-19-2017 10:49 PM
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 01:38 PM.


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