Liking cljdoc? Tell your friends :D

m1p.core


default-dictionary-fnsclj/s

source

get-string-placeholdersclj/s

(get-string-placeholders s)

Find all interpolation placeholders in the string. An interpolation placeholder is a double bracket around an identifier, e.g. "Hello {{greetee}}"

Returns a set of tuples of the exact string placeholder and the placeholder as a keyword, e.g.:

#{["{{:greetee}}" :greetee]}
Find all interpolation placeholders in the string. An interpolation placeholder
is a double bracket around an identifier, e.g. `"Hello {{greetee}}"`

Returns a set of tuples of the exact string placeholder and the placeholder as
a keyword, e.g.:

```clj
#{["{{:greetee}}" :greetee]}
```
sourceraw docstring

interpolateclj/s

(interpolate data {:keys [dictionaries] :as opt})

Walk data and replace references to dictionary keys with the result of calling lookup. A dictionary key reference is a tuple on the form:

[dictionary-k k & params]

Where dictionary-k is a key in :dictionaries, e.g. :i18n, k is a key in said dictionary, and params are optional arbitrary data. lookup will be called with opt (as passed to interpolate), params and k.

Walk `data` and replace references to dictionary keys with the result of
calling `lookup`. A dictionary key reference is a tuple on the form:

```clj
[dictionary-k k & params]
```

Where `dictionary-k` is a key in `:dictionaries`, e.g. `:i18n`, `k` is a key
in said dictionary, and `params` are optional arbitrary data. `lookup` will be
called with `opt` (as passed to `interpolate`), `params` and `k`.
sourceraw docstring

interpolate-stringclj/s

(interpolate-string s interpolations & [opt])
source

lookupclj/s

(lookup opt dictionary k)
(lookup opt dictionary k data)

Lookup k in dictionary, passing params to dictionary functions. opt is a map of options to pass to dictionary functions.

Lookup `k` in `dictionary`, passing `params` to dictionary functions. `opt` is
a map of options to pass to dictionary functions.
sourceraw docstring

prepare-dict-valclj/s

(prepare-dict-val opt v)

Prepares dictionary value v. If it contains data that matches any :dictionary-fns in opt, prepare-dict-val returns a partially applied resolve-val, otherwise returns v untouched.

Prepares dictionary value `v`. If it contains data that matches any
`:dictionary-fns` in `opt`, `prepare-dict-val` returns a partially applied
`resolve-val`, otherwise returns `v` untouched.
sourceraw docstring

prepare-dictionaryclj/s

(prepare-dictionary dictionary & [opt])

Prepares dictionary for use with lookup and interpolate. dictionary is either a map or a collection of maps. If multiple maps are passed, they are merged and all the values in the resulting map are passed to prepare-dict-val. Returns the prepared dictionary map.

opt is an optional map of options:

  • :dictionary-fns Functions to apply to resolved data. When resolved data contains a vector with a keyword in the first position matching a key in this map, the vector is replaced by calling the associated function with opt, the passed in params, and remaining forms from the original vector.
Prepares dictionary for use with `lookup` and `interpolate`. `dictionary` is
either a map or a collection of maps. If multiple maps are passed, they are
merged and all the values in the resulting map are passed to
`prepare-dict-val`. Returns the prepared dictionary map.

`opt` is an optional map of options:

- `:dictionary-fns`
  Functions to apply to resolved data. When resolved data contains a vector
  with a keyword in the first position matching a key in this map, the vector
  is replaced by calling the associated function with `opt`, the passed in
  `params`, and remaining forms from the original vector.
sourceraw docstring

resolve-valclj/s

(resolve-val {:keys [dictionary-fns exception-handler] :as opt}
             v
             lookup-opt
             data)

Resolve the val v by applying matching dictionary-fns. Dictionary functions are called when v contains a vector where the first value is a key in dictionary-fns. The function will then be called with opt, params, and the rest of the values from the vector. See m1p's Readme for more about dictionary functions.

Resolve the val `v` by applying matching `dictionary-fns`. Dictionary functions
are called when `v` contains a vector where the first value is a key in
`dictionary-fns`. The function will then be called with `opt`, `params`, and
the rest of the values from the vector. See m1p's Readme for more about
dictionary functions.
sourceraw docstring

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

× close