Skip to content

Commit 2f2002d

Browse files
committed
Merge branch 'main' into allrob23/main
2 parents d2d19fb + 9b02fe7 commit 2f2002d

21 files changed

Lines changed: 170 additions & 277 deletions

.github/workflows/main.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ env:
2121

2222
# Suppress noisy pip warnings
2323
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
24-
PIP_NO_PYTHON_VERSION_WARNING: 'true'
2524
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
2625

2726
# Ensure tests can sense settings about the environment
@@ -35,36 +34,36 @@ jobs:
3534
# https://blog.jaraco.com/efficient-use-of-ci-resources/
3635
matrix:
3736
python:
38-
- "3.9"
37+
- "3.10"
3938
- "3.13"
4039
platform:
4140
- ubuntu-latest
4241
- macos-latest
4342
- windows-latest
4443
include:
45-
- python: "3.10"
46-
platform: ubuntu-latest
4744
- python: "3.11"
4845
platform: ubuntu-latest
4946
- python: "3.12"
5047
platform: ubuntu-latest
5148
- python: "3.14"
5249
platform: ubuntu-latest
53-
- python: pypy3.10
50+
- python: "3.15"
51+
platform: ubuntu-latest
52+
- python: pypy3.11
5453
platform: ubuntu-latest
5554
runs-on: ${{ matrix.platform }}
56-
continue-on-error: ${{ matrix.python == '3.14' }}
55+
continue-on-error: ${{ matrix.python == '3.15' }}
5756
steps:
5857
- uses: actions/checkout@v4
5958
- name: Install build dependencies
6059
# Install dependencies for building packages on pre-release Pythons
6160
# jaraco/skeleton#161
62-
if: matrix.python == '3.14' && matrix.platform == 'ubuntu-latest'
61+
if: matrix.python == '3.15' && matrix.platform == 'ubuntu-latest'
6362
run: |
6463
sudo apt update
6564
sudo apt install -y libxml2-dev libxslt-dev
6665
- name: Setup Python
67-
uses: actions/setup-python@v4
66+
uses: actions/setup-python@v5
6867
with:
6968
python-version: ${{ matrix.python }}
7069
allow-prereleases: true
@@ -86,7 +85,7 @@ jobs:
8685
with:
8786
fetch-depth: 0
8887
- name: Setup Python
89-
uses: actions/setup-python@v4
88+
uses: actions/setup-python@v5
9089
with:
9190
python-version: 3.x
9291
- name: Install tox
@@ -120,7 +119,7 @@ jobs:
120119
steps:
121120
- uses: actions/checkout@v4
122121
- name: Setup Python
123-
uses: actions/setup-python@v4
122+
uses: actions/setup-python@v5
124123
with:
125124
python-version: 3.x
126125
- name: Install tox

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.7.1
3+
rev: v0.12.0
44
hooks:
5-
- id: ruff
5+
- id: ruff-check
66
args: [--fix, --unsafe-fixes]
77
- id: ruff-format

LICENSE

Lines changed: 0 additions & 165 deletions
This file was deleted.

README.rst

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
:target: https://github.com/jaraco/cssutils/actions?query=workflow%3A%22tests%22
88
:alt: tests
99

10-
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
10+
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
1111
:target: https://github.com/astral-sh/ruff
1212
:alt: Ruff
1313

1414
.. image:: https://readthedocs.org/projects/cssutils/badge/?version=latest
1515
:target: https://cssutils.readthedocs.io/en/latest/?badge=latest
1616

17-
.. image:: https://img.shields.io/badge/skeleton-2025-informational
17+
.. image:: https://img.shields.io/badge/skeleton-2026-informational
1818
:target: https://blog.jaraco.com/skeleton
1919

2020
.. image:: https://tidelift.com/badges/package/pypi/cssutils
@@ -69,35 +69,36 @@ Beware, cssutils is known to be thread unsafe.
6969

7070
Example
7171
=======
72-
```python
73-
import cssutils
74-
75-
css = '''/* a comment with umlaut ä */
76-
@namespace html "http://www.w3.org/1999/xhtml";
77-
@variables { BG: #fff }
78-
html|a { color:red; background: var(BG) }'''
79-
sheet = cssutils.parseString(css)
80-
81-
for rule in sheet:
82-
if rule.type == rule.STYLE_RULE:
83-
# find property
84-
for property in rule.style:
85-
if property.name == 'color':
86-
property.value = 'green'
87-
property.priority = 'IMPORTANT'
88-
break
89-
# or simply:
90-
rule.style['margin'] = '01.0eM' # or: ('1em', 'important')
91-
92-
sheet.encoding = 'ascii'
93-
sheet.namespaces['xhtml'] = 'http://www.w3.org/1999/xhtml'
94-
sheet.namespaces['atom'] = 'http://www.w3.org/2005/Atom'
95-
sheet.add('atom|title {color: #000000 !important}')
96-
sheet.add('@import "sheets/import.css";')
97-
98-
# cssutils.ser.prefs.resolveVariables == True since 0.9.7b2
99-
print sheet.cssText
100-
```
72+
::
73+
74+
import cssutils
75+
76+
css = '''/* a comment with umlaut ä */
77+
@namespace html "http://www.w3.org/1999/xhtml";
78+
@variables { BG: #fff }
79+
html|a { color:red; background: var(BG) }'''
80+
sheet = cssutils.parseString(css)
81+
82+
for rule in sheet:
83+
if rule.type == rule.STYLE_RULE:
84+
# find property
85+
for property in rule.style:
86+
if property.name == 'color':
87+
property.value = 'green'
88+
property.priority = 'IMPORTANT'
89+
break
90+
# or simply:
91+
rule.style['margin'] = '01.0eM' # or: ('1em', 'important')
92+
93+
sheet.encoding = 'ascii'
94+
sheet.namespaces['xhtml'] = 'http://www.w3.org/1999/xhtml'
95+
sheet.namespaces['atom'] = 'http://www.w3.org/2005/Atom'
96+
sheet.add('atom|title {color: #000000 !important}')
97+
sheet.add('@import "sheets/import.css";')
98+
99+
# cssutils.ser.prefs.resolveVariables == True since 0.9.7b2
100+
print sheet.cssText
101+
101102
results in::
102103

103104
@charset "ascii";

cssutils/css/cssmediarule.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ def atrule(expected, seq, token, tokenizer):
186186
factories = {
187187
'@page': cssutils.css.CSSPageRule,
188188
'@media': CSSMediaRule,
189+
'@font-face': cssutils.css.CSSFontFaceRule,
189190
}
190191
if atval in (
191192
'@charset ',
192-
'@font-face',
193193
'@import',
194194
'@namespace',
195195
'@variables',
@@ -320,7 +320,6 @@ def insertRule(self, rule, index=None):
320320
# check hierarchy
321321
if (
322322
isinstance(rule, cssutils.css.CSSCharsetRule)
323-
or isinstance(rule, cssutils.css.CSSFontFaceRule)
324323
or isinstance(rule, cssutils.css.CSSImportRule)
325324
or isinstance(rule, cssutils.css.CSSNamespaceRule)
326325
or isinstance(rule, cssutils.css.MarginRule)

0 commit comments

Comments
 (0)