edwh-editorjs 1.0.0__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- edwh_editorjs-1.0.1/CHANGELOG.md +18 -0
- edwh_editorjs-1.0.1/PKG-INFO +73 -0
- edwh_editorjs-1.0.1/README.md +48 -0
- edwh_editorjs-1.0.1/pyeditorjs/__about__.py +1 -0
- edwh_editorjs-1.0.0/PKG-INFO +0 -92
- edwh_editorjs-1.0.0/README.md +0 -67
- edwh_editorjs-1.0.0/pyeditorjs/__about__.py +0 -1
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/.github/workflows/build_documentation.yml +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/.github/workflows/publish_to_pypi.yml +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/.github/workflows/pytest.yml +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/.gitignore +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/LICENSE +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/.gitignore +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/class_index.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/favicon_32_cb_58284776.png +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/function_index.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/index.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/status.json +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/style_cb_8e611ae1.css +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/z_a93c8aeb4b8fa1f9___init___py.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/z_a93c8aeb4b8fa1f9_blocks_py.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/z_a93c8aeb4b8fa1f9_exceptions_py.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/htmlcov/z_a93c8aeb4b8fa1f9_parser_py.html +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/pyeditorjs/__init__.py +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/pyeditorjs/blocks.py +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/pyeditorjs/exceptions.py +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/pyeditorjs/parser.py +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/pyproject.toml +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/requirements.txt +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/scripts/build_documentation.sh +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/scripts/compile_everything.sh +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/scripts/compile_for_pypi.sh +0 -0
- {edwh_editorjs-1.0.0 → edwh_editorjs-1.0.1}/tests/test_parser.py +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
<!--next-version-placeholder-->
|
|
4
|
+
|
|
5
|
+
## v1.0.1 (2024-10-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## v1.0.0 (2024-10-31)
|
|
10
|
+
|
|
11
|
+
### Feature
|
|
12
|
+
|
|
13
|
+
* Implemented more blocks (raw, warning, code, table, quote) ([`fb93bd9`](https://github.com/educationwarehouse/edwh-editorjs/commit/fb93bd959f06fa86bc23c9bfc51a8b7fddfc65f2))
|
|
14
|
+
* Refactor to Registry Pattern so new block can be easily added ([`b06c86d`](https://github.com/educationwarehouse/edwh-editorjs/commit/b06c86da623dd2a2d92f7c48353a1f3208fb5749))
|
|
15
|
+
|
|
16
|
+
### Documentation
|
|
17
|
+
|
|
18
|
+
* Updated README ([`18d0216`](https://github.com/educationwarehouse/edwh-editorjs/commit/18d021629bcb223b89a9731e9ad8c574248f75c7))
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: edwh-editorjs
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: pyEditorJS
|
|
5
|
+
Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
|
|
6
|
+
Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: bleach,clean,editor,editor.js,html,javascript,json,parser,wysiwyg
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: bleach
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: edwh; extra == 'dev'
|
|
21
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
22
|
+
Requires-Dist: su6[all]; extra == 'dev'
|
|
23
|
+
Requires-Dist: types-bleach; extra == 'dev'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# edwh-editorjs
|
|
27
|
+
|
|
28
|
+
A minimal, fast Python 3.10+ package for parsing [Editor.js](https://editorjs.io) content.
|
|
29
|
+
This package is a fork of [pyEditorJS by SKevo](https://github.com/SKevo18/pyEditorJS) with additional capabilities.
|
|
30
|
+
|
|
31
|
+
## New Features
|
|
32
|
+
|
|
33
|
+
- Expanded support for additional block types: Quote, Table, Code, Warning, and Raw blocks
|
|
34
|
+
- Issues a warning if an unknown block type is encountered, rather than ignoring it
|
|
35
|
+
- Adds a `strict` mode, raising an `EditorJSUnsupportedBlock` exception for unknown block types when `strict=True`
|
|
36
|
+
- Allows adding new blocks by decorating a subclass of `EditorJsParser` with `@block("name")`
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install edwh-editorjs
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Quickstart
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from edwh_editorjs import EditorJsParser
|
|
50
|
+
|
|
51
|
+
editor_js_data = ... # your Editor.js JSON data
|
|
52
|
+
parser = EditorJsParser(editor_js_data) # initialize the parser
|
|
53
|
+
|
|
54
|
+
html = parser.html(sanitize=True) # `sanitize=True` uses the included `bleach` dependency
|
|
55
|
+
print(html) # your clean HTML
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Enforcing Strict Block Types
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from edwh_editorjs import EditorJsParser, EditorJSUnsupportedBlock
|
|
62
|
+
|
|
63
|
+
try:
|
|
64
|
+
parser = EditorJsParser(editor_js_data, strict=True)
|
|
65
|
+
html = parser.html()
|
|
66
|
+
except EditorJSUnsupportedBlock as e:
|
|
67
|
+
print(f"Unsupported block type encountered: {e}")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Disclaimer
|
|
71
|
+
|
|
72
|
+
This is a community-provided project and is not affiliated with the Editor.js team.
|
|
73
|
+
Contributions, bug reports, and suggestions are welcome!
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# edwh-editorjs
|
|
2
|
+
|
|
3
|
+
A minimal, fast Python 3.10+ package for parsing [Editor.js](https://editorjs.io) content.
|
|
4
|
+
This package is a fork of [pyEditorJS by SKevo](https://github.com/SKevo18/pyEditorJS) with additional capabilities.
|
|
5
|
+
|
|
6
|
+
## New Features
|
|
7
|
+
|
|
8
|
+
- Expanded support for additional block types: Quote, Table, Code, Warning, and Raw blocks
|
|
9
|
+
- Issues a warning if an unknown block type is encountered, rather than ignoring it
|
|
10
|
+
- Adds a `strict` mode, raising an `EditorJSUnsupportedBlock` exception for unknown block types when `strict=True`
|
|
11
|
+
- Allows adding new blocks by decorating a subclass of `EditorJsParser` with `@block("name")`
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install edwh-editorjs
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Quickstart
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from edwh_editorjs import EditorJsParser
|
|
25
|
+
|
|
26
|
+
editor_js_data = ... # your Editor.js JSON data
|
|
27
|
+
parser = EditorJsParser(editor_js_data) # initialize the parser
|
|
28
|
+
|
|
29
|
+
html = parser.html(sanitize=True) # `sanitize=True` uses the included `bleach` dependency
|
|
30
|
+
print(html) # your clean HTML
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Enforcing Strict Block Types
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from edwh_editorjs import EditorJsParser, EditorJSUnsupportedBlock
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
parser = EditorJsParser(editor_js_data, strict=True)
|
|
40
|
+
html = parser.html()
|
|
41
|
+
except EditorJSUnsupportedBlock as e:
|
|
42
|
+
print(f"Unsupported block type encountered: {e}")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Disclaimer
|
|
46
|
+
|
|
47
|
+
This is a community-provided project and is not affiliated with the Editor.js team.
|
|
48
|
+
Contributions, bug reports, and suggestions are welcome!
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.1"
|
edwh_editorjs-1.0.0/PKG-INFO
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: edwh-editorjs
|
|
3
|
-
Version: 1.0.0
|
|
4
|
-
Summary: pyEditorJS
|
|
5
|
-
Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
|
|
6
|
-
Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
|
|
7
|
-
License: MIT
|
|
8
|
-
License-File: LICENSE
|
|
9
|
-
Keywords: bleach,clean,editor,editor.js,html,javascript,json,parser,wysiwyg
|
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Requires-Python: >=3.10
|
|
18
|
-
Requires-Dist: bleach
|
|
19
|
-
Provides-Extra: dev
|
|
20
|
-
Requires-Dist: edwh; extra == 'dev'
|
|
21
|
-
Requires-Dist: hatch; extra == 'dev'
|
|
22
|
-
Requires-Dist: su6[all]; extra == 'dev'
|
|
23
|
-
Requires-Dist: types-bleach; extra == 'dev'
|
|
24
|
-
Description-Content-Type: text/markdown
|
|
25
|
-
|
|
26
|
-
# pyEditorJS
|
|
27
|
-
|
|
28
|
-
A minimal, fast, Python 3.6+ package for parsing [Editor.js](https://editorjs.io) content.
|
|
29
|
-
|
|
30
|
-
## Features
|
|
31
|
-
|
|
32
|
-
- Handles all out-of-the-box Editor.js elements;
|
|
33
|
-
- Optional sanitization via the `bleach` library;
|
|
34
|
-
- Checks whether the data is valid (e. g.: a header can't have more than 6 levels), and raises `EditorJsParseError` if data is malformed;
|
|
35
|
-
- Uses Editor.js's class names for styles, so the output will be consistent with WYSIWYG (see [Editor.js's example style](https://github.com/codex-team/editor.js/blob/8ae8823dcd6877d63241fcb94694a8a18744485d/example/assets/demo.css) and [styles documentation](https://editorjs.io/styles))
|
|
36
|
-
|
|
37
|
-
## Installation
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
pip install pyeditorjs
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
**Optional:** install [bleach](https://pypi.org/project/bleach) for clean HTML:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
pip install bleach
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
51
|
-
### Quickstart
|
|
52
|
-
|
|
53
|
-
```python
|
|
54
|
-
from pyeditorjs import EditorJsParser
|
|
55
|
-
|
|
56
|
-
editor_js_data = ... # your Editor.js JSON data
|
|
57
|
-
parser = EditorJsParser(editor_js_data) # initialize the parser
|
|
58
|
-
|
|
59
|
-
html = parser.html(sanitize=True) # `sanitize=True` requires `bleach` to be installed
|
|
60
|
-
print(html) # your clean HTML
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Obtain texts only (for creating audio-only version, for example)
|
|
64
|
-
|
|
65
|
-
> **WARNING:** This does not sanitize the texts! Please, call `bleach.clean(...)` directly. This also doesn't obtain text from bold texts, markers, etc... - you should use [BeautifulSoup](https://pypi.org/project/beautifulsoup4/) for this.
|
|
66
|
-
|
|
67
|
-
```python
|
|
68
|
-
#import bleach
|
|
69
|
-
from pyeditorjs import EditorJsParser
|
|
70
|
-
|
|
71
|
-
editor_js_data = ... # your Editor.js JSON data
|
|
72
|
-
parser = EditorJsParser(editor_js_data) # initialize the parser
|
|
73
|
-
|
|
74
|
-
all_texts = []
|
|
75
|
-
|
|
76
|
-
for block in parser:
|
|
77
|
-
text = getattr(block, 'text', None)
|
|
78
|
-
|
|
79
|
-
if text:
|
|
80
|
-
all_texts.append(text) # all_texts.append(bleach.clean(text))
|
|
81
|
-
|
|
82
|
-
print(all_texts)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Disclaimer
|
|
86
|
-
|
|
87
|
-
This is a community-provided project, and is not affiliated with the Editor.js team.
|
|
88
|
-
It was created in my spare time. I cannot make sure that it will receive consistent updates.
|
|
89
|
-
|
|
90
|
-
Because of this, PRs, bug reports and suggestions are welcome!
|
|
91
|
-
|
|
92
|
-
<a href="https://www.buymeacoffee.com/skevo"><img src="https://img.buymeacoffee.com/button-api/?text=Support me&emoji=🐣&slug=skevo&button_colour=ffa200&font_colour=000000&font_family=Poppins&outline_colour=000000&coffee_colour=FFDD00" /></a>
|
edwh_editorjs-1.0.0/README.md
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# pyEditorJS
|
|
2
|
-
|
|
3
|
-
A minimal, fast, Python 3.6+ package for parsing [Editor.js](https://editorjs.io) content.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Handles all out-of-the-box Editor.js elements;
|
|
8
|
-
- Optional sanitization via the `bleach` library;
|
|
9
|
-
- Checks whether the data is valid (e. g.: a header can't have more than 6 levels), and raises `EditorJsParseError` if data is malformed;
|
|
10
|
-
- Uses Editor.js's class names for styles, so the output will be consistent with WYSIWYG (see [Editor.js's example style](https://github.com/codex-team/editor.js/blob/8ae8823dcd6877d63241fcb94694a8a18744485d/example/assets/demo.css) and [styles documentation](https://editorjs.io/styles))
|
|
11
|
-
|
|
12
|
-
## Installation
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
pip install pyeditorjs
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
**Optional:** install [bleach](https://pypi.org/project/bleach) for clean HTML:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
pip install bleach
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
### Quickstart
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
from pyeditorjs import EditorJsParser
|
|
30
|
-
|
|
31
|
-
editor_js_data = ... # your Editor.js JSON data
|
|
32
|
-
parser = EditorJsParser(editor_js_data) # initialize the parser
|
|
33
|
-
|
|
34
|
-
html = parser.html(sanitize=True) # `sanitize=True` requires `bleach` to be installed
|
|
35
|
-
print(html) # your clean HTML
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Obtain texts only (for creating audio-only version, for example)
|
|
39
|
-
|
|
40
|
-
> **WARNING:** This does not sanitize the texts! Please, call `bleach.clean(...)` directly. This also doesn't obtain text from bold texts, markers, etc... - you should use [BeautifulSoup](https://pypi.org/project/beautifulsoup4/) for this.
|
|
41
|
-
|
|
42
|
-
```python
|
|
43
|
-
#import bleach
|
|
44
|
-
from pyeditorjs import EditorJsParser
|
|
45
|
-
|
|
46
|
-
editor_js_data = ... # your Editor.js JSON data
|
|
47
|
-
parser = EditorJsParser(editor_js_data) # initialize the parser
|
|
48
|
-
|
|
49
|
-
all_texts = []
|
|
50
|
-
|
|
51
|
-
for block in parser:
|
|
52
|
-
text = getattr(block, 'text', None)
|
|
53
|
-
|
|
54
|
-
if text:
|
|
55
|
-
all_texts.append(text) # all_texts.append(bleach.clean(text))
|
|
56
|
-
|
|
57
|
-
print(all_texts)
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Disclaimer
|
|
61
|
-
|
|
62
|
-
This is a community-provided project, and is not affiliated with the Editor.js team.
|
|
63
|
-
It was created in my spare time. I cannot make sure that it will receive consistent updates.
|
|
64
|
-
|
|
65
|
-
Because of this, PRs, bug reports and suggestions are welcome!
|
|
66
|
-
|
|
67
|
-
<a href="https://www.buymeacoffee.com/skevo"><img src="https://img.buymeacoffee.com/button-api/?text=Support me&emoji=🐣&slug=skevo&button_colour=ffa200&font_colour=000000&font_family=Poppins&outline_colour=000000&coffee_colour=FFDD00" /></a>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|