CrossClj

0.1.15 docs

SourceDocs



RECENT

    re-view-hiccup

    Clojars

    Oct 16, 2017


    OWNER
    BrainTripping
    Earth
    www.braintripping.com

    Readme

    Index of all namespaces


    « Project + dependencies

    Hiccup parser for re-view

    cljs.core — cljsDocsSource

    VARS

    - * *1 *2 *3 + - / < <= = == > >=

    A *assert* ->ArrayChunk ->ArrayIter ->ArrayList ->ArrayNode ->ArrayNodeIterator ->ArrayNodeSeq ->Atom accumulating-seq-count aclone add-to-string-hash-cache add-watch aget alength alter-meta! ancestors apply apply-to array array->transient-hash-map array-chunk array-copy array-copy-downward array-extend-kv array-for array-index-of array-index-of-equiv? array-index-of-identical? array-index-of-keyword? array-index-of-nil? array-index-of-symbol? array-iter array-list array-map array-map-extend-kv array-map-index-of array-reduce array-seq array? ArrayChunk ArrayIter ArrayList ArrayNode ArrayNodeIterator ArrayNodeSeq ASeq aset assoc assoc! assoc-in associative? atom Atom

    B ->BitmapIndexedNode ->BlackNode ->Box balance-left balance-left-del balance-right balance-right-del bit-and bit-and-not bit-clear bit-count bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-shift-right-zero-fill bit-test bit-xor bitmap-indexed-node-index BitmapIndexedNode bitpos BlackNode boolean booleans bounded-count Box build-subvec butlast byte bytes

    C *clojurescript-version* ->ChunkBuffer ->ChunkedCons ->ChunkedSeq ->Cons cat char char-escapes char? CHAR_MAP chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest ChunkBuffer chunked-seq chunked-seq? ChunkedCons ChunkedSeq ci-reduce clj->js clone clone-and-set cloneable? coll? comp comparator compare compare-and-set! compare-indexed compare-keywords compare-symbols complement completing concat conj conj! cons Cons constantly contains? count counted? create-array-node-seq create-inode-seq create-node create-ns create-tree-map-seq cycle

    D ->Delay dec dedupe default-dispatch-val Delay delay? demunge demunge-pattern demunge-str DEMUNGE_MAP DEMUNGE_PATTERN deref derive descendants disj disj! dispatch-fn dissoc dissoc! distinct distinct? divide do-assoc doall dominates dorun double double-array doubles drop drop-last drop-while

    E *e ->Eduction ->EmptyList ->ES6EntriesIterator ->ES6Iterator ->ES6IteratorSeq ->ES6SetEntriesIterator edit-and-set eduction Eduction empty empty-ordered-hash empty-unordered-hash empty? EmptyList enable-console-print! ensure-reduced equiv-map equiv-sequential es6-entries-iterator es6-iterator es6-iterator-seq es6-set-entries-iterator ES6EntriesIterator ES6Iterator ES6IteratorSeq ES6SetEntriesIterator even? every-pred every? ex-cause ex-data ex-info ex-message ExceptionInfo extend-object!

    F *flush-on-newline* false? ffirst filter filterv find find-and-cache-best-method find-macros-ns find-ns find-ns-obj find-ns-obj* first first-array-for-longvec fix fixture1 fixture2 flatten flatten1 float floats flush Fn fn->comparator fn? fnext fnil force frequencies

    G -global-hierarchy gensym gensym_counter get get-global-hierarchy get-in get-method get-validator group-by

    H ->HashCollisionNode ->HashMapIter ->HashSetIter hash hash-coll hash-collision-node-find-index hash-combine hash-imap hash-iset hash-keyword hash-map hash-ordered-coll hash-set hash-string hash-string* hash-symbol hash-unordered-coll HashCollisionNode HashMapIter HashSetIter

    I ->IndexedSeq ->IndexedSeqIterator -indexOf IAssociative IAtom IChunk IChunkedNext IChunkedSeq ICloneable ICollection IComparable ICounted identical? identity IDeref IDerefWithTimeout IEditableCollection IEmptyableCollection IEncodeClojure IEncodeJS IEquiv IFn ifn? IHash IIndexed IIterable IKVReduce IList ILookup IMap IMapEntry IMeta imul IMultiFn INamed inc indexed? IndexedSeq IndexedSeqIterator INext INIT inode-kv-reduce instance? int int-array int-rotate-left integer? interleave interpose into into-array ints IPending IPrintWithWriter IRecord IReduce IReset IReversible is_proto_ isa? ISeq ISeqable ISequential ISet ISorted IStack ISwap iter ITER_SYMBOL iterable? iterate ITransientAssociative ITransientCollection ITransientMap ITransientSet ITransientVector IVector IVolatile IWatchable IWithMeta IWriter

    J js->clj js-delete js-invoke js-keys js-mod js-obj js-reserved js-reserved-arr js-reserved? juxt

    K ->KeySeq ->Keyword keep keep-indexed key key->js key-test keys KeySeq Keyword keyword keyword-identical? keyword?

    L *loaded-libs* ->LazySeq ->LazyTransformer ->List -lastIndexOf last lazy-transformer LazySeq LazyTransformer linear-traversal-nth list List list* list? load-file long long-array longs lookup-sentinel

    M *main-cli-fn* ->MetaFn ->MultiFn ->MultiStepper m3-C1 m3-C2 m3-fmix m3-hash-int m3-hash-unencoded-chars m3-mix-H1 m3-mix-K1 m3-seed make-array make-hierarchy map map-indexed map? mapcat mapv mask max max-key memoize merge merge-with meta MetaFn methods min min-key missing-protocol mix-collection-hash mk-bound-fn mod multi-stepper MultiFn MultiStepper munge munge-str

    N *ns* ->Namespace ->NeverEquiv ->NodeIterator ->NodeSeq name namespace Namespace native-satisfies? neg? never-equiv NeverEquiv new-path newline next nfirst nil-iter nil? nnext NodeIterator NodeSeq not not-any? not-empty not-every? not-native not= ns-interns* ns-lookup ns-name NS_CACHE nth nthnext nthrest number?

    O *out* ->ObjMap obj-clone obj-map obj-map->hash-map obj-map-compare-keys object-array object? ObjMap odd?

    P *print-dup* *print-err-fn* *print-fn* *print-length* *print-level* *print-meta* *print-newline* *print-readably* ->PersistentArrayMap ->PersistentArrayMapIterator ->PersistentArrayMapSeq ->PersistentHashMap ->PersistentHashSet ->PersistentQueue ->PersistentQueueIter ->PersistentQueueSeq ->PersistentTreeMap ->PersistentTreeMapSeq ->PersistentTreeSet ->PersistentVector pack-array-node parents partial partition partition-all partition-by peek persistent! persistent-array-map-seq PersistentArrayMap PersistentArrayMapIterator PersistentArrayMapSeq PersistentHashMap PersistentHashSet PersistentQueue PersistentQueueIter PersistentQueueSeq PersistentTreeMap PersistentTreeMapSeq PersistentTreeSet PersistentVector pop pop! pop-tail pos? pr pr-opts pr-sb-with-opts pr-seq-writer pr-sequential-writer pr-str pr-str* pr-str-with-opts pr-with-opts pr-writer pr-writer-ex-info pr-writer-impl prefer-method prefers prefers* preserving-reduced prim-seq print print-map print-meta? print-str println println-str prn prn-str prn-str-with-opts push-tail pv-aget pv-aset pv-clone-node pv-fresh-node

    Q quot quote-string

    R ->Range ->RangedIterator ->RangeIterator ->RecordIter ->RedNode ->Reduced ->RSeq rand rand-int rand-nth random-sample random-uuid range Range ranged-iterator RangedIterator RangeIterator re-find re-matches re-pattern re-seq realized? record? RecordIter RedNode reduce reduce-kv reduceable? Reduced reduced reduced? reductions regexp? rem remove remove-all-methods remove-method remove-pair remove-watch repeat repeatedly replace replicate reset! reset-cache reset-meta! rest reverse reversible? RSeq rseq rsubseq run!

    S ->SeqIter ->Stepper ->StringBufferWriter ->StringIter ->Subvec ->Symbol scan-array second select-keys seq seq-iter seq-reduce seq? seqable? SeqIter sequence sequential? set set-from-indexed-seq set-print-err-fn! set-print-fn! set-validator! set? short shorts shuffle some some-fn some? sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? split-at split-with spread START stepper Stepper str string-hash-cache string-hash-cache-count string-iter string-print string? StringBufferWriter StringIter subs subseq Subvec subvec swap! swap-global-hierarchy! Symbol symbol symbol-identical? symbol? system-time

    T *target* ->TaggedLiteral ->TransientArrayMap ->TransientHashMap ->TransientHashSet ->TransientVector tagged-literal tagged-literal? TaggedLiteral tail-off take take-last take-nth take-while test throw-no-method-error to-array to-array-2d trampoline transduce transient TransientArrayMap TransientHashMap TransientHashSet TransientVector tree-map-add tree-map-append tree-map-kv-reduce tree-map-remove tree-map-replace tree-map-seq-push tree-seq true? truth_ tv-editable-root tv-editable-tail tv-ensure-editable tv-pop-tail tv-push-tail type type->str

    U *unchecked-if* ->UUID unchecked-add unchecked-add-int unchecked-array-for unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-editable-array-for unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int undefined? underive unreduced unsigned-bit-shift-right update update-in uuid UUID

    V ->ValSeq ->Var ->VectorNode ->Volatile val vals ValSeq Var var? vary-meta vec vector vector-index-out-of-bounds vector? VectorNode Volatile volatile! volatile? vreset!

    W with-meta write-all

    Z zero? zipmap

    cljs.test — cljsDocsSource
    A unit testing framework.
    
    ASSERTIONS
    
    The core of the library is the "is" macro, which lets you make
    assertions of any arbitrary expression:
    
    (is (= 4 (+ 2 2)))
    (is (instance? Integer 256))
    (is (.startsWith "abcde" "ab"))
    
    You can type an "is" expression directly at the REPL, which will
    print a message if it fails.
    
        user> (is (= 5 (+ 2 2)))
    
        FAIL in  (:1)
        expected: (= 5 (+ 2 2))
          actual: (not (= 5 4))
        false
    
    The "expected:" line shows you the original expression, and the
    "actual:" shows you what actually happened.  In this case, it
    shows that (+ 2 2) returned 4, which is not = to 5.  Finally, the
    "false" on the last line is the value returned from the
    expression.  The "is" macro always returns the result of the
    inner expression.
    
    There are two special assertions for testing exceptions.  The
    "(is (thrown? c ...))" form tests if an exception of class c is
    thrown:
    
    (is (thrown? ArithmeticException (/ 1 0))) 
    
    "(is (thrown-with-msg? c re ...))" does the same thing and also
    tests that the message on the exception matches the regular
    expression re:
    
    (is (thrown-with-msg? ArithmeticException #"Divide by zero"
                          (/ 1 0)))
    
    DOCUMENTING TESTS
    
    "is" takes an optional second argument, a string describing the
    assertion.  This message will be included in the error report.
    
    (is (= 5 (+ 2 2)) "Crazy arithmetic")
    
    In addition, you can document groups of assertions with the
    "testing" macro, which takes a string followed by any number of
    assertions.  The string will be included in failure reports.
    Calls to "testing" may be nested, and all of the strings will be
    joined together with spaces in the final report, in a style
    similar to RSpec <http://rspec.info/>
    
    (testing "Arithmetic"
      (testing "with positive integers"
        (is (= 4 (+ 2 2)))
        (is (= 7 (+ 3 4))))
      (testing "with negative integers"
        (is (= -4 (+ -2 -2)))
        (is (= -1 (+ 3 -4)))))
    
    Note that, unlike RSpec, the "testing" macro may only be used
    INSIDE a "deftest" form (see below).
    
    
    DEFINING TESTS
    
    (deftest addition
      (is (= 4 (+ 2 2)))
      (is (= 7 (+ 3 4))))
    
    (deftest subtraction
      (is (= 1 (- 4 3)))
      (is (= 3 (- 7 4))))
    
    This creates functions named "addition" and "subtraction", which
    can be called like any other function.  Therefore, tests can be
    grouped and composed, in a style similar to the test framework in
    Peter Seibel's "Practical Common Lisp"
    <http://www.gigamonkeys.com/book/practical-building-a-unit-test-framework.html>
    
    (deftest arithmetic
      (addition)
      (subtraction))
    
    The names of the nested tests will be joined in a list, like
    "(arithmetic addition)", in failure reports.  You can use nested
    tests to set up a context shared by several tests.
    
    DEFINING ASYNC TESTS
    
    (deftest addition
      (async done
        (is (= 4 (+ 2 2)))
        (is (= 7 (+ 3 4)))
        (done)))
    
    Async tests are constructed with the async macro. The first argument to
    the macro is the test completion callback. The body of the async macro may
    be any series of expressions. The completion callback must be invoked when
    all assertions have run. There is no support for asynchronous coordination -
    core.async is recommended for this. Note the body of the async test must be
    truly asynchronous to avoid stack overflow.
    
    RUNNING TESTS
    
    Run tests with the function "(run-tests namespaces...)":
    
    (run-tests 'your.namespace 'some.other.namespace)
    
    If you don't specify any namespaces, the current namespace is
    used.  To run all tests in all namespaces, use "(run-all-tests)".
    
    By default, these functions will search for all tests defined in
    a namespace and run them in an undefined order.  However, if you
    are composing tests, as in the "arithmetic" example above, you
    probably do not want the "addition" and "subtraction" tests run
    separately.  In that case, you must define a special function
    named "test-ns-hook" that runs your tests in the correct order:
    
    (defn test-ns-hook []
      (arithmetic))
    
    "run-tests" also optionally takes a testing enviroment. A default
    one is supplied for you by invoking "empty-env".  The test
    environment contains everything needed to run tests including the
    report results map. Fixtures must be present here if you want them
    to run. Note that code that relies on "test-ns" will
    automatically be supplied the appropriate defined fixtures.  For
    example, this is done for you if you use "run-tests".
    
    Note: test-ns-hook prevents execution of fixtures (see below).
    
    
    OMITTING TESTS FROM PRODUCTION CODE
    
    You can set the ClojureScript compiler build option
    ":load-tests" to false when loading or compiling code in
    production.  This will prevent any tests from being created by
    or "deftest".
    
    
    FIXTURES
    
    Fixtures allow you to run code before and after tests, to set up
    the context in which tests should be run.
    
    A fixture is a map of one or two functions that run code before and
    after tests.  It looks like this:
    
    {:before (fn []
               Perform setup, establish bindings, whatever.
               )
     :after (fn []
              Tear-down / clean-up code here.
              )}
    
    Both are optional and can be left out.
    
    Fixtures are attached to namespaces in one of two ways.  "each"
    fixtures are run repeatedly, once for each test function created
    with "deftest".  "each" fixtures are useful for
    establishing a consistent before/after state for each test, like
    clearing out database tables.
    
    "each" fixtures can be attached to the current namespace like this:
    (use-fixtures :each fixture1 fixture2 ...)
    The fixture1, fixture2 are just maps like the example above.
    They can also be passed directly, like this:
    (use-fixtures :each
      {:before (fn [] setup...), :after (fn [] cleanup...)})
    
    The other kind of fixture, a "once" fixture, is only run once,
    around ALL the tests in the namespace.  "once" fixtures are useful
    for tasks that only need to be performed once, like establishing
    database connections, or for time-consuming tasks.
    
    Attach "once" fixtures to the current namespace like this:
    (use-fixtures :once fixture1 fixture2 ...)
    
    Note: Fixtures and test-ns-hook are mutually incompatible.  If you
    are using test-ns-hook, fixture functions will *never* be run.
    
    
    WRAPPING FIXTURES
    
    Instead of a map, a fixture can be specified like this:
    
    (defn my-fixture [f]
       Perform setup, establish bindings, whatever.
      (f)  Then call the function we were passed.
       Tear-down / clean-up code here.
     )
    
    This style is incompatible with async tests. If an async test is
    encountered, testing will be aborted. It can't be mixed with
    fixtures specified as maps.
    
    
    EXTENDING TEST-IS (ADVANCED)
    
    You can extend the behavior of the "is" macro by defining new
    methods for the "assert-expr" multimethod.  These methods are
    called during expansion of the "is" macro, so they should return
    quoted forms to be evaluated.
    
    You can plug in your own test-reporting framework by specifying a
    :reporter key in the test environment. It is normally set to
    :cljs.test/default. Set this to the desired key and supply custom
    implementations of the "report" multimethod.
    
    The 'event' argument is a map.  It will always have a :type key,
    whose value will be a keyword signaling the type of event being
    reported.  Standard events with :type value of :pass, :fail, and
    :error are called when an assertion passes, fails, and throws an
    exception, respectively.  In that case, the event will also have
    the following keys:
    
      :expected   The form that was expected to be true
      :actual     A form representing what actually occurred
      :message    The string message given as an argument to 'is'
    
    The "testing" strings will be a list in the :testing-contexts
    property of the test environment, and the vars being tested will be
    a list in the :testing-vars property of the test environment.
    
    For additional event types, see the examples in the code.
    clojure.walk — cljsDocsSource
    This file defines a generic tree walker for Clojure data
    structures.  It takes any data structure (list, vector, map, set,
    seq), calls a function on every element, and uses the return value
    of the function in place of the original.  This makes it fairly
    easy to write recursive search-and-replace functions, as shown in
    the examples.
    
    Note: "walk" supports all Clojure data structures EXCEPT maps
    created with sorted-map-by.  There is no (obvious) way to retrieve
    the sorting function.
    process.env — cljsDocsSource
    A shim namespace for the Node.js process library
    
    The README below is fetched from the published project artifact. Some relative links may be broken.

    Re-View Hiccup

    badge

    Hiccup is a representation of HTML in Clojure. re-view hiccup parses hiccup and returns React elements. Its goal is to be relatively small (~100 lines) and fast, and offer some additional flexibility (eg. the :wrap-props option) over alternatives. It should work fine in self-hosted ClojureScript.


    New to Hiccup? Read the syntax guide.


    Usage

    re-view-hiccup.core/element accepts a hiccup vector and returns a React element. If a non-vector form is supplied, it is returned untouched. You may pass an options map with a :wrap-props function to be applied to all props maps during parsing.

    Differences from React

    • You can use :for instead of :html-for, and :class instead of :class-name. You may also include a :classes key with a collection of classes, to be joined and concatenated. It is often convenient to manipulate classes as a set or vector.

    Things to know

    • Use dashed prop and style keys, eg. :font-size; keys are converted to camelCase as necessary (data- and aria- attributes remain hyphenated as required by React).
    • Element names must be keywords, and support CSS selector syntax for adding IDs and classes. If no element name is provided, a div is returned. For example: [:span#hello.red] is equivalent to [:span {:id "hello", :class "red"}] [:#hello] is equivalent to [:div {:id "hello"}]
    • Anything in the second position of a hiccup vector that is not a Clojure map is passed as a child element.
    • cljsjs.react and cljsjs.react.dom namespaces are required, but not included. They must be provided separately. You can use any version of React you like. We only expect React.createElement to be in the global environment.

    It is not necessary to use the official cljsjs package. You can create your own bundle (eg. with webpack or rollup) and include it in :foreign-libs, as long as you specify that it provides "cljsjs.react" and "cljsjs.react.dom". See Packaging Foreign Dependencies.