Liking cljdoc? Tell your friends :D

cryogen-core.compiler


add-descriptionclj

(add-description {:keys [blocks-per-preview description-include-elements]
                  :or {description-include-elements #{:h5 :h4 :h6 :h2 :h1 :h3
                                                      :p}}}
                 page)

Add plain text :description to the page/post for use in meta description etc.

Add plain text `:description` to the page/post for use in meta description etc.
sourceraw docstring

add-prev-nextclj

(add-prev-next pages)

Adds a :prev and :next key to the page/post data containing the metadata of the prev/next post/page if it exists

Adds a :prev and :next key to the page/post data containing the metadata of the prev/next
post/page if it exists
sourceraw docstring

add-tocclj

(add-toc {:keys [content-dom toc toc-class] :as article} config)

Adds :toc to article, if necessary

Adds :toc to article, if necessary
sourceraw docstring

compile-archivesclj

(compile-archives {:keys [blog-prefix] :as params} posts)

Compiles the archives page into html and spits it out into the public folder

Compiles the archives page into html and spits it out into the public folder
sourceraw docstring

compile-assetsclj

(compile-assets)
(compile-assets overrides-and-hooks)
(compile-assets {:keys [extend-params-fn update-article-fn]
                 :or {extend-params-fn (fn [params _] params)
                      update-article-fn (fn [article _] article)}
                 :as overrides-and-hooks}
                changeset)

Generates all the html and copies over resources specified in the config.

Params:

  • overrides-and-hooks - may contain overrides for config.edn; anything here will be available to the page templates, except for the following special parameters:
    • :extend-params-fn - a function (params, site-data) -> params - use it to derive/add additional params for templates
    • :postprocess-article-html-fn - a function (article, params) -> article called after the :content has been rendered to HTML and right before it is written to the disk. Example fn: (fn postprocess [article params] (update article :content selmer.parser/render params))
    • :update-article-fn - a function (article, config) -> article to update a parsed page/post. Return nil to exclude it.
    • changeset - as supplied by cryogen-core.watcher/start-watcher-for-changes! to its callback for incremental compilation, see only-changed-files-filter for details

Note on terminology:

  • article - a post or page data (including its title, content, etc.)
  • config - the site-wide configuration ± from config.edn and the provided overrides
  • params - config + content such as :pages etc.
  • site-data - a subset of the site content such as :pages, :posts - see the code below
Generates all the html and copies over resources specified in the config.

Params:
 - `overrides-and-hooks` - may contain overrides for `config.edn`; anything
    here will be available to the page templates, except for the following special
              parameters:
   - `:extend-params-fn` - a function (`params`, `site-data`) -> `params` -
                           use it to derive/add additional params for templates
   - `:postprocess-article-html-fn` - a function (`article`, `params`) -> `article`
                           called after the `:content` has been rendered to HTML and
                            right before it is written to the disk. Example fn:
                            `(fn postprocess [article params] (update article :content selmer.parser/render params))`
   - `:update-article-fn` - a function (`article`, `config`) -> `article` to update a
                          parsed page/post. Return nil to exclude it.
   - `changeset` - as supplied by
                 [[cryogen-core.watcher/start-watcher-for-changes!]] to its callback
                 for incremental compilation, see [[only-changed-files-filter]]
                 for details

Note on terminology:
 - `article` - a post or page data (including its title, content, etc.)
 - `config` - the site-wide configuration ± from `config.edn` and the provided overrides
 - `params` - `config` + content such as `:pages` etc.
 - `site-data` - a subset of the site content such as `:pages`, `:posts` - see the code below
sourceraw docstring

compile-assets-timedclj

(compile-assets-timed)
(compile-assets-timed config)
(compile-assets-timed config changeset)

See the docstring for compile-assets

See the docstring for [[compile-assets]]
sourceraw docstring

compile-authorsclj

(compile-authors {:keys [blog-prefix author-root-uri author] :as params} posts)

For each author, creates a page with filtered posts.

For each author, creates a page with filtered posts.
sourceraw docstring

compile-indexclj

(compile-index {:keys [blog-prefix debug? home-page] :as params})

Compiles the index page into html and spits it out into the public folder

Compiles the index page into html and spits it out into the public folder
sourceraw docstring

compile-pagesclj

(compile-pages {:keys [blog-prefix page-root-uri debug?] :as params} pages)

