svg-ultralight 0.32.1__py3-none-any.whl → 0.32.2__py3-none-any.whl

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/query.py CHANGED
@@ -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.text = capline_reference_char
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"]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: svg-ultralight
3
- Version: 0.32.1
3
+ Version: 0.32.2
4
4
  Summary: a sensible way to create svg files with Python
5
5
  Author-email: Shay Hill <shay_public@hotmail.com>
6
6
  License: MIT
@@ -7,7 +7,7 @@ svg_ultralight/main.py,sha256=6oNkZfD27UMdP-oYqp5agS_IGcYb8NkUZwM9Zdyb3SA,7287
7
7
  svg_ultralight/metadata.py,sha256=Mxgxrxe1Ar4kp2wTT29aadxgHNFaaNLABo29jStiWDg,4201
8
8
  svg_ultralight/nsmap.py,sha256=y63upO78Rr-JJT56RWWZuyrsILh6HPoY4GhbYnK1A0g,1244
9
9
  svg_ultralight/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- svg_ultralight/query.py,sha256=_KQuk4IwhVVDgTT0GZm_gbqNUGp7lMEDM32b_CTTSUA,7320
10
+ svg_ultralight/query.py,sha256=nsw7L_gH-EPf5LaNu5jtVPihq-qhKs1O2psMU3sTUXU,7732
11
11
  svg_ultralight/root_elements.py,sha256=pt9J6mPrnoTAZVF6vKTZoM_o947I8UCj6MbGcD2JUCk,2869
12
12
  svg_ultralight/string_conversion.py,sha256=WEmpf75RJmJ2lfJluagAz2wPsz6wM8XvTEwkq4U0vEc,7353
13
13
  svg_ultralight/transformations.py,sha256=64BN_UupvOZk4nbiKLKv09P3j0TPFhH6mKro_3QBqeY,3945
@@ -23,7 +23,7 @@ svg_ultralight/constructors/__init__.py,sha256=YcnO0iBQc19aL8Iemw0Y452MBMBIT2AN5
23
23
  svg_ultralight/constructors/new_element.py,sha256=VtMz9sPn9rMk6rui5Poysy3vezlOaS-tGIcGbu-SXmY,3406
24
24
  svg_ultralight/strings/__init__.py,sha256=Zalrf-ThFz7b7xKELx5lb2gOlBgV-6jk_k_EeSdVCVk,295
25
25
  svg_ultralight/strings/svg_strings.py,sha256=RYKMxOHq9abbZyGcFqsElBGLrBX-EjjNxln3s_ibi30,1296
26
- svg_ultralight-0.32.1.dist-info/METADATA,sha256=byII4gL5moynYBpxV4MTP45NwwDi3L097846Yayc5KQ,8871
27
- svg_ultralight-0.32.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
- svg_ultralight-0.32.1.dist-info/top_level.txt,sha256=se-6yqM_0Yg5orJKvKWdjQZ4iR4G_EjhL7oRgju-fdY,15
29
- svg_ultralight-0.32.1.dist-info/RECORD,,
26
+ svg_ultralight-0.32.2.dist-info/METADATA,sha256=iXnT_qxV0Qg9tp3XAtv1b7TlxV-xkiYnAkCm700McgA,8871
27
+ svg_ultralight-0.32.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
28
+ svg_ultralight-0.32.2.dist-info/top_level.txt,sha256=se-6yqM_0Yg5orJKvKWdjQZ4iR4G_EjhL7oRgju-fdY,15
29
+ svg_ultralight-0.32.2.dist-info/RECORD,,