Mobileread
epubcheck plugin for Sigil
#1  Doitsu 10-17-2014, 09:35 AM
[Plugin] EpubCheck - Simple epubcheck wrapper

Updated: October 16, 2019
Current Version: "0.4.3"

This plugin is a very simple EPUBCheck v4.2.2 wrapper, which allows you to check the currently loaded book with Sigil.

Note that since the EPUBCheck Java app is executed in the background, you'll have to wait a couple of seconds before the messages are being displayed.

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

* 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 and 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 path or Set to manually select the Python interpreter path.
2. Click Add Plugin and select epubcheck_v0.4.3.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
}
locale if specified, EPUBCheck will display messages in the language specified by the language code. You can use this setting, for example, to display French epubcheck messages on a computer with an English OS or vice versa.

The following language codes can be used:
Code
"en", "de", "es", "fr", "it", "ja", "nl", "pt-BR", "ko-KR", "zh_TW", "da"
Note that Japanese output will not work on non-Japanese Windows PCs.

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

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\
If one of these folders exists, search for a \jre1.x.0_yy\bin subfolder that contains java.exe (and a bunch of other programs) and copy the folder path to Notepad. For example:

Code
C:\Program Files\Java\jre1.8.0_25\bin
Then open the Environment Variables dialog box (Control Panel > System > Advanced Settings > Environment Variables > PATH > Edit) and add a semicolon and the Java path to the PATH environment variable. (For more information see the Oracle website.)

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)
[zip] EpubCheck_v0.4.3.zip (11.44 MB, 232 views)
Reply 

#2  JSWolf 10-17-2014, 09:41 AM
Very nice!
Reply 

#3  Arios 10-17-2014, 01:04 PM
Thanks Doitsu!

This is a very nice idea and AFAIK after 3 quick tries, its work well.

Cheers.
Reply 

#4  KevinH 10-17-2014, 04:16 PM
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
Reply 

#5  theducks 10-17-2014, 04:31 PM
Stuck
Reply 

#6  pete6055 10-17-2014, 06:03 PM
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.
Reply 

#7  Doitsu 10-17-2014, 07:08 PM
Quote pete6055
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.
If you have a 64bit machine, you might have different 32bit and 64bit Java versions installed and/or your PATH environment variable doesn't point to the correct Java program folder.
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.
Reply 

#8  user_none 10-18-2014, 10:30 AM
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.
Reply 

#9  KevinH 10-18-2014, 11:22 AM
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
Reply 

#10  user_none 10-18-2014, 12:53 PM
Quote KevinH
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.
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).
Reply 

  Next »  Last »  (1/29)
Today's Posts | Search this Thread | Login | Register