edwh-editorjs 2.0.1__tar.gz → 2.0.2__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.
Files changed (30) hide show
  1. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/CHANGELOG.md +6 -0
  2. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/PKG-INFO +1 -1
  3. edwh_editorjs-2.0.2/editorjs/__about__.py +1 -0
  4. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/editorjs/blocks.py +12 -3
  5. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/tests/test_core.py +13 -0
  6. edwh_editorjs-2.0.1/editorjs/__about__.py +0 -1
  7. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/.github/workflows/build_documentation.yml +0 -0
  8. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/.github/workflows/publish_to_pypi.yml +0 -0
  9. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/.github/workflows/pytest.yml +0 -0
  10. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/.gitignore +0 -0
  11. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/README.md +0 -0
  12. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/editorjs/__init__.py +0 -0
  13. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/editorjs/core.py +0 -0
  14. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/editorjs/exceptions.py +0 -0
  15. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/editorjs/helpers.py +0 -0
  16. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/editorjs/types.py +0 -0
  17. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/.gitignore +0 -0
  18. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/class_index.html +0 -0
  19. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/favicon_32_cb_58284776.png +0 -0
  20. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/function_index.html +0 -0
  21. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/index.html +0 -0
  22. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/keybd_closed_cb_ce680311.png +0 -0
  23. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/status.json +0 -0
  24. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/style_cb_8e611ae1.css +0 -0
  25. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9___init___py.html +0 -0
  26. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9_blocks_py.html +0 -0
  27. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9_exceptions_py.html +0 -0
  28. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/htmlcov/z_a93c8aeb4b8fa1f9_parser_py.html +0 -0
  29. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/pyproject.toml +0 -0
  30. {edwh_editorjs-2.0.1 → edwh_editorjs-2.0.2}/tests/__init__.py +0 -0
@@ -2,6 +2,12 @@
2
2
 
3
3
  <!--next-version-placeholder-->
4
4
 
5
+ ## v2.0.2 (2024-11-26)
6
+
7
+ ### Fix
8
+
9
+ * Raw block pt2 ([`37ee6bc`](https://github.com/educationwarehouse/edwh-editorjs/commit/37ee6bc09dd8f54ca22f2652be1c5920d74779d1))
10
+
5
11
  ## v2.0.1 (2024-11-26)
6
12
 
7
13
  ### Fix
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: edwh-editorjs
3
- Version: 2.0.1
3
+ Version: 2.0.2
4
4
  Summary: EditorJS.py
5
5
  Project-URL: Homepage, https://github.com/educationwarehouse/edwh-EditorJS
6
6
  Author-email: SKevo <skevo.cw@gmail.com>, Robin van der Noord <robin.vdn@educationwarehouse.nl>
@@ -0,0 +1 @@
1
+ __version__ = "2.0.2"
@@ -130,6 +130,14 @@ class HeadingBlock(EditorJSBlock):
130
130
  return child.get("value", "")
131
131
 
132
132
 
133
+ def paragraph_block(text: str):
134
+ return {"type": "paragraph", "data": {"text": text}}
135
+
136
+
137
+ def raw_block(html: str):
138
+ return {"type": "raw", "data": {"html": html}}
139
+
140
+
133
141
  @block("paragraph")
134
142
  class ParagraphBlock(EditorJSBlock):
135
143
  @classmethod
@@ -173,9 +181,10 @@ class ParagraphBlock(EditorJSBlock):
173
181
 
174
182
  elif _type == "image":
175
183
  if current_text:
176
- result.append({"data": {"text": current_text}, "type": "raw" if any_html else "paragraph"})
184
+ # {"id":"zksvpxQTDD","type":"raw","data":{"html":"<marquee> raw </marquee>"}}
185
+ result.append(raw_block(current_text) if any_html else paragraph_block(current_text))
177
186
  current_text = ""
178
- any_html = False # reset
187
+ any_html = False # reset
179
188
 
180
189
  result.extend(ImageBlock.to_json(child))
181
190
  else:
@@ -194,7 +203,7 @@ class ParagraphBlock(EditorJSBlock):
194
203
 
195
204
  # final text after image:
196
205
  if current_text:
197
- result.append({"data": {"text": current_text}, "type": "raw" if any_html else "paragraph"})
206
+ result.append(raw_block(current_text) if any_html else paragraph_block(current_text))
198
207
 
199
208
  return result
200
209
 
@@ -123,3 +123,16 @@ def test_raw_html():
123
123
  blocks = json.loads(e.to_json())
124
124
 
125
125
  assert blocks["blocks"][1]["type"] == "raw", blocks["blocks"][1]["type"]
126
+
127
+ def test_code():
128
+ e = EditorJS.from_markdown(textwrap.dedent("""
129
+ Read code:
130
+
131
+ ```
132
+ <marquee> code </marquee>
133
+ ```
134
+ """))
135
+
136
+ blocks = json.loads(e.to_json())
137
+
138
+ print(blocks)
@@ -1 +0,0 @@
1
- __version__ = "2.0.1"
File without changes
File without changes