lambda-blog.middleware

Various entity transformers used in the generation pipelines.

add-paths

(add-paths path-spec)

Returns a middleware function that adds paths to an entity based on path-spec (e.g. /{{value-1}}/{{value-2}}.html). Each templated value is lambda-blog.utils/substituted into the path using entity keys.

collect-tags

(collect-tags {:keys [entries], :as ent})

Collects unique tags from each of the entries in the entity. Returns entity with collected tags stored under tags.

inspect

(inspect entity)

Pretty prints an entity for debugging purposes. Returns unmodified entity.

promote

(promote what)

Returns a middleware function that promotes all subkeys of a map under what key of an entity into the entity.

substitute

(substitute what)

Returns a middleware function that substitutes each occurance of {{key}} in (entity :what) for the corresponding :key of the entity.

substitute-by

(substitute-by what)

Returns a middleware function that evaluates each occurance of {{expression}} in (entity :what), applies it to entity and substitutes original text for the result.