Skip to content

Instantly share code, notes, and snippets.

@onyxfish
Created May 20, 2013 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onyxfish/5615894 to your computer and use it in GitHub Desktop.
Save onyxfish/5615894 to your computer and use it in GitHub Desktop.
Part of our SVG processing that normalizes the input before its passed to cairosvg
svg = request.form.get('image', None)
svg = re.sub('(height|width)=\"[0-9]+\"', '', svg, 2)
# Fix for duplicate namespaces in IE...
if svg.count('xmlns="http://www.w3.org/2000/svg"') > 1:
svg = svg.replace('xmlns="http://www.w3.org/2000/svg"', '', 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment