View Single Post
Old 10-03-2021, 02:59 PM   #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,731
Karma: 24031401
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",
You can use this setting to define a custom Java path.

Code:
  "css_epub2_validation_spec": "css21",
  "css_epub3_validation_spec": "css3",
By default, the plugin will validate stylesheets in epub2 books against the CSS 2.1 specs and stylesheets in epub3 books against the CSS 3 specs.
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": [],
You can use this plugin setting to filter out certain errors and warnings via their ids. For example, you could use "ignore_message": ["vendor-extension"], to filter out warnings about vendor extensions, e.g. -webkit-hyphens: none;.

Code:
  "lang": "en"
By default, the plugin will select the Sigil GUI language as the default language for W3C CSS Validator error and warning messages, if the language is supported by the W3C CSS Validator. However, you can also change it to one of the following languages: "bg", "cs", "de", "el", "en", "es", "fa", "fr", "hi", "hu", "it", "ja", "ko", "nl", "pl", "pt", "ro", "ru", "sv", "uk", "zh".

(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)
Attached Files
File Type: zip CSSValidator_v0.0.7.zip (8.69 MB, 1706 views)

Last edited by Doitsu; 02-07-2022 at 03:00 PM.
Doitsu is offline   Reply With Quote