Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 support (work in progress). #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

skakri
Copy link

@skakri skakri commented Jan 31, 2015

Python 3 support.

Adjusted code to conform to pep8 standard.
Removed trailing whitespace.
@skakri
Copy link
Author

skakri commented Jan 31, 2015

Hi, Peter.

This pull request is work in progress to keep you up to date with the changes I've implemented/intending to implement.

I've stumbled upon your project and wanted to use it in my application, which uses Python3 (my scope is – upload SVG, clean it up, remove styles and style it via external, generated CSS).

This is a stub to add Python 3 support. I intend to use six compatibility layer, to keep Python 2 support.

I've also renamed internal/external functions, to use underscored naming. If you think that this change could break users' code, we could add camelCased function aliases with deprecation messages. I'd like to also rename module name (file cleanSVG.py) to clean_svg if you don't mind.

Also I wish to implement two extra (optional) named parameters to extract_styles method – in my use case I need to strip fill style and keep others (I wish to change fill style via external CSS dynamically). Parameters are as folows:
- internal (boolean) – if True (default, same as current behaviour) – store styles in SVG file in class, False – omits _add_style_element function call and adds generated CSS to instance.stylesheet instead so SVG and styles can be used separately.
- strip (list) – if defined (defaults to empty list) – strips these styles completely. They won't be available in instance.stylesheet if called with internal parameter.

I need this to be implemented "as soon as possible"™, so I'm going to make a sub-branch from this one and rebase later, if that's okay.

I'm open to comments and suggestions.

@skakri
Copy link
Author

skakri commented Jan 31, 2015

I just checked, actually these changes work with Python 2 just fine (tests would be great though, as I've tested with only a couple of SVGs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant