From d14ca1181ae2de7940a8bb35f135e058d98b8210 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 6 May 2024 17:20:17 +0200 Subject: [PATCH] allow empty interpretation in csv --- converter.py | 4 ++++ l-systems.csv | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/converter.py b/converter.py index 4b2f6d0..9e98e6a 100644 --- a/converter.py +++ b/converter.py @@ -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 diff --git a/l-systems.csv b/l-systems.csv index 9bfcb77..f30cd51 100644 --- a/l-systems.csv +++ b/l-systems.csv @@ -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