diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d2618998..7e1836f20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,3 +17,17 @@ jobs: - name: Lint run: .ci/script.sh + + # NPM tests + + - name: Uses Node.js + uses: actions/setup-node@v4 + with: + node-version: 'latest' + # No cache, there are complaints about lockfiles that we don't want otherwise. See . + # cache: 'npm' + + - run: npm init --yes && npm install stylelint stylelint-config-standard + + - name: Check CSS syntax (only epub.css, html5.css and fb2.css) + run: npx stylelint cr3gui/data/epub.css cr3gui/data/html5.css cr3gui/data/fb2.css diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 000000000..fa15d6b20 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,66 @@ +{ + "extends": "stylelint-config-standard", + "rules": { + "comment-empty-line-before": null, + "declaration-block-no-redundant-longhand-properties": null, + "declaration-block-single-line-max-declarations": null, + "length-zero-no-unit": [true, { "severity": "warning" }], + "no-descending-specificity": [true, { "severity": "warning" }], + "no-duplicate-selectors": [true, { "severity": "warning" }], + "property-no-unknown": [true, { + "ignoreProperties": [ + "binding", + + "hyphenate" + ] + }], + "rule-empty-line-before": null, + "selector-attribute-quotes": null, + "selector-class-pattern": "(^([a-z][a-z0-9]*)(-[a-z0-9]+)*$|^fb2_info$)", + "selector-type-case": ["lower", { + "ignoreTypes": ["DocFragment", "rubyBox"] + }], + "selector-type-no-unknown": [true, { + "ignoreTypes": [ + "noframes", + "rbc", + + "DocFragment", + "rubyBox", + + "empty-line", + + "author", + "date", + "description", + "genre", + + "epigraph", + "v", + "stanza", + "poem", + "text-author", + "epigraph", + + "book-title", + "subtitle", + "title-info", + "keywords", + "lang", + "src-lang", + "translator", + "document-info", + "publish-info", + "custom-info", + "coverpage", + "underline", + "spacing", + "emphasis", + "underline", + "strikethrough", + "spacing" + ] + }], + "shorthand-property-no-redundant-values": null + } +} diff --git a/cr3gui/data/fb2.css b/cr3gui/data/fb2.css index 25291ceea..06cb19dd1 100644 --- a/cr3gui/data/fb2.css +++ b/cr3gui/data/fb2.css @@ -43,10 +43,8 @@ title, h1, h2, h3, h4, h5, h6, subtitle { h1, h2, h3, h4, h5, h6 { display: block; margin-top: 0.5em; - margin-bottom: 0.3em; - padding: 10px ; - margin-top: 0.5em; margin-bottom: 0.5em; + padding: 10px ; } title, h1, h2 { page-break-before: always;