highlight-lisp/index.md

77 lines
2.1 KiB
Markdown
Raw Normal View History

2013-03-20 14:25:08 -07:00
---
title: Highlighter demo
layout: default
---
highlight-lisp demo
===================
2013-03-20 21:29:46 -07:00
HI!! Tired of *boring and outdated* looking Lisp code scaring away your website's
visitors, costing you millions per year? Is the wife nagging you endlessly? Did
some schmuck get *your* promotion at work?
2013-03-20 23:06:41 -07:00
Worry no more, your troubles are over!
2013-03-20 21:29:46 -07:00
2013-03-20 23:06:41 -07:00
Introducing `highligh-lisp.js`.
2013-03-20 23:08:06 -07:00
<!--
2013-03-20 21:29:46 -07:00
<input
2013-03-20 21:30:39 -07:00
type="button"
value="Click to CHANGE YOUR LIFE FOREVER!"
id="highlight_btn"
2013-03-20 22:56:36 -07:00
onclick="do_highlight();"
2013-03-20 21:32:37 -07:00
/> **!!!WARNING!!!** There is no going back!
2013-03-20 23:08:06 -07:00
-->
2013-03-20 22:56:36 -07:00
2013-03-20 22:58:56 -07:00
<ul class="themes clear">
2013-03-20 23:00:43 -07:00
<li><strong>Themes</strong></li>
2013-03-20 22:56:36 -07:00
<li><a href="#github" onclick="switch_theme('github');">Github</a></li>
2013-03-20 22:58:56 -07:00
<li><a href="#dark" onclick="switch_theme('dark');">Dark</a></li>
2013-03-20 22:56:36 -07:00
</ul>
2013-03-20 14:25:08 -07:00
<pre><code class="lisp">;; known globals
*read-base*
(let* ((*package* nil)) 'random-symbol) ; let/let*/lambda are "special"
;; known functions, unknown globals
(when (<= 17.69 (get-value))
(incf *my-global-lol*))
;; number tests
;; all have class "number", but depending on type have integer, float, hex, binary
'(80 -69.4 +5 822342.287 #xf40d #b0101)
;; t/nil + strings
(format t "highlight-lisp.js sucksp: ~a~%" nil)
;; testing lambda-list specials (&key, &body, etc), multi-line strings,
;; constants, symbols, keywords
(defun test-me (lol &key omg (lol 'wtf))
(let ((*global* 'ur-mom)
2013-03-20 15:00:26 -07:00
(strings "r pretty kewl LOL")
2013-03-20 15:01:38 -07:00
(multi-line-strings "can be kewl
2013-03-20 15:00:26 -07:00
as well")
(+my-constant+ "wait, constants don't change!!"))
2013-03-20 15:01:38 -07:00
(make-instance 'error :message "OMG ERROR!!!")))
2013-03-20 14:25:08 -07:00
;; known vs unknown #'functions
(make-hash-table :test #'equal)
(make-hash-table :test #'equalzz)
;; testing known keywords (have class "known" as well as "keyword")
(loop for x being the :hash-keys of my-hash-table collect x)</code></pre>
2013-03-20 23:06:41 -07:00
<script type="text/javascript">
function do_highlight() {
HighlightLisp.highlight_auto();
document.getElementById('highlight_btn').disabled=true;
}
function switch_theme(name) {
var style = document.getElementById('hl-theme');
if(!style) return;
style.href = '/highlight-lisp/js/highlight-lisp/themes/'+name+'.css';
}
do_highlight();
</script>