fix ipynb_generator.py
[talweg.git] / reports / ipynb_generator.py
index 339f96a..ce546ad 100755 (executable)
@@ -63,9 +63,7 @@ def read(text, argv=sys.argv[3:]):
                 if shortname:
                     # Check if code is to be typeset as static
                     # Markdown code (e.g., shortname=py-t)
-                        .format(shortname))
                     astext = shortname[-2:] == '-t'
-                        .format(astext, shortname))
                     if astext:
                         # Markdown
                         shortname = shortname[:-2]
@@ -123,7 +121,7 @@ def driver():
     """Compile a document and its variables."""
     try:
         inputfile = sys.argv[1]
-        with open(filename, 'r') as f:
+        with open(inputfile, 'r') as f:
             text = f.read()
         outputfile = '-' if len(sys.argv) <= 2 else sys.argv[2]
     except (IndexError, IOError) as e:
@@ -134,7 +132,7 @@ def driver():
     filestr = write(cells)
     # Assuming file extension .gj (generate Jupyter); TODO: less strict
     outputfile = inputfile[:-3]+'.ipynb' if outputfile == '-' else outputfile
-    with open(filename, 'w') as f:
+    with open(outputfile, 'w') as f:
         f.write(filestr)
 
 if __name__ == '__main__':