10-17-2014, 09:35 AM | #1 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
[Plugin] EpubCheck plugin for Sigil
[Plugin] EpubCheck - Simple epubcheck wrapper
Updated: May 27, 2024 Current Version: "0.4.7.1" This plugin is a very simple EPUBCheck v5.1.0 wrapper. Please note that I can no longer bundle the EPUBCheck Java files with this plugin, because the epubcheck-5.1.0.zip file has a file size of 28MB! epubcheck-5.1.0.zip is not the Sigil EPUBCheck plugin. You'll need to download this file. If you're installing the plugin, you'll need to be connected to the Internet. (Otherwise the plugin won't be able to automatically download and extract the EPUBCheck v5.1.0 Java files.) Disclaimer: Even though it's unlikely that the plugin will somehow corrupt the epub that you're working on or crash Sigil, you may want to save your ePub in Sigil before running this plugin. System requirements Before installing the plugin, please make sure that the following system requirements are met: 1. Python 2.7.x (or Python 3.4)* 2. Java 1.8 or higher The plugin won't work without Java!!! If Java isn't installed download it from the Oracle website. * Not required for Sigil 0.9.0 and higher, which comes with Python 3. To find out whether these programs are installed, enter the following commands in a terminal/command prompt window: python -V (should display Python 2.7.x/3.x) java -version (should display java version "1.8.0_xx" or a higher version number) Installation 1. Select Manage Plugins from the Plugins menu, then select Use Bundled Python, if it isn't already selected. If you haven't updated to Sigil 0.9.0 (or higher), click one of the Auto buttons to detect the Python interpreter path or Set to manually select it. 2. Click Add Plugin and select epubcheck_v0.4.7.1.zip. This will install the epubcheck plugin, which you can select via Plugins > Validation > epubcheck. Settings You can control several EpubCheck plugin settings via the EpubCheck.json file, which'll be generated after the first run of the plugin. (To enable a setting change false to true.) Code:
{ "locale": "fr", "github": true, "clipboard_copy": false, "update_check": true, "check_interval": 7, "usage": false, "is32bit": false } The following language codes can be used: Code:
"en", "de", "es", "fr", "it", "ja", "nl", "pt-BR", "ko-KR", "zh_TW", "da" github if enabled, the plugin will check the W3C Github site for EPUBCheck updates. (This setting is enabled by default.) clipboard_copy if enabled, the plugin will automatically copy validation results to the system clipboard. (This setting is disabled by default and might not work with some Linux/macOS versions.) update_check if enabled, the plugin will check MR for plugin updates. (This setting is enabled by default.) check_interval the number of days between update checks. (The default value is 7; i.e., the plugin will check for updates once a week.) usage if enabled, the plugin will also display best practice recommendations. (This setting is disabled by default.) is32bit If you're getting a StackOverflow error message, change this value to true. Troubleshooting tips for Windows users The EPUBCheck Java files are missing If the epubcheck-5.x.x.zip download fails, download epubcheck-5.x.x.zip and extract the files to the \sigil-ebook\sigil\plugins\EpubCheck plugin folder. Java isn't found If your getting a FileNotFound Python error message or an error message after entering java -version, Java is most likely not installed and/or the path to the Java binaries wasn't added to the Windows PATH environment variable. If you're unsure whether Java is installed on your machine download and install the latest Java version. (You might have to reboot your machine after the installation.) If you're pretty sure that Java is installed on your machine open the Windows Explorer and look for the following folders: Code:
C:\Program Files\Java\ C:\Program Files (x86)\Java\ Code:
C:\Program Files\Java\jre1.8.0_25\bin You should now get a version number, when you enter java -version in a command prompt window. Note: If you install Java for the first time make sure to disable the Java browser plugin(s). Python isn't detected when you click the Auto button If no Python path is detected when you click Auto in the Manage Plugins dialog box, install Python. (However, it'd be much easier, if you simply checked the Use Bundled Python option, if it isn't greyed out.) Troubleshooting tips for macOS users Since the update check feature might not work with certain macOS/Sigil versions, you might have to manually download the latest EPUBCheck files from the W3C website. (Unzip epubcheck.jar and the lib folder to the EpubCheck plugin folder.) License: GNU General Public License v3 (GPL-3) Last edited by Doitsu; 05-27-2024 at 04:37 PM. Reason: added support for encrypted fonts |
10-17-2014, 09:41 AM | #2 |
Resident Curmudgeon
Posts: 76,479
Karma: 136564766
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Very nice!
|
Advert | |
|
10-17-2014, 01:04 PM | #3 |
A curiosus lector!
Posts: 463
Karma: 2015140
Join Date: Jun 2012
Device: Sony PRS-T1, Kobo Touch
|
Thanks Doitsu!
This is a very nice idea and AFAIK after 3 quick tries, its work well. Cheers. |
10-17-2014, 04:16 PM | #4 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Hi,
Yes, very nicely done. And the perfect thing for a plugin. Is there a moderator here who can add this plugin thread to the sticky list of plugins? Thanks! KevinH |
10-17-2014, 04:31 PM | #5 |
Well trained by Cats
Posts: 30,451
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Stuck
Last edited by theducks; 10-17-2014 at 07:58 PM. Reason: unstuck |
Advert | |
|
10-17-2014, 06:03 PM | #6 |
Connoisseur
Posts: 68
Karma: 10
Join Date: Nov 2012
Device: none
|
Thanks for the plugin. It's the first I've tried, and when I run it I get the following error:
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion' has value '1.8', but '1.7' is required. Error: could not find java.dll Error: Could not find Java SE Runtime Environment. Java and SE Runtime are installed and in the system path. Any idea why I'm getting this error. Thanks for your help. |
10-17-2014, 07:08 PM | #7 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Unless you have other more important Java programs installed that require a specific Java version, I'd recommend downloading and installing the latest 32bit and 64bit Java versions from Oracle. (The installer will automatically remove older versions.) Also don't forget to add/update the PATH environment variable as described in my first post. (If you enter java -version in a command prompt window and don't get a version number, the plugin will not work.) If you still can't get it to work, I'd recommend downloading epagina's user-friendly epubcheck version, which should work with Java 1.6. or higher. |
|
10-18-2014, 10:30 AM | #8 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
This was something Kevin and I talked about but never had the time to do. It looks like you're going to force us to make a new plugin type specifically for validators sooner rather than later.
|
10-18-2014, 11:22 AM | #9 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Hi,
Actually the output plugin works well for this as it changes nothing at all in the current ebook files inside Sigil as the only access is via a book copy but does make the entire ebook (less mimetype) file available. Now if you wanted to do something special with the epubcheck output or wanted to make it easy to highlight text needing work in files or something along those lines, then a separate plugin type for validators with expanded capability would truly be needed. Basically, the same approach used by Doitsu can be used to invoke kindlegen or any other separate tool. So if Doitsu or any other plugin author wants to build a Kindlegen plugin, say maybe with a search to find the kindlegen executable on the users system or a filedialog to allow users to select it and saved preferences for settings and options for kindlegen that would be a wonderful thing!!! ..... Hint Hint KevinH |
10-18-2014, 12:53 PM | #10 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
That's what I was thinking. Some way for the plugin to return a standardized format which we can then load into an issues widget (like FlightCrew currently does), then the user could go though each one and clicking the issue would take them directly to it (as happens with FlightCrew now).
|
10-18-2014, 01:39 PM | #11 |
Connoisseur
Posts: 68
Karma: 10
Join Date: Nov 2012
Device: none
|
Thanks for the help with my java problem. It is fixed. When I looked I found some old entries in the Program Data folder and the registry. I also uninstalled 1.7 but left 1.8...
Neat plugin! |
10-19-2014, 05:17 PM | #12 |
Sigil & calibre developer
Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
@Doitsu,
The next release of Sigil will include a "validation" plugin type. If you use it then you can set the validation results in the plugin and they'll be loaded into the validation pane in the main window. Just like what happens when you use FlightCrew. This means the results won't disappear when the plugin runner dialog is closed and you can click on the entry to go directly to the associated error line. Here is a quick example of how you'd use it in a plugin: Code:
def run(bk): bk.add_result('info', 'Section0001.xhtml', 1, 'info stuff') bk.add_result('warning', 'Section0001.xhtml', 3, 'warn stuff') bk.add_result('error', 'content.opf', 4, 'error stuff') return 0 |
10-19-2014, 05:34 PM | #13 | |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
|
|
11-30-2014, 06:27 AM | #14 |
eBook FANatic
Posts: 18,301
Karma: 16071131
Join Date: Apr 2008
Location: Alabama, USA
Device: HP ipac RX5915 Wife's Kindle
|
epubcheck
Thanks for the guidance.
I got everything installed and apparently running OK. The tool doesn't like any header. What is a "XML NMTOKEN"? Code:
ERROR: tmpnm8njs.epub/OEBPS/Text/Drift from Two Shores_0001.htm(9,67): value of attribute "name" is invalid; must be an XML NMTOKEN Code:
<head> <title>Drift from the Shores</title> <meta content="Harte, Bret" name="dcterms.creator" /> <meta content="2014/11/29" name="dcterms.date of publication" /> <meta content="Ebook prepared by crutledge@knology.net" name="dcterms.Description" /> <meta content="en" name="dcterms.language" scheme="DCTERMS.RFC4646" /> <meta content="Public Domain" name="dcterms.rights" /> <meta content="Short Stories" name="dcterms.subject" /> <meta content="Drift from the Shores" name="dcterms.title" /> <link href="../Styles/main.css" rel="stylesheet" type="text/css" /> </head> |
11-30-2014, 06:55 AM | #15 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
An XML NMTOKEN ís "IDPF speak" for "valid id/name value." You used
Code:
<meta content="2014/11/29" name="dcterms.date of publication" /> You may want to define these entries in Sigil's Metadata Editor instead. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] PunctuationSmarten Sigil plugin | DiapDealer | Plugins | 138 | 07-11-2023 12:22 PM |
[Plugin] KindleImport Sigil plugin | DiapDealer | Plugins | 187 | 07-04-2022 11:11 AM |
Sigil Plugin Index | Thasaidon | Plugins | 0 | 10-04-2014 08:41 AM |
FC and Sigil 0.5.3 ePUBcheck failure | Hitch | Sigil | 32 | 04-17-2012 03:56 AM |
Web-based epubcheck upgraded to epubcheck 1.0.5 | kjk | ePub | 4 | 02-09-2010 10:53 PM |