SVGHMI: More readable debug output gen code svghmi
authorEdouard Tisserant
Tue, 17 Mar 2020 13:43:19 +0100
branchsvghmi
changeset 2880 9da4ac0c9add
parent 2879 58e6a91dc37f
child 2881 3bb49f93d48c
SVGHMI: More readable debug output gen code
svghmi/gen_index_xhtml.ysl2
--- a/svghmi/gen_index_xhtml.ysl2	Tue Mar 17 13:34:07 2020 +0100
+++ b/svghmi/gen_index_xhtml.ysl2	Tue Mar 17 13:43:19 2020 +0100
@@ -17,7 +17,21 @@
 in xsl decl svgtmpl(match, xmlns="http://www.w3.org/2000/svg") alias template;
 in xsl decl svgfunc(name, xmlns="http://www.w3.org/2000/svg") alias template;
 
-!debug_output_calls = []
+!!
+debug_output_calls = []
+def gen_debug_calls():
+    # '&bug' is a workaround for pyPEG that choke on
+    # yml2 python results not parsing down into a single yml2 call
+    return ("&bug {"+
+        "\n".join(["""
+            comment {
+                |
+                | %s:
+                call "%s";
+                | 
+            }"""%(n,n) for n in debug_output_calls])+
+        "}")
+!!
 
 istylesheet
             /* From Inkscape */
@@ -50,8 +64,7 @@
         comment > Made with SVGHMI. https://beremiz.org
 
         // use python to call all debug output from included definitions
-        // '&bug' is a workaround for pyPEG that choke on yml2 python results not parsing to a single call
-        !"&bug {"+"\n".join(["comment {\n| \n| %s:\n call \"%s\";\n| \n}"%(n,n) for n in debug_output_calls]) +"}"!
+        python gen_debug_calls;
 
         html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:svg="http://www.w3.org/2000/svg"