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

Redraw and cleanup python function layout figure #573

Merged
merged 3 commits into from
Sep 6, 2018
Merged

Redraw and cleanup python function layout figure #573

merged 3 commits into from
Sep 6, 2018

Conversation

leouieda
Copy link
Contributor

@leouieda leouieda commented Sep 5, 2018

Doing some work on #494

Redrew the python-function.svg in Inkscape to replace the automatically generated one. Seemed like overkill to me and used png embeds and SVG that wouldn't render in Inkscape. I added a marker for the function body which is mentioned in the text but isn't shown in the figure. I also matched the colors used on the website.

This is what the new figure looks like:

python-function

Compared to what the original looked like on my machine:

2018-09-04-160653_3200x1800_scrot

I did my best to clean up the SVG a bit but I'm not entirely sure what I can delete and messing with the indentation was messing up the figure so I gave up.

leouieda and others added 3 commits September 4, 2018 15:19
The previous version contained some png embeds. I made the figure using
pure SVG and added an indicator for the function body.
Used generic fonts: "monospace" for code and "sans-serif" for the text.
Colors match the ones used for the code on the page.
Removed some of the Inkscape junk from the SVG and removed the comment
about generating the figure automatically.
@maxim-belkin
Copy link
Contributor

maxim-belkin commented Sep 5, 2018

Fantastic work, @leouieda!
Let's split this PR into two:
(1) for changes related to the SVG figure and
(2) for the changes in 06-func.md

I cleaned up your SVG figure even further (from 9K to 1K) and pushed it to your branch.

For your reference, here is the command that I used to get a cleaner version:

$ svgcleaner --indent 2 --ungroup-defs no --coordinates-precision 1 --properties-precision 1 --paths-coordinates-precision 1 python-function.svg v2.svg

then I did some manual cleanup (removed duplicate markers, unnecessary tspans, empty <text> block, wrong css (font-size 16) ... a few other things) and then repeated the cleaning procedure (just in case):

$ svgcleaner --indent 2 --ungroup-defs no --multipass --coordinates-precision 1 --properties-precision 1 --paths-coordinates-precision 1 v2.svg new-svg.svg

@leouieda
Copy link
Contributor Author

leouieda commented Sep 6, 2018

@maxim-belkin thanks for sharing the cleaning commands! I'll keep those in my toolbox for next time.

The changes to 06-func.md were mostly my editor stripping whitespace. Sorry about that, should have cleaned that up before committing. The only real change is to remove the comment regarding how the figure is generated. I thought that would be good to have here because it's no longer accurate with the new figure in place.

@maxim-belkin
Copy link
Contributor

I thought that would be good to have here because it's no longer accurate with the new figure in place.

OK, agreed!

BTW, most of the time I also type svn and then correct it to svg :)

@maxim-belkin maxim-belkin merged commit 7b72fbb into swcarpentry:gh-pages Sep 6, 2018
@maxim-belkin
Copy link
Contributor

Thanks again, @leouieda!

@leouieda
Copy link
Contributor Author

leouieda commented Sep 6, 2018

Thanks @maxim-belkin, glad to help! Yeah, svn is still muscle memory after all these years.

@leouieda leouieda deleted the svn-cleanup branch September 6, 2018 20:23
maxim-belkin pushed a commit to maxim-belkin/python-novice-inflammation that referenced this pull request May 15, 2021
zkamvar pushed a commit that referenced this pull request Apr 21, 2023
Pull Request: #573

* Redraw python-function.svg in Inkscape
* Add an indicator for the function body
* Use generic fonts: "monospace" for code and "sans-serif" for text
* Use colors that match the ones used for the code on the page.
* 06-func.md: Remove a comment about the procedure to generate the figure automatically.
* clean up (and slim down) produced SVG even further with
 ```
svgcleaner --indent 2 --ungroup-defs no --coordinates-precision 1 --properties-precision 1 --paths-coordinates-precision 1 <input.svg> <output.svg>
```
and
```
svgcleaner --indent 2 --ungroup-defs no --multipass --coordinates-precision 1 --properties-precision 1 --paths-coordinates-precision 1 <input.svg> <output.svg>
```
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.

2 participants