(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)◊. ```
(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]})
```(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/tagdocstring: a stringkeyword-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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |