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

Escape ":" in symbol names #146

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions easyeda2kicad/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
from easyeda2kicad.kicad.export_kicad_3d_model import Exporter3dModelKicad
from easyeda2kicad.kicad.export_kicad_footprint import ExporterFootprintKicad
from easyeda2kicad.kicad.export_kicad_symbol import ExporterSymbolKicad
from easyeda2kicad.kicad.parameters_kicad_symbol import KicadVersion
from easyeda2kicad.kicad.parameters_kicad_symbol import (
KicadVersion,
sanitize_fields,
)


def get_parser() -> argparse.ArgumentParser:
Expand Down Expand Up @@ -262,7 +265,7 @@ def main(argv: List[str] = sys.argv[1:]) -> int:

is_id_already_in_symbol_lib = id_already_in_symbol_lib(
lib_path=f"{arguments['output']}.{sym_lib_ext}",
component_name=easyeda_symbol.info.name,
component_name=sanitize_fields(easyeda_symbol.info.name),
kicad_version=kicad_version,
)

Expand All @@ -281,7 +284,7 @@ def main(argv: List[str] = sys.argv[1:]) -> int:
if is_id_already_in_symbol_lib:
update_component_in_symbol_lib_file(
lib_path=f"{arguments['output']}.{sym_lib_ext}",
component_name=easyeda_symbol.info.name,
component_name=sanitize_fields(easyeda_symbol.info.name),
component_content=kicad_symbol_lib,
kicad_version=kicad_version,
)
Expand Down
2 changes: 1 addition & 1 deletion easyeda2kicad/kicad/parameters_kicad_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class KiExportConfigV5(Enum):


def sanitize_fields(name: str) -> str:
return name.replace(" ", "").replace("/", "_")
return name.replace(" ", "").replace("/", "_").replace(":", "{colon}")


def apply_text_style(text: str, kicad_version: KicadVersion) -> str:
Expand Down