aboutsummaryrefslogtreecommitdiff
path: root/demos/python.html
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-06-23 21:33:42 +0300
committermax99x <max99x@gmail.com>2011-06-23 21:33:42 +0300
commit55c78b085a8157df020bf29dd60d141bb01f236c (patch)
tree7fe31d9f2247e77155f909e2c312c78dfda9fd92 /demos/python.html
parentfe80ac33c9301a013f9a4679ded406af8ca2a760 (diff)
Updated the Python demo replacing the output <div> with a textarea,
and fixing the printing of newlines (now similar to normal CPython).
Diffstat (limited to 'demos/python.html')
-rw-r--r--demos/python.html13
1 files changed, 6 insertions, 7 deletions
diff --git a/demos/python.html b/demos/python.html
index f49dc910..33b48f16 100644
--- a/demos/python.html
+++ b/demos/python.html
@@ -44,12 +44,12 @@
function print(text, force) {
//force = true; // XXX - for debugging
- lines.push(text);
+ lines.push(text || '\n');
printed = true;
if (force) {
var element = document.getElementById('output');
- element.innerHTML = text;
+ element.value = text;
}
}
@@ -67,14 +67,14 @@
if (e === 'halting, since this is the first run') {
return;
}
- element.innerHTML = 'JS crash: |<b>' + e + '</b>|. Please let us know about this problem!<hr>' + element.innerHTML;
+ element.value = 'JS crash:\n\n' + e + '\n\nPlease let us know about this problem!\n' + element.value;
return;
}
if (printed) {
- element.innerHTML = lines.map(function(line) { return line.replace('<', '&lt;', 'g') }).join('<br>') + '<hr>' + element.innerHTML;
+ element.value = lines.join('') + element.value;
} else {
- element.innerHTML = '<small><i>(no output)</i></small><hr>' + element.innerHTML;
+ element.value = '\n(no output)\n-------------\n' + element.value;
}
}
@@ -127,7 +127,6 @@ print 'This is Python {} on {}'.format(sys.version, sys.platform)
</div>
</form>
<hr>
- <div id="output" style="font-family: Courier New,Courier,monospace;"></div>
+ <textarea id="output" style="font-family: monospace; width: 80%" rows="10" readonly></textarea>
</body>
</html>
-