Compiles all the pages into html and spits them out into the public folder

Compiles all the pages into html and spits them out into the public folder
sourceraw docstring

compile-postsclj

(compile-posts {:keys [blog-prefix post-root-uri debug?] :as params} posts)

Compiles all the posts into html and spits them out into the public folder

Compiles all the posts into html and spits them out into the public folder
sourceraw docstring

compile-preview-pagesclj

(compile-preview-pages {:keys [blog-prefix posts-per-page blocks-per-preview]
                        :as params}
                       posts)

Compiles a series of pages containing 'previews' from each post

Compiles a series of pages containing 'previews' from each post
sourceraw docstring

compile-tagsclj

(compile-tags {:keys [blog-prefix tag-root-uri] :as params} posts-by-tag)

Compiles all the tag pages into html and spits them out into the public folder

Compiles all the tag pages into html and spits them out into the public folder
sourceraw docstring

compile-tags-pageclj

(compile-tags-page {:keys [blog-prefix] :as params})
source

content-dom->htmlclj

(content-dom->html {dom :content-dom :as article})
source

content-rootclj

source

content-until-more-markerclj

(content-until-more-marker content-dom)

Returns the content until the <!--more--> special comment, closing any unclosed tags. Returns nil if there's no such comment.

Returns the content until the <!--more--> special comment,
closing any unclosed tags. Returns nil if there's no such comment.
sourceraw docstring

copy-resources-from-markup-foldersclj

(copy-resources-from-markup-folders {:keys [post-root page-root] :as config})

Copy resources from markup folders. This does not copy the markup entries.

Copy resources from markup folders. This does not copy the markup entries.
sourceraw docstring

create-previewclj

(create-preview blocks-per-preview post)

Creates a single post preview

Creates a single post preview
sourceraw docstring

(create-preview-links previews params)

Turn each vector of previews into a map with :prev and :next keys that contain the uri of the prev/next preview page

Turn each vector of previews into a map with :prev and :next keys that contain the uri of the
prev/next preview page
sourceraw docstring

create-previewsclj

(create-previews posts posts-per-page blocks-per-preview)

Returns a sequence of vectors, each containing a set of post previews

Returns a sequence of vectors, each containing a set of post previews
sourceraw docstring

find-entriesclj

(find-entries root mu ignored-files)

Returns a list of files under the content directory according to the implemented Markup protocol and specified root directory. It defaults to looking under the implemented protocol's subdirectory, but fallsback to look at the content directory.

Returns a list of files under the content directory according to the
implemented Markup protocol and specified root directory. It defaults to
looking under the implemented protocol's subdirectory, but fallsback to look
at the content directory.
sourceraw docstring

find-pagesclj

(find-pages {:keys [page-root ignored-files]} mu)

Returns a list of markdown files representing pages under the page root.

Returns a list of markdown files representing pages under the page root.
sourceraw docstring

find-postsclj

(find-posts {:keys [post-root ignored-files]} mu)

Returns a list of markdown files representing posts under the post root.

Returns a list of markdown files representing posts under the post root.
sourceraw docstring

group-by-tagsclj

(group-by-tags posts)

Maps all the tags with a list of posts that contain each tag

Maps all the tags with a list of posts that contain each tag
sourceraw docstring

group-for-archiveclj

(group-for-archive posts)

Groups the posts by month and year for archive sorting

Groups the posts by month and year for archive sorting
sourceraw docstring

group-for-authorclj

(group-for-author posts default-author)

Groups the posts by author. If no post author if found defaults default-author.

Groups the posts by author. If no post author if found defaults `default-author`.
sourceraw docstring

group-pagesclj

(group-pages pages)

Separates the pages into links for the navbar and links for the sidebar

Separates the pages into links for the navbar and links for the sidebar
sourceraw docstring

htmlize-contentclj

(htmlize-content {:keys [postprocess-article-html-fn] :as params})
source

merge-meta-and-contentclj

(merge-meta-and-content file-name page-meta content-dom)

Merges the page metadata and content maps

Merges the page metadata and content maps
sourceraw docstring

only-changed-files-filterclj

(only-changed-files-filter changeset)

Returns a page/post filter that only accepts these files:

  • no filtering if changeset is empty (as it means this is the first build)
  • recompile the post/page that has changed since the last compilation
  • recompile everything if a template HTML file has changed

