-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit plenty of broken code, I am sure I will regret it
- Loading branch information
1 parent
e3f07ec
commit 03acca9
Showing
84 changed files
with
1,867 additions
and
1,409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,19 +13,19 @@ repos: | |
- id: fix-encoding-pragma | ||
- id: requirements-txt-fixer | ||
- repo: https://github.com/psf/black | ||
rev: 23.12.0 | ||
rev: 24.3.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 6.1.0 | ||
rev: 7.0.0 | ||
hooks: | ||
- id: flake8 | ||
- repo: https://github.com/pre-commit/mirrors-csslint | ||
rev: v1.0.5 | ||
hooks: | ||
- id: csslint | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: 'v8.53.0' # Use the sha / tag you want to point at | ||
rev: 'v9.0.0-rc.0' # Use the sha / tag you want to point at | ||
hooks: | ||
- id: eslint | ||
additional_dependencies: | ||
|
@@ -34,12 +34,12 @@ repos: | |
- [email protected] | ||
- [email protected] | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: 'v3.0.3' # Use the sha / tag you want to point at | ||
rev: 'v4.0.0-alpha.8' # Use the sha / tag you want to point at | ||
hooks: | ||
- id: prettier | ||
types_or: [javascript] | ||
- repo: https://github.com/charliermarsh/ruff-pre-commit | ||
# Ruff version. | ||
rev: 'v0.1.8' | ||
rev: 'v0.3.4' | ||
hooks: | ||
- id: ruff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/python3 | ||
|
||
from glob import glob | ||
from os.path import basename | ||
import xml.etree.ElementTree as ET | ||
|
||
|
||
def xml_pre(): | ||
print('<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">') | ||
|
||
|
||
def xml_post(): | ||
print("</svg>") | ||
|
||
|
||
def process(filename, xml): | ||
id = basename(filename).lower().split(".")[0] | ||
view_box = xml.attrib.get("viewBox", "0 0 40 40") | ||
print(' <symbol id="icon-{}" viewBox="{}">'.format(id, view_box)) | ||
for child in xml: | ||
tag = child.tag.split("}")[1] | ||
if tag not in ("path", "circle", "rect", "g"): | ||
# print("to do: " + tag) | ||
continue | ||
print(" <{}".format(tag), end="") | ||
for k, v in child.attrib.items(): | ||
print(' {}="{}"'.format(k, v), end="") | ||
print("/>") | ||
print(" </symbol>") | ||
|
||
|
||
if __name__ == "__main__": | ||
svg_paths = [ | ||
"src/website/icons/*.svg", | ||
] | ||
|
||
xml_pre() | ||
for svg_path in svg_paths: | ||
svg_files = glob(svg_path) | ||
for svg_file in svg_files: | ||
with open(svg_file, "r") as fd: | ||
lines = fd.read() | ||
xml = ET.fromstring(lines) | ||
process(svg_file, xml) | ||
xml_post() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.