Weaves together the various HTTP components of cljdoc.
Routing and HTTP concerns are handled via Pedestal and
endpoints are implemented as intereceptors.
For more details on routing see cljdoc.server.routes
.
The main aspects handlded via HTTP (and thus through this namespace) are:
view
)show-build
& all-builds
)sitemap-interceptor
)request-build
, [[full-build]] & [[circle-ci-webhook]])version-resolve-redirect
& jump-interceptor
)Weaves together the various HTTP components of cljdoc. Routing and HTTP concerns are handled via Pedestal and endpoints are implemented as [intereceptors](http://pedestal.io/reference/interceptors). For more details on routing see [[cljdoc.server.routes]]. The main aspects handlded via HTTP (and thus through this namespace) are: - Rendering documentation pages (see [[view]]) - Rendering build logs (see [[show-build]] & [[all-builds]]) - Rendering a sitemap (see [[sitemap-interceptor]]) - Handling build requests (see [[request-build]], [[full-build]] & [[circle-ci-webhook]]) - Redirecting to newer releases (see [[version-resolve-redirect]] & [[jump-interceptor]])
(artifact-data-loader store cache)
Return an interceptor that loads all data from store
that is
relevant for the artifact identified via the entity map in :path-params
.
Return an interceptor that loads all data from `store` that is relevant for the artifact identified via the entity map in `:path-params`.
(build-sitemap {:keys [last-generated sitemap] :as state} storage)
Build a new sitemap if previous one was built longer than 60 minutes ago.
Build a new sitemap if previous one was built longer than 60 minutes ago.
Further process the article-slug
URL segment by splitting on /
characters.
This is necessary because we want to allow arbitrary nesting in user provided doctrees and Pedestal's router will return a single string for everything that comes after a wildcard path segment.
Further process the `article-slug` URL segment by splitting on `/` characters. This is necessary because we want to allow arbitrary nesting in user provided doctrees and Pedestal's router will return a single string for everything that comes after a wildcard path segment.
(index-page store render-fn)
Return a list of interceptors suitable to render an group or
artifact index page as specified by render-fn
.
Return a list of interceptors suitable to render an group or artifact index page as specified by `render-fn`.
Creates an HTTP response with a zip file containing offline docs
for the project that has been injected into the context by artifact-data-loader
.
Creates an HTTP response with a zip file containing offline docs for the project that has been injected into the context by [[artifact-data-loader]].
This interceptor will render the documentation page for the current route
based on the cache-bundle that has been injected into the context previously
by the artifact-data-loader
interceptor.
If the request is for the root page (e.g. /d/group/artifact/0.1.0) this interceptor will also lookup the first article that's part of the cache-bundle and return a 302 redirecting to that page.
This interceptor will render the documentation page for the current route based on the cache-bundle that has been injected into the context previously by the [[artifact-data-loader]] interceptor. If the request is for the root page (e.g. /d/group/artifact/0.1.0) this interceptor will also lookup the first article that's part of the cache-bundle and return a 302 redirecting to that page.
(request-build {:keys [analysis-service build-tracker] :as deps})
Create an interceptor that will initiate documentation builds based
on provided form params using analysis-service
for analysis and tracking
build progress/state via build-tracker
.
Create an interceptor that will initiate documentation builds based on provided form params using `analysis-service` for analysis and tracking build progress/state via `build-tracker`.
(route-resolver {:keys [build-tracker storage cache] :as deps}
{:keys [route-name] :as route})
Given a route name return a list of interceptors to handle requests to that route.
This has been put into place to better separate route-definitions from handler implementation in case route-definitions become interesting for ClojureScript where Pededestal can't go.
For more details see cljdoc.server.routes
.
Given a route name return a list of interceptors to handle requests to that route. This has been put into place to better separate route-definitions from handler implementation in case route-definitions become interesting for ClojureScript where Pededestal can't go. For more details see `cljdoc.server.routes`.
(version-resolve-redirect)
Intelligently resolve the CURRENT
version based on the referer
and Clojars releases.
Users may want to link to API docs from their existing non-API
(Markdown/Asciidoc) documentation. Since links are usually tied to a
specific version this can become cumbersome when updating docs.
This interceptor intelligently rewrites any usages of CURRENT
in
the version part of the URL to use either
Intelligently resolve the `CURRENT` version based on the referer and Clojars releases. Users may want to link to API docs from their existing non-API (Markdown/Asciidoc) documentation. Since links are usually tied to a specific version this can become cumbersome when updating docs. This interceptor intelligently rewrites any usages of `CURRENT` in the version part of the URL to use either - the version from the referring URL - the version of the last release from Clojars
(view storage cache route-name)
Combine various interceptors into an interceptor chain for
rendering views for route-name
.
Combine various interceptors into an interceptor chain for rendering views for `route-name`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close