DiniFarb / codewars_readme_stats

Display your codewars stats at your github profile 🚀
MIT License
71 stars 9 forks source link

add all Codewars language icons #38

Closed Madjosz closed 1 year ago

Madjosz commented 1 year ago

fixes #7

This commit includes all language icons as used on the Codewars platform. I extracted them as SVG from the used font icomoon.woff where they are present as glyphs. It also contains icons of some languages which are not anymore supported by the platform (GNU Octave, Chapel, Lisp), and languages only supported by Qualified.io (CSS3, HTML5, Sass, ETH).

You don't need to include all the language icons if you find that some existing icons might fit better (e.g. the hexagonal C++ icon or the JS logo instead of the Node.js logo)

As a tip: You can query currently supported languages and their ids from https://www.codewars.com/api/v1/languages/

DiniFarb commented 1 year ago

Hello @Madjosz

Many Thanks for this PR. :)

It seems that it does not work properly yet. There is a Issue with XML declaration:

e.g. if I load a random card with lang icons enabled:

This page contains the following errors:
error on line 41 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.

This is because of the <!DOCTYPE svg in every icon. I think this can be fixed if every Icon has just a <svg>.....</svg> tag.

And also the sizing has to be changed, I use icon="this_is_a_hook" for injecting the right attributes while constructing the card; here in this func.

Would you be open to change those to points? Or do you want me to just take over and do the missing adjustments by myself?

Hey and thx for the language link :) I did not know that.

Madjosz commented 1 year ago

Thanks for pointing this out. I removed the XML and DOCTYPE declarations, readded the <title> and adjusted the cardbuilder.go such that it all should be shown correctly now.

The downside is now that you have to take all new icons because they cannot be positioned anymore by the viewBox (this differs now for many logos) and since I had to transform="scale(1,-1)" all icons (they were stored upside down for some reason in the font) the x and y offset had to be adjusted.

DiniFarb commented 1 year ago

I just tested it and am not happy with that hacky way I used to load the svg(with that hook and replace thing). Your work made me realis that it is much better if just the <path d=../> or even only the d val is loaded in. Thus the func (*svg.SVG).Path(d string, s ...string) from the svgo lib can be used for scaling, flipping, setting x and y etc.

So as soon as I manage some more time I'll merge in your PR and change the loading by myself :)

Thanks again for your great work!