Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 10-17-2014, 08:35 AM   #1
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
[Plugin] EpubCheck plugin for Sigil

[Plugin] EpubCheck - Simple epubcheck wrapper

Updated: February 3, 2023
Current Version: "0.4.6.3"

This plugin is a very simple EPUBCheck v5.0.1 wrapper.

Please note that I can no longer bundle the EPUBCheck Java files with this plugin, because the epubcheck-5.0.1.zip file has a file size of 28MB!

epubcheck-5.0.1.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.0.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.6.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

The EPUBCheck Java files are missing

If the epubcheck-5.0.0.zip download fails, download epubcheck-5.0.1.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\
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)
Attached Files
File Type: zip EpubCheck_v0.4.6.3.zip (50.5 KB, 4025 views)

Last edited by Doitsu; 06-20-2023 at 01:49 PM.
Doitsu is offline   Reply With Quote
Old 10-17-2014, 08:41 AM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 73,896
Karma: 128597114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Very nice!
JSWolf is offline   Reply With Quote
Advert
Old 10-17-2014, 12:04 PM   #3
Arios
A curiosus lector!
Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.Arios ought to be getting tired of karma fortunes by now.
 
Arios's Avatar
 
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.
Arios is offline   Reply With Quote
Old 10-17-2014, 03:16 PM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,633
Karma: 5433388
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
KevinH is offline   Reply With Quote
Old 10-17-2014, 03:31 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,780
Karma: 54830978
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 06:58 PM. Reason: unstuck
theducks is online now   Reply With Quote
Advert
Old 10-17-2014, 05:03 PM   #6
pete6055
Connoisseur
pete6055 began at the beginning.
 
Posts: 66
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.
pete6055 is offline   Reply With Quote
Old 10-17-2014, 06:08 PM   #7
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by pete6055 View Post
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.
Doitsu is offline   Reply With Quote
Old 10-18-2014, 09:30 AM   #8
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
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.
user_none is offline   Reply With Quote
Old 10-18-2014, 10:22 AM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,633
Karma: 5433388
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
KevinH is offline   Reply With Quote
Old 10-18-2014, 11:53 AM   #10
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by KevinH View Post
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).
user_none is offline   Reply With Quote
Old 10-18-2014, 12:39 PM   #11
pete6055
Connoisseur
pete6055 began at the beginning.
 
Posts: 66
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!
pete6055 is offline   Reply With Quote
Old 10-19-2014, 04:17 PM   #12
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
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
user_none is offline   Reply With Quote
Old 10-19-2014, 04:34 PM   #13
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by user_none View Post
@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
Thanks that's great news! I'll check it out once the next version becomes available and will update my plugin.
Doitsu is offline   Reply With Quote
Old 11-30-2014, 05:27 AM   #14
crutledge
eBook FANatic
crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.crutledge ought to be getting tired of karma fortunes by now.
 
crutledge's Avatar
 
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>
crutledge is offline   Reply With Quote
Old 11-30-2014, 05:55 AM   #15
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by crutledge View Post
The tool doesn't like any header. What is a "XML NMTOKEN"?
An XML NMTOKEN ís "IDPF speak" for "valid id/name value." You used

Code:
<meta content="2014/11/29" name="dcterms.date of publication" />
which is invalid, because id/name attributes must not contain spaces. If you replace them with dots the error will go away. However, you might as well delete all <meta content=...> entries, because, AFAIK, no reading app actually uses them.

You may want to define these entries in Sigil's Metadata Editor instead.
Doitsu is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] PunctuationSmarten Sigil plugin DiapDealer Plugins 138 07-11-2023 11:22 AM
[Plugin] KindleImport Sigil plugin DiapDealer Plugins 187 07-04-2022 10:11 AM
Sigil Plugin Index Thasaidon Plugins 0 10-04-2014 07:41 AM
FC and Sigil 0.5.3 ePUBcheck failure Hitch Sigil 32 04-17-2012 02:56 AM
Web-based epubcheck upgraded to epubcheck 1.0.5 kjk ePub 4 02-09-2010 09:53 PM


All times are GMT -4. The time now is 10:34 AM.


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