Merge branch 'master' of github.com:fogus/marginalia
This commit is contained in:
commit
20d2bdbd49
5 changed files with 71 additions and 10 deletions
5
resources/shBrushClojure.js
vendored
5
resources/shBrushClojure.js
vendored
|
@ -164,7 +164,7 @@ SyntaxHighlighter.brushes.Clojure = function () {
|
|||
{ regex: /\b(true|false|nil)\b/g,
|
||||
css: 'value' },
|
||||
// (un)quoted symbols
|
||||
{ regex: /(`|#?'|~@?)[\w-.\/]+/g,
|
||||
{ regex: /(`|#?'|~@?)[\w-.A-Za-z0-9_<>\-]+/g,
|
||||
css: 'color1' },
|
||||
// keywords
|
||||
{ regex: /:[A-Za-z0-9_\-]+/g,
|
||||
|
@ -177,7 +177,8 @@ SyntaxHighlighter.brushes.Clojure = function () {
|
|||
css: 'preprocessor' },
|
||||
// clojure.core
|
||||
{ regex: new ClojureRegExp(this.getKeywords(clojure_core)),
|
||||
css: 'functions' }
|
||||
css: 'functions' },
|
||||
{ regex: /[A-Za-z0-9_<>\-]+/g, css: 'plain'}
|
||||
];
|
||||
|
||||
this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
(defn marg [project & args]
|
||||
(eval-in-project project
|
||||
`(marginalia.core/run-marginalia (list ~@args))
|
||||
`(binding [marginalia.html/*resources* ""]
|
||||
(marginalia.core/run-marginalia (list ~@args)))
|
||||
nil
|
||||
nil
|
||||
'(require 'marginalia.core)))
|
||||
|
|
|
@ -173,7 +173,6 @@
|
|||
"
|
||||
[output-file-name files-to-analyze props]
|
||||
(let [source (uberdoc-html
|
||||
output-file-name
|
||||
props
|
||||
(map path-to-doc files-to-analyze))]
|
||||
(spit output-file-name source)))
|
||||
|
|
|
@ -352,11 +352,6 @@
|
|||
[:head
|
||||
[:meta {:http-equiv "Content-Type" :content "text/html" :charset "utf-8"}]
|
||||
[:meta {:name "description" :content (:description project-metadata)}]
|
||||
(inline-js (str *resources* "jquery-1.4.4.min.js"))
|
||||
(inline-js (str *resources* "xregexp-min.js"))
|
||||
(inline-js (str *resources* "shCore.js"))
|
||||
(inline-js (str *resources* "shBrushClojure.js"))
|
||||
(inline-js (str *resources* "app.js"))
|
||||
#_[:script {:type "text/javascript" :src "./../resources/app.js"}]
|
||||
(inline-css (str *resources* "shCore.css"))
|
||||
(css
|
||||
|
@ -366,6 +361,11 @@
|
|||
header-css
|
||||
floating-toc-css
|
||||
general-css
|
||||
(inline-js (str *resources* "jquery-1.4.4.min.js"))
|
||||
(inline-js (str *resources* "xregexp-min.js"))
|
||||
(inline-js (str *resources* "shCore.js"))
|
||||
(inline-js (str *resources* "shBrushClojure.js"))
|
||||
(inline-js (str *resources* "app.js"))
|
||||
opt-resources
|
||||
[:title (:name project-metadata) " -- Marginalia"]]
|
||||
[:body
|
||||
|
@ -393,7 +393,7 @@
|
|||
(defn uberdoc-html
|
||||
"This generates a stand alone html file (think `lein uberjar`).
|
||||
It's probably the only var consumers will use."
|
||||
[output-file-name project-metadata docs]
|
||||
[project-metadata docs]
|
||||
(page-template
|
||||
project-metadata
|
||||
(opt-resources-html project-metadata)
|
||||
|
|
|
@ -87,3 +87,63 @@
|
|||
"This is a docstring. On the left."
|
||||
[_]
|
||||
"GENERATED ALWAYS AS IDENTITY")
|
||||
|
||||
(defn strict-eval-op-fn
|
||||
"`strict-eval-op-fn` is used to define functions of the above pattern for fuctions such as `+`, `*`, etc. Cljs special forms defined this way are applyable, such as `(apply + [1 2 3])`.
|
||||
|
||||
Resulting expressions are wrapped in an anonymous function and, down the line, `call`ed, like so:
|
||||
|
||||
(+ 1 2 3) -> (function(){...}.call(this, 1 2 3)"
|
||||
[op inc-ind-str ind-str op nl]
|
||||
(ind-str
|
||||
"(function() {" nl
|
||||
(inc-ind-str
|
||||
"var _out = arguments[0];" nl
|
||||
"for(var _i=1; _i<arguments.length; _i++) {" nl
|
||||
(inc-ind-str
|
||||
"_out = _out " op " arguments[_i];")
|
||||
nl
|
||||
"}" nl
|
||||
"return _out;")
|
||||
nl
|
||||
"})"))
|
||||
|
||||
|
||||
'(defn special-forms []
|
||||
{'def handle-def
|
||||
'fn handle-fn
|
||||
'fn* handle-fn
|
||||
'set! handle-set
|
||||
'let handle-let
|
||||
'defn handle-defn
|
||||
'aget handle-aget
|
||||
'aset handle-aset
|
||||
'if handle-if
|
||||
'while handle-while
|
||||
'when handle-when
|
||||
'doto handle-doto
|
||||
'-> handle-->
|
||||
'->> handle-->>
|
||||
'not handle-not
|
||||
'do handle-do
|
||||
'cond handle-cond
|
||||
'= (make-lazy-op '==)
|
||||
'> (make-lazy-op '>)
|
||||
'< (make-lazy-op '<)
|
||||
'>= (make-lazy-op '>=)
|
||||
'<= (make-lazy-op '<=)
|
||||
'or (make-lazy-op '||)
|
||||
'and (make-lazy-op '&&)
|
||||
'doseq handle-doseq
|
||||
'instanceof handle-instanceof
|
||||
'gensym handle-gensym
|
||||
'gensym-str handle-gensym-str})
|
||||
|
||||
'(defn greater [a b]
|
||||
(>= a b))
|
||||
|
||||
'(fact
|
||||
(greater 2 1) => truthy)
|
||||
|
||||
'(file->tickets commits)
|
||||
|
||||
|
|
Loading…
Reference in a new issue