Test + Impl: empty footprint

This commit is contained in:
Jonas Zeunert
2024-04-27 22:10:24 +02:00
parent ebcd74cd5c
commit b4b13ec175
4 changed files with 45 additions and 17 deletions

View File

@@ -2,17 +2,22 @@ from kiutils.footprint import Footprint
class Converter:
footprint: Footprint
template: str
def __init__(self, footprint: Footprint):
self.footprint = footprint
self.template = open("res/template.js").read()
def convert(self) -> str:
return ""
main = self.footprint.to_sexpr()
# replace new footprint name with module to be consistent
main = main.replace("footprint", "module")
return self.replace_template(self.template, "", main, "", "")
@staticmethod
def replace_template(params, main, captions, pins) -> str:
template = open("res/template.js").read()
def replace_template(template: str, params: str, main: str, captions: str, pins: str) -> str:
replacements = {
"{% params %}": params,
"{% main %}": main,