From 32767f83743ca0166af1a6d2eda2026d0c905e47 Mon Sep 17 00:00:00 2001 From: timv Date: Wed, 12 Dec 2012 22:20:54 -0500 Subject: [PATCH] () --- bin/prototype.py | 22 +++++++++------------- examples/matrixops.dyna | 1 + 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/bin/prototype.py b/bin/prototype.py index 3c4500d..5389a8d 100644 --- a/bin/prototype.py +++ b/bin/prototype.py @@ -206,9 +206,6 @@ def graph_styles(g): def main(dynafile): - with file(dynafile) as f: - code = f.read() - d = dynafile + '.d' os.system('mkdir -p %s' % d) @@ -255,21 +252,20 @@ function selectline(lineno) { """ -# print >> html, '

%s

' % dynafile -# print >> html, '

Dyna source

' - print >> html, '
' print >> html, '
'
+
         with file(dynafile) as f:
+            code = f.read().strip()
 
-            lexer = get_lexer_by_name("haskell", stripall=True)
-            formatter = HtmlFormatter(linenos=False)
-            c = re.sub('%', '--', f.read())
-            pretty_code = highlight(c, lexer, formatter)
-            pretty_code = re.sub('--', '%', pretty_code)
+        lexer = get_lexer_by_name("haskell")
+        formatter = HtmlFormatter(linenos=False)
+        c = re.sub('%', '--', code)
+        pretty_code = highlight(c, lexer, formatter)
+        pretty_code = re.sub('--', '%', pretty_code)
 
-            for lineno, line in enumerate(pretty_code.split('\n'), start=1):
-                print >> html, '%s' % (lineno, line.rstrip())
+        for lineno, line in enumerate(pretty_code.split('\n'), start=1):
+            print >> html, '%s' % (lineno, line.rstrip())
 
         print >> html, '  
' print >> html, '
' diff --git a/examples/matrixops.dyna b/examples/matrixops.dyna index fe9ee98..9cf7d91 100644 --- a/examples/matrixops.dyna +++ b/examples/matrixops.dyna @@ -1,4 +1,5 @@ + % A and B are names of matricies times(A, B, I, J) += m(A, I, K) * m(B, K, J). times(A, B, C, I, L) += m(A, I, K) * m(B, K, J) * m(C, J, L). -- 2.50.1