svg-ultralight 0.32.1__tar.gz → 0.32.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.
Potentially problematic release.
This version of svg-ultralight might be problematic. Click here for more details.
- {svg_ultralight-0.32.1/src/svg_ultralight.egg-info → svg_ultralight-0.32.2}/PKG-INFO +1 -1
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/pyproject.toml +2 -2
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/query.py +14 -1
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2/src/svg_ultralight.egg-info}/PKG-INFO +1 -1
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_queries.py +14 -2
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/.gitignore +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/.pre-commit-config.yaml +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/README.md +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/setup.cfg +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/__init__.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/animate.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/__init__.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/bound_helpers.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/supports_bounds.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/type_bound_collection.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/type_bound_element.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/type_bounding_box.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/type_padded_text.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/constructors/__init__.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/constructors/new_element.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/import_svg.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/inkscape.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/layout.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/main.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/metadata.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/nsmap.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/py.typed +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/root_elements.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/string_conversion.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/strings/__init__.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/strings/svg_strings.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/transformations.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/unit_conversion.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight.egg-info/SOURCES.txt +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight.egg-info/dependency_links.txt +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight.egg-info/requires.txt +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight.egg-info/top_level.txt +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/__init__.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/conftest.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/resources/arrow.svg +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_bounding.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_import_svg.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_inkscape.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_layout.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_matrices.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_metadata.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_new_element.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_root_elements.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_string_conversion.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tests/test_svg_ultralight.py +0 -0
- {svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "svg-ultralight"
|
|
3
|
-
version = "0.32.
|
|
3
|
+
version = "0.32.2"
|
|
4
4
|
description = "a sensible way to create svg files with Python"
|
|
5
5
|
authors = [{ name = "Shay Hill", email = "shay_public@hotmail.com" }]
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -37,7 +37,7 @@ legacy_tox_ini = """
|
|
|
37
37
|
|
|
38
38
|
[tool.commitizen]
|
|
39
39
|
name = "cz_conventional_commits"
|
|
40
|
-
version = "0.32.
|
|
40
|
+
version = "0.32.2"
|
|
41
41
|
tag_format = "$version"
|
|
42
42
|
version_files = ["pyproject.toml:^version"]
|
|
43
43
|
annotated_tag = true
|
|
@@ -146,6 +146,19 @@ def get_bounding_box(
|
|
|
146
146
|
return tuple(bboxes)
|
|
147
147
|
|
|
148
148
|
|
|
149
|
+
def _replace_text(text_elem: EtreeElement, new_text: str) -> None:
|
|
150
|
+
"""Replace the text in a text element.
|
|
151
|
+
|
|
152
|
+
:param text_elem: an etree element with a text tag
|
|
153
|
+
:param new_text: the new text to insert
|
|
154
|
+
|
|
155
|
+
If the text element has tspans, replace each tspan.text with new_text.
|
|
156
|
+
"""
|
|
157
|
+
text_elem.text = new_text
|
|
158
|
+
for sub_elem in text_elem:
|
|
159
|
+
sub_elem.text = new_text
|
|
160
|
+
|
|
161
|
+
|
|
149
162
|
def pad_text(
|
|
150
163
|
inkscape: str | Path, text_elem: EtreeElement, capline_reference_char: str = "M"
|
|
151
164
|
) -> PaddedText:
|
|
@@ -166,7 +179,7 @@ def pad_text(
|
|
|
166
179
|
_ = rmargin_ref.attrib.pop("id", None)
|
|
167
180
|
_ = capline_ref.attrib.pop("id", None)
|
|
168
181
|
rmargin_ref.attrib["text-anchor"] = "end"
|
|
169
|
-
capline_ref
|
|
182
|
+
_replace_text(capline_ref, capline_reference_char)
|
|
170
183
|
id2bbox = map_ids_to_bounding_boxes(inkscape, text_elem, rmargin_ref, capline_ref)
|
|
171
184
|
|
|
172
185
|
bbox = id2bbox[text_elem.attrib["id"]]
|
|
@@ -13,8 +13,8 @@ from pathlib import Path
|
|
|
13
13
|
import pytest
|
|
14
14
|
|
|
15
15
|
from svg_ultralight import BoundingBox, new_svg_root
|
|
16
|
-
from svg_ultralight.constructors import new_sub_element
|
|
17
|
-
from svg_ultralight.query import map_ids_to_bounding_boxes
|
|
16
|
+
from svg_ultralight.constructors import new_element, new_sub_element
|
|
17
|
+
from svg_ultralight.query import map_ids_to_bounding_boxes, pad_text
|
|
18
18
|
|
|
19
19
|
INKSCAPE = Path(r"C:\Program Files\Inkscape\bin\inkscape")
|
|
20
20
|
|
|
@@ -181,3 +181,15 @@ class TestAlterBoundingBox:
|
|
|
181
181
|
bbox.height = 200
|
|
182
182
|
bbox.height = 40
|
|
183
183
|
assert bbox.transformation == (1, 0, 0, 1, 90, 180)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class TestPadText:
|
|
187
|
+
def test_tspans(self) -> None:
|
|
188
|
+
"""Text in tspan are padded the same as text in text."""
|
|
189
|
+
no_tspan = new_element("text", font_size=100, text="typography")
|
|
190
|
+
in_tspan = new_element("text")
|
|
191
|
+
_ = new_sub_element(in_tspan, "tspan", font_size=100, text="typography")
|
|
192
|
+
padded_with = pad_text(INKSCAPE, no_tspan)
|
|
193
|
+
padded_without = pad_text(INKSCAPE, in_tspan)
|
|
194
|
+
assert padded_with.bbox == padded_without.bbox
|
|
195
|
+
assert padded_with.padded_bbox == padded_without.padded_bbox
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/__init__.py
RENAMED
|
File without changes
|
{svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/bound_helpers.py
RENAMED
|
File without changes
|
{svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/bounding_boxes/supports_bounds.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight/constructors/new_element.py
RENAMED
|
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
|
{svg_ultralight-0.32.1 → svg_ultralight-0.32.2}/src/svg_ultralight.egg-info/dependency_links.txt
RENAMED
|
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
|