(adjust-error-lines-for-markdown test-file-content type-errors)Adjust error line numbers from test file to markdown code block. The test file has namespace declaration and comments before the markdown code. We need to find where the markdown code starts and adjust accordingly.
Adjust error line numbers from test file to markdown code block. The test file has namespace declaration and comments before the markdown code. We need to find where the markdown code starts and adjust accordingly.
(compare-versions v1 v2)Compare two version strings. Returns :equal, :left-newer, or :right-newer
Compare two version strings. Returns :equal, :left-newer, or :right-newer
(create-error-marker start-line start-column end-line end-column)Create visual error markers for an error. start-column and end-column are 1-indexed positions in the code line. Returns a map with :start-line-marker and :end-line-marker strings.
Create visual error markers for an error. start-column and end-column are 1-indexed positions in the code line. Returns a map with :start-line-marker and :end-line-marker strings.
(doc-test-file-path {:keys [id type] :as metadata} doc-name)Generate test file path from metadata.
Generate test file path from metadata.
(enrich-code-with-errors code type-errors)(enrich-code-with-errors code type-errors test-file-content)Enrich code with visual error markers and messages. Takes code string and list of type-errors from result. Optionally takes test-file-content to adjust line numbers. Returns enriched code string.
Enrich code with visual error markers and messages. Takes code string and list of type-errors from result. Optionally takes test-file-content to adjust line numbers. Returns enriched code string.
(expand-tabs s)Expand tabs to spaces, assuming 8-character tab stops
Expand tabs to spaces, assuming 8-character tab stops
(extract-between lines start end)Extract content between start and end delimiters in a vector of lines.
Extract content between start and end delimiters in a vector of lines.
(extract-namespace-from-file content)Extract namespace from file content
Extract namespace from file content
(format-doc-test-metadata metadata target)Format metadata for insertion into file. target: :markdown or :clojure
Format metadata for insertion into file. target: :markdown or :clojure
(format-error-message message)Format the error message as comment lines, expanding tabs to spaces
Format the error message as comment lines, expanding tabs to spaces
(generate-doc-test-file-content metadata code result doc-name)Generate complete test file content
Generate complete test file content
(generate-doc-test-namespace doc-name id)Generate a namespace name from doc name and id.
Generate a namespace name from doc name and id.
(generate-uuid)Generate a short UUID for code block identification
Generate a short UUID for code block identification
(is-tc-err & body)Returns the result of the tc-err call
Returns the result of the tc-err call
(is-tc-err-messages & body)Performs an is-tc-err and returns error messages
Performs an is-tc-err and returns error messages
(parse-code-blocks markdown-content)Extract code blocks from markdown with their metadata.
Extract code blocks from markdown with their metadata.
(parse-doc-test-file file-path)Parse a test file, extracting metadata, code, and expected result. Returns nil if file doesn't exist.
Parse a test file, extracting metadata, code, and expected result. Returns nil if file doesn't exist.
(parse-doc-test-metadata text)Parse metadata from comment lines. Format: <!-- doc-test: key=value key=value --> or: ;; doc-test: key=value key=value
Parse metadata from comment lines. Format: <!-- doc-test: key=value key=value --> or: ;; doc-test: key=value key=value
(pprint-str data)Pretty-print data structure to string with deterministic sorting
Pretty-print data structure to string with deterministic sorting
(read-form-extent code start-line start-column)Read a form from code at the given line and column, using read+string to determine the extent. Returns {:end-line :end-column :form-string} or nil.
Read a form from code at the given line and column, using read+string
to determine the extent. Returns {:end-line :end-column :form-string} or nil.(should-not-reflect form)Turn on all warning flags, and test that reflection does not occur (as identified by messages to err).
Turn on all warning flags, and test that reflection does not occur (as identified by messages to *err*).
(sort-data-structure data)Recursively sort maps and sets for deterministic output
Recursively sort maps and sets for deterministic output
(sync-all-docs)Sync all documentation files
Sync all documentation files
(sync-code-block block doc-name)Synchronize a single code block with its test file. Returns updated block or nil if no changes needed.
Synchronize a single code block with its test file. Returns updated block or nil if no changes needed.
(sync-doc-file doc-file)Synchronize a single documentation file
Synchronize a single documentation file
(tc-common* frm
{{:keys [syn provided?]} :expected-syntax
:keys [expected-ret requires ns-meta check-config]
:as opt})(tc-e frm & opts)Type check an an expression in namespace that :refer's all of clojure.core.typed (aliased to t) and aliases clojure.core to core.
Takes one form and then options, and returns true if the form checks with the expected input/output types according to the provided options.
The first form in the options can be a static type syntax scoped in the new namespace. This is disambiguated with a call to keyword? (literal keywords aren't valid type syntax).
eg. (tc-e (+ 1 1) Num) ;=> Num
Keyword Options:
:expected-ret An expected ret, evaluated in the current namespace (not the new one that refers c.c.t). Cannot be provided in combination with the implicit first option as a type, as above. :ret Check the return TCResult of this expression against this ret. Evaluated in the current namespace. :ns-meta Map to use as ns metadata. :check-config Map specifying check-config.
Type check an an expression in namespace that :refer's
all of clojure.core.typed (aliased to t) and aliases clojure.core
to core.
Takes one form and then options, and returns true if the form checks
with the expected input/output types according to the provided options.
The first form in the options can be a static type syntax scoped
in the new namespace. This is disambiguated with a call to keyword?
(literal keywords aren't valid type syntax).
eg. (tc-e (+ 1 1) Num)
;=> Num
Keyword Options:
:expected-ret An expected ret, evaluated in the current namespace (not the new
one that refers c.c.t). Cannot be provided in combination with the implicit
first option as a type, as above.
:ret Check the return TCResult of this expression against this ret. Evaluated
in the current namespace.
:ns-meta Map to use as ns metadata.
:check-config Map specifying check-config.(update-markdown original-content blocks)Update markdown content with synchronized code blocks
Update markdown content with synchronized code blocks
(with-err-print-writer & body)Evaluate with err pointing to a temporary PrintWriter, and return err contents as a string.
Evaluate with err pointing to a temporary PrintWriter, and return err contents as a string.
(with-err-string-writer & body)Evaluate with err pointing to a temporary StringWriter, and return err contents as a string.
Evaluate with err pointing to a temporary StringWriter, and return err contents as a string.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |