From 4ec48b681ceba7f919d134c9a452f79214f3726a Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Fri, 1 Apr 2022 15:52:59 +0200 Subject: [PATCH] SVG: added support for parsing exponentiated numbers - solve #376 --- CHANGELOG.md | 2 +- docs/UsageInWebAPI.md | 4 ++-- fpdf/svg.py | 6 ++++-- test/svg/parameters.py | 5 +++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7d22939..a5ef2c3c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and [PEP 440](https://www.python.org/dev/peps/pep-0440/). ### Fixed - a regression: now again `multi_cell()` always renders a cell, even if `txt` is an empty string - _cf._ [#349](https://github.com/PyFPDF/fpdf2/issues/349) - a bug with string width calculation when Markdown is enabled - _cf._ [#351](https://github.com/PyFPDF/fpdf2/issues/351) -- a few bugs when parsing some SVG files - _cf._ [#356](https://github.com/PyFPDF/fpdf2/issues/356) & [#358](https://github.com/PyFPDF/fpdf2/issues/358) +- a few bugs when parsing some SVG files - _cf._ [#356](https://github.com/PyFPDF/fpdf2/issues/356), [#358](https://github.com/PyFPDF/fpdf2/issues/358) & [#376](https://github.com/PyFPDF/fpdf2/issues/376) - a bug when using `multi_cell(..., split_only=True)` inside an `unbreakable` section - _cf._ [#359](https://github.com/PyFPDF/fpdf2/issues/359) ## [2.5.1] - 2022-03-07 diff --git a/docs/UsageInWebAPI.md b/docs/UsageInWebAPI.md index 88a75d88a..13b0667ed 100644 --- a/docs/UsageInWebAPI.md +++ b/docs/UsageInWebAPI.md @@ -19,6 +19,6 @@ def report(request): ## web2py ## -Usage of the original PyFPDF lib with [web2py](http://www.web2py.com/) is described here: https://github.com/reingart/pyfpdf/blob/master/docs/Web2Py.md +Usage of the original PyFPDF lib with [web2py](http://www.web2py.com/) is described here: -PyFPDF is included in `web2py` since release `1.85.2`: +`v1.7.2` of PyFPDF is included in `web2py` since release `1.85.2`: diff --git a/fpdf/svg.py b/fpdf/svg.py index 5c2ef4005..7d5088da2 100644 --- a/fpdf/svg.py +++ b/fpdf/svg.py @@ -22,8 +22,10 @@ def force_nodocument(item): "xlink": "http://www.w3.org/1999/xlink", } -ALPHABET = re.compile(r"([a-zA-Z])") -NUMBER_SIGN = re.compile(r"([+-])") +# "e" is excluded as it is used to build numbers like -2e-3: +ALPHABET = re.compile(r"([a-df-zA-Z])") +# We use a negative lookbehind to NOT split after "e" used as exponentiation: +NUMBER_SIGN = re.compile(r"(?