(build! build-descs & {:as config})
Builds a static web site based on the content specified in specs. Each build-desc should be a mapping of paths, with additional details about how to build data from one path to the other. Available build-desc keys are:
:from
- (required) Path from which to build:to
- (required) Compiled files go here:template-fn
- Function which takes Oz hiccup content and returns some new hiccup, presumably placing the content in question in some:out-path-fn
- Function used for naming compilation output:to-format
- Literal format to use for export!:to-format-fn
- Function of input filename to format:as-assets?
- Pass through as a static assets (for images, css, json or edn data, etc)
Additional options pertinent to the entire build process may be passed in:
:live?
- Watch the file files:lazy?
- If true, don't build anything until it changes; this is best for interactive/incremental updates and focused work.
Set to false if you want to rebuild from scratch. (default true):view?
- Build with live view of most recently changed file (default true):root-dir
- Static assets will be served relative to this directory (defaults to greatest-common-path between all paths)Builds a static web site based on the content specified in specs. Each build-desc should be a mapping of paths, with additional details about how to build data from one path to the other. Available build-desc keys are: * `:from` - (required) Path from which to build * `:to` - (required) Compiled files go here * `:template-fn` - Function which takes Oz hiccup content and returns some new hiccup, presumably placing the content in question in some * `:out-path-fn` - Function used for naming compilation output * `:to-format` - Literal format to use for export! * `:to-format-fn` - Function of input filename to format * `:as-assets?` - Pass through as a static assets (for images, css, json or edn data, etc) - Note: by default, images, css, etc will pass through anyway Additional options pertinent to the entire build process may be passed in: * `:live?` - Watch the file files * `:lazy?` - If true, don't build anything until it changes; this is best for interactive/incremental updates and focused work. Set to false if you want to rebuild from scratch. (default true) * `:view?` - Build with live view of most recently changed file (default true) * `:root-dir` - Static assets will be served relative to this directory (defaults to greatest-common-path between all paths)
(compile doc & {:keys [from-format to-format tag-compilers]})
General purpose compilation function. Uses :from-format
and :to-format
parameters of opts
map to determine how to compile the doc
argument. If :from-format
is not specified, :vega-lite
is assumed for maps and :hiccup
for vectors; :to-format
option must be specified.
If you are working with :hiccup
(even as an intermediary, say between :markdown and :html), the
:tag-compilers
map may specify a map of hiccup tags to functions taking and returning hiccup forms.
Specific compilations may support additional features. For example, compiling to :html
will support
all of the options that the oz/html
function supports.
ALPHA FEATURE: This function can be extended by implementing the compile*
method on key
[from-format to-format]. If you define one of these methods to or from :hiccup
, it will automatically
be possible to compile from or to any other format for which :hiccup
already has a compiler
definition. This functionality may be superceded by a registration function/API in the future, for
more robust registration of specs, available options documentation, etc.
General purpose compilation function. Uses `:from-format` and `:to-format` parameters of `opts` map to determine how to compile the `doc` argument. If `:from-format` is not specified, `:vega-lite` is assumed for maps and `:hiccup` for vectors; `:to-format` option _must_ be specified. If you are working with `:hiccup` (even as an intermediary, say between :markdown and :html), the `:tag-compilers` map may specify a map of hiccup tags to functions taking and returning hiccup forms. Specific compilations may support additional features. For example, compiling to `:html` will support all of the options that the `oz/html` function supports. ALPHA FEATURE: This function can be extended by implementing the `compile*` method on key [from-format to-format]. If you define one of these methods to or from `:hiccup`, it will automatically be possible to compile from or to any other format for which `:hiccup` already has a compiler definition. This functionality may be superceded by a registration function/API in the future, for more robust registration of specs, available options documentation, etc.
(embed-vega-form compile-opts [mode doc & [embed-opts]])
Embed a single Vega-Lite/Vega visualization as hiccup representing a live/interactive embedding as hiccup; Currently private, may be public in future, and name may change.
Embed a single Vega-Lite/Vega visualization as hiccup representing a live/interactive embedding as hiccup; Currently private, may be public in future, and name may change.
(export! doc filepath)
(export! doc filepath {:as opts :keys [to-format]})
(export! doc filepath opt-key opt-val & more-opts)
Compile doc
to filepath
according to opts
map. If :to-format
is not specified, format is
inferred from the filepath
extension.
Default behavior is to call compile
on the doc, and spit the results to filepath
. Thus, opts
map will in general be processed as with compile
.
As with compile, by default maps doc
values will be assumed to be :vega-lite
, unless :mode
or :from-format
opts are explicitly set to :vega
.
ALPHA FEATURE: You may override the export processing for a particular value of :to-format
using the
export!* multimethod. However, as with compile*
, this ability may be superceded by a more robust
registration function in the future, so use at your own risk.
Compile `doc` to `filepath` according to `opts` map. If `:to-format` is not specified, format is inferred from the `filepath` extension. Default behavior is to call `compile` on the doc, and spit the results to `filepath`. Thus, `opts` map will in general be processed as with `compile`. As with compile, by default maps `doc` values will be assumed to be `:vega-lite`, unless `:mode` or `:from-format` opts are explicitly set to `:vega`. ALPHA FEATURE: You may override the export processing for a particular value of `:to-format` using the export!* multimethod. However, as with `compile*`, this ability may be superceded by a more robust registration function in the future, so use at your own risk.
(gist! doc
&
{:as opts :keys [name description public pretty] :or {public false}})
Create a gist with the given doc
Requires authentication, which must be provided by one of the following opts:
:auth
: a Github auth token the form "username:password":auth-token
: a GitHub OAuth1 / Personal access token as a string (recommended):client-id
: an oauth2 client id property:access-token
: oauth2 access tokenCAUTION: Note that running these options from the REPL may leave sensitive data in your ./.lein-repl-history
file.
Thus it's best that you avoid using these options, and instead create a single edn file at ~/.oz/github-creds.edn
with these opts.
You can run chmod 600
on it, so that only the owner is able to access it.
If you want to specify a different path use:
:auth-file
: defaults to ~/.oz/github-creds.edn
.Additional options:
:public
: default false:description
: auto generated based on docCreate a gist with the given doc Requires authentication, which must be provided by one of the following opts: * `:auth`: a Github auth token the form "username:password" * `:auth-token`: a GitHub OAuth1 / Personal access token as a string (recommended) * for oauth2: * `:client-id`: an oauth2 client id property * `:access-token`: oauth2 access token CAUTION: Note that running these options from the REPL may leave sensitive data in your `./.lein-repl-history` file. Thus it's best that you avoid using these options, and instead create a single edn file at `~/.oz/github-creds.edn` with these opts. You can run `chmod 600` on it, so that only the owner is able to access it. If you want to specify a different path use: * `:auth-file`: defaults to `~/.oz/github-creds.edn`. Additional options: * `:public`: default false * `:description`: auto generated based on doc
(kill-watcher! filename)
Kill the corresponding watcher thread.
Kill the corresponding watcher thread.
(kill-watchers!)
(kill-watchers! filenames)
Kill all watcher threads if no args passed, or just watcher threads for specified filenames if specified.
Kill all watcher threads if no args passed, or just watcher threads for specified filenames if specified.
(live-reload! filename)
Watch a clj file for changes, and re-evaluate only those lines which have changed, together with all following lines. Is not sensitive to whitespace changes, and will also always rerun reference forms included in the ns declaration.
Watch a clj file for changes, and re-evaluate only those lines which have changed, together with all following lines. Is not sensitive to whitespace changes, and will also always rerun reference forms included in the ns declaration.
(live-view! filename & {:keys [host port format] :as opts})
Watch file for changes and apply load
& view!
to the contents
Watch file for changes and apply `load` & `view!` to the contents
(load filename & {:as opts :keys [format from-format]})
Reads file and processes according to file type
Reads file and processes according to file type
(publish! doc & {:as opts :keys [mode return-full-gist] :or {mode :vega-lite}})
Publish doc via gist! and print out the corresponding vega-editor or ozviz.io url.
Requires authentication, which must be provided by one of the following opts:
:auth
: a Github auth token the form "username:password":oauth-token
: a GitHub OAuth1 / Personal access token as a string (recommended):client-id
: an oauth2 client id property:access-token
: oauth2 access tokenCAUTION: Note that running these options from the REPL may leave sensitive data in your ./.lein-repl-history
file.
Thus it's best that you avoid using these options, and instead create a single edn file at ~/.oz/github-creds.edn
with these opts.
You can run chmod 600
on it, so that only the owner is able to access it.
If you want to specify a different path use:
:auth-file
: defaults to ~/.oz/github-creds.edn
.Additional options:
:public
: default false:description
: auto generated based on doc:return-full-gist
: return the full tentacles gist api response data:pretty
: pretty print the published specPublish doc via gist! and print out the corresponding vega-editor or ozviz.io url. Requires authentication, which must be provided by one of the following opts: * `:auth`: a Github auth token the form "username:password" * `:oauth-token`: a GitHub OAuth1 / Personal access token as a string (recommended) * for oauth2: * `:client-id`: an oauth2 client id property * `:access-token`: oauth2 access token CAUTION: Note that running these options from the REPL may leave sensitive data in your `./.lein-repl-history` file. Thus it's best that you avoid using these options, and instead create a single edn file at `~/.oz/github-creds.edn` with these opts. You can run `chmod 600` on it, so that only the owner is able to access it. If you want to specify a different path use: * `:auth-file`: defaults to `~/.oz/github-creds.edn`. Additional options: * `:public`: default false * `:description`: auto generated based on doc * `:return-full-gist`: return the full tentacles gist api response data * `:pretty` : pretty print the published spec
(start-server!)
(start-server! & [port])
Start the oz plot server (on localhost:10666 by default).
Start the oz plot server (on localhost:10666 by default).
(vega doc)
(vega doc opts)
Reagent component that renders vega
Reagent component that renders vega
(vega-cli {:keys [vega-doc from-format to-format mode input-filename
output-filename return-result?]
:or {to-format :svg mode :vega-lite return-result? true}})
Takes either doc or the contents of input-filename, and uses the vega/vega-lite cli tools to translate to the specified format. If both doc and input-filename are present, writes doc to input-filename for running cli tool (otherwise, a tmp file is used). This var is semi-public; It's under consideration for fully public inclusion, but consider it alpha for now.
Takes either doc or the contents of input-filename, and uses the vega/vega-lite cli tools to translate to the specified format. If both doc and input-filename are present, writes doc to input-filename for running cli tool (otherwise, a tmp file is used). This var is semi-public; It's under consideration for fully public inclusion, but consider it alpha for now.
(vega-lite doc)
(vega-lite doc opts)
Reagent component that renders vega-lite.
Reagent component that renders vega-lite.
(view! doc & {:keys [host port mode] :as opts})
View the given doc in a web browser. Docs for which map? is true are treated as single Vega-Lite/Vega visualizations.
All other values are treated as hiccup, and are therefore expected to be a vector or other iterable.
This hiccup may contain Vega-Lite/Vega visualizations embedded like [:vega-lite doc]
or [:vega doc]
.
You may also specify :host
and :port
, for server settings, and a :mode
option, defaulting to :vega-lite
, with :vega
the alternate option.
(Though I will note that Vega-Embed often catches when you pass a vega doc to a vega-lite component, and does the right thing with it.
However, this is not guaranteed behavior, so best not to depend on it)
View the given doc in a web browser. Docs for which map? is true are treated as single Vega-Lite/Vega visualizations. All other values are treated as hiccup, and are therefore expected to be a vector or other iterable. This hiccup may contain Vega-Lite/Vega visualizations embedded like `[:vega-lite doc]` or `[:vega doc]`. You may also specify `:host` and `:port`, for server settings, and a `:mode` option, defaulting to `:vega-lite`, with `:vega` the alternate option. (Though I will note that Vega-Embed often catches when you pass a vega doc to a vega-lite component, and does the right thing with it. However, this is not guaranteed behavior, so best not to depend on it)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close