10-03-2021, 03:59 PM | #1 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
[Plugin] CSSValidator - Offline W3C CSS Validator
Released: February 7, 2022
Current Version: "0.0.7" This plugin allows you to validate CSS files with the offline version of the W3C CSS Validator. 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 or create a checkpoint before running this plugin. Credits BeckyEbook and RbnJrg tested earlier versions; BeckyEbook also created the plugin icon. System requirements This plugin requires Java and Sigil 0.9.8 or higher. If you uncheck the Use Bundled Python option, you'll also need to install Python 3. To find out whether Java is installed, enter the following command in a terminal/command prompt window: 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 enable the Use Bundled Python option, if it isn't already enabled (or greyed out). 2. Click Add Plugin and select CSSValidator_v0.0.7.zip. This will install the plugin, which you can select via Plugins > Validation > CSSValidator. Settings Advanced users can change some CSS Validator settings by editing the following CSSValidator.json entries: Code:
"java_path": "java", Code:
"css_epub2_validation_spec": "css21", "css_epub3_validation_spec": "css3", If you want to validate them against different specs, simply change the default settings to one of the following values: css2, css21, css3 or css3svg. For example, you could use "css_epub3_validation_spec": "css3svg", to validate epub3 stylesheets against the CSS 3 + SVG specs. Code:
"ignore_message": [], Code:
"lang": "en" (As with all JSON files, the last entry must not be terminated by a comma.) To display the folder that contains CSSValidator.json select Edit > Preferences > Open Preferences Location. Then double-click plugins_prefs and CSSValidator. Windows users can also press WIN+R, paste %localappdata%\sigil-ebook\sigil\plugins_prefs\CSSValidator into the Run dialog box and hit Enter. Troubleshooting If you're getting a Python error: an exception of type JSONDecodeError occurred. error message for all epub files, most likely Java isn't installed or the Java binary couldn't be found. (You can download Java from the Oracle website.) License: GNU General Public License v3 (GPL-3) Last edited by Doitsu; 02-07-2022 at 04:00 PM. |
10-03-2021, 04:13 PM | #2 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
Added to the Sigil Plugin Index. A great addition! Thank You!
|
10-04-2021, 01:19 AM | #3 |
just an egg
Posts: 1,697
Karma: 5514284
Join Date: Mar 2015
Device: Kindle, iOS
|
I have been wishing for this for a long time |
10-04-2021, 10:53 AM | #4 | |
Connoisseur
Posts: 57
Karma: 10
Join Date: Jul 2021
Device: Abakus
|
Quote:
|
|
10-04-2021, 11:38 AM | #5 |
Grand Sorcerer
Posts: 28,045
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
|
10-04-2021, 12:07 PM | #6 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
|
10-05-2021, 08:58 AM | #7 |
Grand Sorcerer
Posts: 28,045
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Works fine with OpenJDK for me, as well.
|
10-06-2021, 04:29 AM | #8 |
Connoisseur
Posts: 57
Karma: 10
Join Date: Jul 2021
Device: Abakus
|
Strangely both plugins do not run with Oracles JRE on my mac. On my Mac i have to use oracles JDK. On Windows the JRE is sufficient.
Since I work mainly on Mac I have now installed OpenJDK without getting problems with the plugins. |
10-06-2021, 11:53 AM | #9 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
This is a long time bug in the Oracle macOS JRE installer as it does *not* update the system paths properly. The Oracle JDK installer does do it properly. So I always install the JDK if I am using Oracle java on macOS.
|
05-20-2024, 06:21 AM | #10 |
Connoisseur
Posts: 79
Karma: 5414
Join Date: Mar 2013
Location: CK, Poland
Device: Kobo Glo, H2O
|
I'm on Windows 11. For me 'java -version' works but plugin still gives error.
My java binary path is: D:\Programy\Java\bin\javaw.exe If I try to change java_path in CSSValidator.json to above value then after using plugin in sigil the java_path returns to 'java' and still doesn't work. What should I do? |
05-20-2024, 06:49 AM | #11 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
The plugin works fine on my Windows 11 machine.
Here's the output from java -version. Code:
java version "1.8.0_391" Java(TM) SE Runtime Environment (build 1.8.0_391-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.391-b13, mixed mode) Please post the complete error message from the Plugin Runner window. BTW, if you want to specify the path on a Windows machine, you'll need to specify the path to java.exe not javaw.exe. For example: Code:
"java_path": "C:\\Program Files\\Java\\jre-1.8\\bin\\java.exe", Code:
"java_path": "C:/Program Files/Java/jre-1.8/bin/java.exe", Last edited by Doitsu; 05-20-2024 at 06:57 AM. |
05-23-2024, 04:48 PM | #12 |
Connoisseur
Posts: 79
Karma: 5414
Join Date: Mar 2013
Location: CK, Poland
Device: Kobo Glo, H2O
|
|
08-07-2024, 08:17 AM | #13 |
Member
Posts: 13
Karma: 10
Join Date: Nov 2023
Device: Kindle
|
Hello. Wonderful plugin
Quick question: Is this still being updated/supported? Reason I ask is, it keeps throwing up errors when I use "rem" in my CSS. IE, unit : “rem” is an incorrect unit : padding: 0.25rem; when I have a CSS entry like "padding: 0.25rem;". As best as I can tell, rem is a totally valid CSS entry, and more to the point, is too damn useful to go without. Can this be updated to allow rem? |
08-07-2024, 09:16 AM | #14 |
Sigil Developer
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
|
It is valid in css3, but epub2 is limited to css2 or css2.1
Is your epub an epub3 or epub2? |
08-07-2024, 09:57 AM | #15 | |
Resident Curmudgeon
Posts: 76,529
Karma: 136565488
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
W3C Validator | JustinThought | Sigil | 2 | 08-21-2018 10:33 PM |
Offline CSS Validator? | odamizu | ePub | 9 | 04-13-2016 02:09 AM |
validate with W3C Validator question | Capricorn | ePub | 12 | 03-09-2016 04:25 PM |
W3C css Validator problem? | pete6055 | Sigil | 14 | 02-28-2013 10:19 AM |