From 6fcc71d63b436220e340dd110c65b5c348c9320e Mon Sep 17 00:00:00 2001 From: Andy Port Date: Mon, 28 May 2018 19:46:38 -0700 Subject: [PATCH] minor docstring improvements --- svgpathtools/svg2paths.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/svgpathtools/svg2paths.py b/svgpathtools/svg2paths.py index 7c9285a..05258e8 100644 --- a/svgpathtools/svg2paths.py +++ b/svgpathtools/svg2paths.py @@ -10,12 +10,14 @@ import re # Internal dependencies from .parser import parse_path + COORD_PAIR_TMPLT = re.compile( r'([\+-]?\d*[\.\d]\d*[eE][\+-]?\d+|[\+-]?\d*[\.\d]\d*)' + r'(?:\s*,\s*|\s+|(?=-))' + r'([\+-]?\d*[\.\d]\d*[eE][\+-]?\d+|[\+-]?\d*[\.\d]\d*)' ) + def ellipse2pathd(ellipse): """converts the parameters from an ellipse or a circle to a string for a Path object d-attribute""" @@ -63,18 +65,19 @@ def polyline2pathd(polyline_d, is_polygon=False): def polygon2pathd(polyline_d): - """converts the string from a polygon points-attribute to a string for a - Path object d-attribute. + """converts the string from a polygon points-attribute to a string + for a Path object d-attribute. Note: For a polygon made from n points, the resulting path will be - composed of n lines (even if some of these lines have length zero).""" + composed of n lines (even if some of these lines have length zero). + """ return polyline2pathd(polyline_d, True) def rect2pathd(rect): """Converts an SVG-rect element to a Path d-string. - The rectangle will start at the (x,y) coordinate specified by the rectangle - object and proceed counter-clockwise.""" + The rectangle will start at the (x,y) coordinate specified by the + rectangle object and proceed counter-clockwise.""" x0, y0 = float(rect.get('x', 0)), float(rect.get('y', 0)) w, h = float(rect["width"]), float(rect["height"]) x1, y1 = x0 + w, y0