Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

The beginnings of a CSS library for Python

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 cassidy
Octocat-spinner-32 css3syntax
Octocat-spinner-32 .env
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 css3_selectors_test.py
Octocat-spinner-32 requirements.txt
Octocat-spinner-32 selectors_test.py
README.md

Cassidy

The beginnings of a CSS library for Python.

At present it implements a decent part of the CSS Selectors spec and the draft CSS3-Syntax spec.

Here's an example of the selectors implementation:

>>> import html5lib
>>> from cassidy.selectors import selector
>>> doc = html5lib.parse("<div><p id='foo'>hello</p><p class='bar'>world</p></div>")
>>> for element in selector("p").find(doc):
...     print element.toxml()
... 
<p id="foo">hello</p>
<p class="bar">world</p>

>>> for element in selector("div .bar").find(doc):
...     print element.toxml()
... 
<p class="bar">world</p>

The css3syntax directory is a work-in-progress implementation of CSS3-Syntax draft spec. css3_selectors_test.py is a test-driven implementation of selectors using css3syntax for tokenization and parsing rather than PLY as cassidy.selectors does. The same actual selector implementation is used, though. This version will likely replace the PLY-based version eventually.

Besides improving all the above, the plan next is to implement the property model and then value calculation and inheritance.

Something went wrong with that request. Please try again.