![]() |
#1 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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:
Last edited by slowsmile; 12-09-2018 at 06:45 PM. |
![]() |
![]() |
![]() |
#2 |
Junior Member
![]() 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? |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#4 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#5 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
|
Added MIT Licence in plugin version 0.1.8
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Witchman
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() 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. |
![]() |
![]() |
![]() |
#7 |
Junior Member
![]() 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? |
![]() |
![]() |
![]() |
#8 | ||
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,335
Karma: 203719142
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
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:
Last edited by DiapDealer; 10-23-2017 at 04:30 PM. |
||
![]() |
![]() |
![]() |
#9 |
Junior Member
![]() 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. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |