Liking cljdoc? Tell your friends :D

fr.jeremyschoffen.textp.alpha.lib.tag-utils


clj-arg?clj/s

(clj-arg? m)
source

clj-fn->tag-fnclj/s

(clj-fn->tag-fn f)

Turn a classic clojure function into a function that can be used in tag form. The arguments of the new function will be passed in a clojure tag argument. For instance defining the following:

(defn add [x y]
  (+ x y))

(def add-tag (clj-fn->tag-fn add))

allows us to do this in textp documents:

◊add-tag[1 2] instead of ◊(add 1 2)◊.
Turn a classic clojure function into a function that can be used in tag form. The arguments
 of the new function will be passed in a clojure tag argument.
 For instance defining the following:
 ```clojure
 (defn add [x y]
   (+ x y))

 (def add-tag (clj-fn->tag-fn add))
 ```

allows us to do this in textp documents:
```text
◊add-tag[1 2] instead of ◊(add 1 2)◊.
```
sourceraw docstring

conform-or-throwclj/s

(conform-or-throw spec v)
source

def-tag-fncljmacro

(def-tag-fn name doc-string? attr-map? [params*] prepost-map? body)
(def-tag-fn name
            doc-string?
            attr-map?
            ([params*] prepost-map? body)
            +
            attr-map?)

Define a function that will be used in tag form in a text document. Similar to [[textp.lib.core/clj-fn->tag-fn]].

You can define the function:

(def-tag-fn add [x y]
  (+ x y))

to be used this way:

Some text then ◊add[1 2].

This call would be equivalent to:

(add {:tag :tag-args-clj
      :content [1 2]})
Define a function that will be used in tag form in a text document.
Similar to [[textp.lib.core/clj-fn->tag-fn]].

You can define the function:
```clojure
(def-tag-fn add [x y]
  (+ x y))
```

to be used this way:
```text
Some text then ◊add[1 2].
```

This call would be equivalent to:
```clojure
(add {:tag :tag-args-clj
      :content [1 2]})
```
sourceraw docstring

def-xml-tagcljmacro

(def-xml-tag name docstring? keyword-name?)

Define a function intended to be used in a textp document as a tag. For instance:

(ns my-ns
  (:require [fr.jeremyschoffen.textp.alpha.lib.core :refer [def-xml-tag]]))

(def-xml-tag div "The div tag")

can be used in a textp document:

◊(require '[my-ns :refer [div]])◊
Some text.
◊div[:class "blue"] {some text in the div.}

When eventually read end eval-ed this div function will return something like:

{:tag :div
 :attrs {:class "blue"}
 :content ["some text in the div."]}

Args:

  • name: a symbol, name of the function/tag
  • docstring: a string
  • keyword-name: a keyword, the keyword name of the tag in the resulting map. Allows for:
    (def-xml-tag html-meta :meta)
    

    instead of naming the tag/function meta and having to exclude clojure.core/meta from the ns in which the tag is defined.

Define a function intended to be used in a textp document as a tag. For instance:
```clojure
(ns my-ns
  (:require [fr.jeremyschoffen.textp.alpha.lib.core :refer [def-xml-tag]]))

(def-xml-tag div "The div tag")
```

can be used in a textp document:
```text
◊(require '[my-ns :refer [div]])◊
Some text.
◊div[:class "blue"] {some text in the div.}
```

When eventually read end eval-ed this div function will return something like:
```clojure
{:tag :div
 :attrs {:class "blue"}
 :content ["some text in the div."]}
```

Args:
- `name`: a symbol, name of the function/tag
- `docstring`: a string
- `keyword-name`: a keyword, the keyword name of the tag in the resulting map.
  Allows for:
  ```clojure
  (def-xml-tag html-meta :meta)
  ```
  instead of naming the tag/function `meta` and having to exclude `clojure.core/meta` from the ns in which
  the tag is defined.
sourceraw docstring

make-xml-tagclj/s

(make-xml-tag name attrs content)
source

text-arg?clj/s

(text-arg? m)
source

xml-tag-args->tagclj/s

(xml-tag-args->tag n args)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close