shBrushClojure.js 1.5 KB

1234567891011121314151617181920212223242526
  1. // Contributed by Travis Whitton
  2. // http://travis-whitton.blogspot.com/2009/06/syntaxhighlighter-for-clojure.html
  3. SyntaxHighlighter.brushes.Clojure = function()
  4. {
  5. var funcs = ':arglists :doc :file :line :macro :name :ns :private :tag :test new alias alter ' +
  6. 'and apply assert class cond conj count def defmacro defn defstruct deref do ' +
  7. 'doall dorun doseq dosync eval filter finally find first fn gen-class gensym if ' +
  8. 'import inc keys let list loop map ns or print println quote rand recur reduce ' +
  9. 'ref repeat require rest send seq set sort str struct sync take test throw ' +
  10. 'trampoline try type use var vec when while';
  11. this.regexList = [
  12. { regex: new RegExp(';[^\]]+$', 'gm'), css: 'comments' },
  13. { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' },
  14. { regex: /\[|\]/g, css: 'keyword' },
  15. { regex: /'[a-z][A-Za-z0-9_]*/g, css: 'color1' }, // symbols
  16. { regex: /:[a-z][A-Za-z0-9_\-]*/g, css: 'color2' }, // keywords
  17. { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }
  18. ];
  19. this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
  20. }
  21. SyntaxHighlighter.brushes.Clojure.prototype = new SyntaxHighlighter.Highlighter();
  22. SyntaxHighlighter.brushes.Clojure.aliases = ['clojure', 'Clojure', 'clj'];