Arguments:

  • changeset - sequence of java.io.File of relative paths within the project, such as File[content/asc/pages/about.asc], as provided by cryogen-core.watcher/find-changes

Downsides: Tags, archives, index etc. will only know about the recompiled post and not the others. Previous/next links on neighbour posts won't be updated either.

Returns a page/post filter that only accepts these files:

- no filtering if `changeset` is empty (as it means this is the first build)
- recompile the post/page that has changed since the last compilation
- recompile everything if a template HTML file has changed

Arguments:
- `changeset` - sequence of `java.io.File` of relative paths within the
  project, such as `File[content/asc/pages/about.asc]`, as provided by
  [[cryogen-core.watcher/find-changes]]

Downsides: Tags, archives, index etc. will only know about the recompiled
post and not the others. Previous/next links on neighbour posts won't be
updated either.
sourceraw docstring

page-contentclj

(page-content page config markup)

Returns a map with the given page's file-name, metadata and content parsed from the file with the given markup.

Returns a map with the given page's file-name, metadata and content parsed from
the file with the given markup.
sourceraw docstring

page-uriclj

(page-uri file-name params)
(page-uri file-name uri-type {:keys [blog-prefix clean-urls] :as params})

Creates a URI from file name. uri-type is any of the uri types specified in config, e.g., :post-root-uri.

Creates a URI from file name. `uri-type` is any of the uri types specified in config, e.g., `:post-root-uri`.
sourceraw docstring

parse-pageclj

(parse-page page config markup)

Parses a page/post and returns a map of the content, uri, date etc.

Parses a page/post and returns a map of the content, uri, date etc.
sourceraw docstring

parse-postclj

(parse-post page config markup)

Return a map with the given post's information.

Return a map with the given post's information.
sourceraw docstring

parse-post-dateclj

(parse-post-date file-name date-fmt)

Parses the post date from the post's file name and returns the corresponding java date object

Parses the post date from the post's file name and returns the corresponding java date object
sourceraw docstring

preview-domclj

(preview-dom blocks-per-preview content-dom)
source

re-pattern-from-extsclj

(re-pattern-from-exts exts)

Creates a properly quoted regex pattern for the given file extensions

Creates a properly quoted regex pattern for the given file extensions
sourceraw docstring

read-page-metaclj

(read-page-meta page rdr)

Returns the clojure map from the top of a markdown page/post

Returns the clojure map from the top of a markdown page/post
sourceraw docstring

read-pagesclj

(read-pages config incremental-compile-filter)

Returns a sequence of maps representing the data from markdown files of pages. Sorts the sequence by post date.

Returns a sequence of maps representing the data from markdown files of pages.
Sorts the sequence by post date.
sourceraw docstring

read-postsclj

(read-posts config incremental-compile-filter)

Returns a sequence of maps representing the data from markdown files of posts. Sorts the sequence by post date.

Returns a sequence of maps representing the data from markdown files of posts.
Sorts the sequence by post date.
sourceraw docstring

render-fileclj

(render-file file-path params)

Wrapper around selmer.parser/render-file with pre-processing

Wrapper around `selmer.parser/render-file` with pre-processing
sourceraw docstring

tag-infoclj

(tag-info config tag)

Returns a map containing the name and uri of the specified tag

Returns a map containing the name and uri of the specified tag
sourceraw docstring

tag-postclj

(tag-post tags post)

Adds the uri and title of a post to the list of posts under each of its tags

Adds the uri and title of a post to the list of posts under each of its tags
sourceraw docstring

tag-postsclj

(tag-posts posts config)

Converts the tags in each post into links

Converts the tags in each post into links
sourceraw docstring

url-encodeclj

(url-encode str)

Url encode path element. Encodes spaces as %20 instead of +, because some webservers pass + through to the file system

Url encode path element. Encodes spaces as %20 instead of +,
because some webservers pass + through to the file system
sourceraw docstring

write-htmlclj

(write-html file-uri {:keys [blog-prefix clean-urls]} data)

When clean-urls is set to:

  • :trailing-slash appends /index.html.
  • :no-trailing-slash appends .html.
  • :dirty just spits.
When `clean-urls` is set to:
- `:trailing-slash` appends `/index.html`.
- `:no-trailing-slash` appends `.html`.
- `:dirty` just spits.
sourceraw docstring

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

× close