]> hydra-www.ietfng.org Git - dyna2/commitdiff
working on some javascript hacks to help us manage our compiler output.
authortimv <tim.f.vieira@gmail.com>
Wed, 12 Dec 2012 21:46:50 +0000 (16:46 -0500)
committertimv <tim.f.vieira@gmail.com>
Wed, 12 Dec 2012 21:46:50 +0000 (16:46 -0500)
bin/prototype.py

index 2f26a42711e1b077511f4e2eb3120f99677b2c88..cde9e52215a6b805184dc49988e99bb217b4737d 100644 (file)
@@ -205,12 +205,42 @@ def main(dynafile):
         print >> html, '<style>'
         print >> html, '.box, pre { border: 1px solid #eee; margin: 10px; padding: 10px;}'
         print >> html, 'h2 { margin-top: 40px; }'
+        print >> html, 'a { cursor: pointer; }'
         print >> html, '</style>'
 
+        print >> html, """\
+<script type="text/javascript" language="javascript" src="../../bin/prototype.js"></script>
+
+<script type="text/javascript" language="javascript">
+
+function selectline(lineno) {
+  $("update-handler-pane").innerHTML = "";
+  $$(".handler-" + lineno).each(function (e) { $("update-handler-pane").innerHTML += e.innerHTML; });
+}
+
+</script>
+"""
+
         print >> html, '<h1>%s</h1>' % dynafile
 
         print >> html, '<h2>Dyna source</h2>'
-        print >> html, '<pre>\n%s\n</pre>' % code.strip()
+
+        print >> html, '<div style="float:left; width: 50%;">'
+
+        print >> html, '<pre>'
+        with file(dynafile) as f:
+            for lineno, line in enumerate(f, start=1):
+                print >> html, '<a onclick="selectline(%s)">%s</a>' % (lineno, line.rstrip())
+        print >> html, '</pre>'
+
+        print >> html, '</div>'
+
+        print >> html, '<div id="update-handler-pane" style="float:right; width: 50%;">'
+
+        print >> html, '</div>'
+
+
+        print >> html, '<div style="clear:both;"></div>'
 
         anf = toANF(code)