font-weight: normal;
}
/* The text color of the output. */
- .jqconsole-output {
+ .jqconsole-output, .jqconsole-header {
color: gray;
}
- </style>
+ .jqconsole-error {
+ color: red;
+ }
+</style>
</head>
<body>
<script src="jqconsole.min.js" type="text/javascript" charset="utf-8"></script>
<script>
$(function () {
- var jqconsole = $('#console').jqconsole('Hi\n', '> ');
+ var jqconsole = $('#console').jqconsole('Welcome to Lisptrack!\n\n', '> ');
+ jqconsole.RegisterMatching('(', ')', 'parents');
+
var startPrompt = function () {
// Start the prompt with history enabled.
jqconsole.Prompt(true, function (input) {
// Output input with the class jqconsole-output.
- if (input[0] == ',')
- jqconsole.Write(JSON.stringify(lisp.evalString(input)) + '\n', 'jqconsole-output');
- jqconsole.Write(JSON.stringify(lisp.compileString(input)) + '\n', 'jqconsole-output');
+ if (input[0] != ','){
+ try {
+ jqconsole.Write(JSON.stringify(lisp.evalString(input)) + '\n', 'jqconsole-output');
+ } catch(error) {
+ jqconsole.Write('ERROR: ' + error + '\n', 'jqconsole-error');
+ }
+ } else {
+ jqconsole.Write(JSON.stringify(lisp.compileString(input.slice(1))) + '\n', 'jqconsole-output');
+ }
// Restart the prompt.
startPrompt();
});