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

Fix #2094 - scaling and colorbox of SVG thumbnails #2101

Merged
merged 6 commits into from Sep 21, 2015
Merged

Fix #2094 - scaling and colorbox of SVG thumbnails #2101

merged 6 commits into from Sep 21, 2015

Conversation

TyberiusPrime
Copy link

@TyberiusPrime TyberiusPrime commented Sep 18, 2015

This change rescales SVGs by manipulating their width, height and viewport.
It extracts width and height from the parse tree, throws away the units, calculates aspect ratio
and rewrites them accordingly in px.

To enable colorbox-functionality for SVG thumbnails, the thumbnail plugin confuses docutils
to treat svgs like other images by appending a '?' to the uri.

tree.attrib['width'] = "%ipx" % w
tree.attrib['height'] = "%ipx" % h
tree.attrib['viewport'] = "0 0 %ipx %ipx" % (w, h)
if dst.endswith('.tgz'):
Copy link
Contributor

@da2x da2x Sep 18, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be svgz?

@TyberiusPrime
Copy link
Author

TyberiusPrime commented Sep 18, 2015

Sorry, the tgz was a mistake of course.
Width and height have been removed,
docstrings added.

@ralsina
Copy link
Member

ralsina commented Sep 19, 2015

LGTM, Any comments @Aeyoun ? If not, let's merge this on monday.

@da2x
Copy link
Contributor

da2x commented Sep 19, 2015

Looks saner than most things involving SVGs. 👍

@ralsina
Copy link
Member

ralsina commented Sep 19, 2015

Ok, @TyberiusPrime add a one-line in CHANGES, add yourself to AUTHORS, fix the conflict and ping me here, I'll merge.

@TyberiusPrime
Copy link
Author

TyberiusPrime commented Sep 21, 2015

ping :)

ralsina added a commit that referenced this pull request Sep 21, 2015
Fix #2094 - scaling and colorbox of SVG thumbnails
@ralsina ralsina merged commit 6fd72bc into getnikola:master Sep 21, 2015
@ralsina
Copy link
Member

ralsina commented Sep 21, 2015

Merged, thanks for working on this!

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

3 participants