allow empty interpretation in csv

This commit is contained in:
Mylloon 2024-05-06 17:20:17 +02:00
parent 69bbac7efa
commit d14ca1181a
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 5 additions and 1 deletions

View file

@ -18,6 +18,7 @@ class System:
substitutions: list[tuple[str, str]],
interpretations: list[tuple[str, str]],
):
# Space trimming for class members
self.name = name.strip()
"""System name"""
@ -74,6 +75,9 @@ class System:
for member, interpretation in self.interpretations:
inter_element = XMLSubElement(interpretations, "interpretation")
inter_element.set("member", member)
# If the interpretation is "do nothing", then do nothing
if len(interpretation) == 0:
interpretation = "TURN 0"
inter_element.text = interpretation
return system

View file

@ -22,4 +22,4 @@ peano,FAPM,PFA,F,AMFMFAPFPFAPFPFAPFPFAMFMFAMFMFAMFMFAPFPFA,P,M,LINE 10,LINE 10,T
pyramid,FPM,FPPFPPFPPPFMMFMMF,FFPPFPPFPPFFF,P,M,LINE 10,TURN 60,TURN -60
levey,FPM,FPPFPPFPPF,MFPPFM,P,M,LINE 10,TURN 45,TURN -45
carpet,FAPM,F,FPFMFMFMAPFPFPFMF,AAA,P,M,LINE 10,MOVE 10,TURN 90,TURN -90
square,FXPM,FPXFPFPXF,F,XFMFPFMXFPFPXFMFPFMX,P,M,LINE 10,TURN 0,TURN 90,TURN -90
square,FXPM,FPXFPFPXF,F,XFMFPFMXFPFPXFMFPFMX,P,M,LINE 10,,TURN 90,TURN -90

1 snow,APM,APPAPPA,AMAPPAMA,P,M,LINE 30,TURN 60,TURN -60
22 carpet,FAPM,F,FPFMFMFMAPFPFPFMF,AAA,P,M,LINE 10,MOVE 10,TURN 90,TURN -90
23 square,FXPM,FPXFPFPXF,F,XFMFPFMXFPFPXFMFPFMX,P,M,LINE 10,TURN 0,TURN 90,TURN -90 square,FXPM,FPXFPFPXF,F,XFMFPFMXFPFPXFMFPFMX,P,M,LINE 10,,TURN 90,TURN -90
24
25