projects
/
talweg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix ipynb_generator.py
[talweg.git]
/
reports
/
ipynb_generator.py
diff --git
a/reports/ipynb_generator.py
b/reports/ipynb_generator.py
index
339f96a
..
ce546ad
100755
(executable)
--- a/
reports/ipynb_generator.py
+++ b/
reports/ipynb_generator.py
@@
-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)
if shortname:
# Check if code is to be typeset as static
# Markdown code (e.g., shortname=py-t)
- .format(shortname))
astext = shortname[-2:] == '-t'
astext = shortname[-2:] == '-t'
- .format(astext, shortname))
if astext:
# Markdown
shortname = shortname[:-2]
if astext:
# Markdown
shortname = shortname[:-2]
@@
-123,7
+121,7
@@
def driver():
"""Compile a document and its variables."""
try:
inputfile = sys.argv[1]
"""Compile a document and its variables."""
try:
inputfile = sys.argv[1]
- with open(
filenam
e, 'r') as f:
+ with open(
inputfil
e, 'r') as f:
text = f.read()
outputfile = '-' if len(sys.argv) <= 2 else sys.argv[2]
except (IndexError, IOError) as e:
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
filestr = write(cells)
# Assuming file extension .gj (generate Jupyter); TODO: less strict
outputfile = inputfile[:-3]+'.ipynb' if outputfile == '-' else outputfile
- with open(
filenam
e, 'w') as f:
+ with open(
outputfil
e, 'w') as f:
f.write(filestr)
if __name__ == '__main__':
f.write(filestr)
if __name__ == '__main__':