Metadata-Version: 2.1
Name: py-style-flattener
Version: 0.0.2
Summary: Manipulate HTML by moving <style> to style=".
Home-page: https://github.com/CastixGitHub/py_style_flattener
Author: castix
Author-email: castix@autistici.org
Project-URL: Bug Reports, https://github.com/CastixGitHub/py_style_flattener/issues
Project-URL: Source, https://github.com/CastixGitHub/py_style_flattener
Keywords: html,style,css,parser,regex
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pyquery (>=1.4.3)
Requires-Dist: regex (>=2022.7.25)
Provides-Extra: testing
Requires-Dist: pytest ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'
Requires-Dist: pytest-randomly ; extra == 'testing'
Requires-Dist: flake8 ; extra == 'testing'

# Py Style Flattener

## Introduction
This module is useful to move all the css from style tags to inline style attribute
Makes use of pyquery and regex (due to stdlib's re module not supporting recursion)
Keeps all the @font-face but removes everything else

### Installation

```bash
pip install py_style_flattener
```

### Usage

It can be used from cli:
```bash
$ py-style-flattener INPUT OUTPUT
```
(note that INPUT and OUTPUT can be either paths or stdin/stdout)

Or as a python module

```python
>>> import py_style_flattener
>>> # using files, you need to open them before.
>>> py_style_flattener.using_files(INPUT, OUTPUT)
>>> # using plain strings
>>> OUTPUT = dpy_style_flattener.using_strings(INPUT)
```

### Current limitations:

- doesn't fetch remote style
- cannot set pseudo elements (limitation inherited from cssselect used by pyquery)
- only takes care of @media screen{} avoiding all other media queries


## Contributing

### build & release
```bash
pip install build
python -m build
```
