Added new regex to shBrushClojure.js to fix gt & lt issues, moved css includes above js includes in marginalia.html/page-template
to fix non-deterministic rendering problems in chrome. See problem-cases/general
for verification of fix.
Issue #17 https://github.com/fogus/marginalia/issues#issue/17
This commit is contained in:
parent
6f890ed263
commit
341a30508f
3 changed files with 68 additions and 7 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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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