Improved sanatization of props when converting them to Cdefs
This commit is contained in:
parent
aa6a55f717
commit
07932d134a
1 changed files with 4 additions and 1 deletions
|
|
@ -112,7 +112,10 @@ def _computeCdef(scope: TargetScope) -> str:
|
||||||
res = set()
|
res = set()
|
||||||
|
|
||||||
def sanatize(s: str) -> str:
|
def sanatize(s: str) -> str:
|
||||||
return s.lower().replace(" ", "_").replace("-", "_").replace(".", "_")
|
TO_REPLACE = [" ", "-", "."] # -> "_"
|
||||||
|
for r in TO_REPLACE:
|
||||||
|
s = s.replace(r, "_")
|
||||||
|
return "".join(filter(lambda c: c.isalnum() or c == "_", s))
|
||||||
|
|
||||||
for k, v in scope.target.props.items():
|
for k, v in scope.target.props.items():
|
||||||
if isinstance(v, bool):
|
if isinstance(v, bool):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue