Logic to handle all the various escapes and en/decoding required for URIs and keywords.
Logic to handle all the various escapes and en/decoding required for URIs and keywords.
A map {kw-char escape-string, ...}, for keyword-invalid chars under cljs.
A map {`kw-char` `escape-string`, ...}, for keyword-invalid chars under cljs.
A direct copy of (io/resource 'uri-escapes.edn'), for use in cljs.
A direct copy of (io/resource 'uri-escapes.edn'), for use in cljs.
(decode-kw-name kw-name)Inverse of encode-kw-name. Returns original value of kw-name.
Where
kw-name is a string, typically the name string of a KWI.
Inverse of `encode-kw-name`. Returns original value of `kw-name`. Where `kw-name` is a string, typically the name string of a KWI.
(decode-kw-ns kw-ns)Returns kw-ns with any escapes translated.
Returns `kw-ns` with any escapes translated.
(decode-uri-string s)Inverts URI escapes in s. Inverse of encode-uri-string.
Inverts URI escapes in `s`. Inverse of encode-uri-string.
(encode-kw-name kw-name)Returns kw-name, modified to bet reader-safe.
Derived s.t. when used as the name component of some kw, kw will not choke the
reader. Inverse of decode-kw-name
Where
kw is a keyword := :ns/sReturns `kw-name`, modified to bet reader-safe. Derived s.t. when used as the name component of some `kw`, `kw` will not choke the reader. Inverse of `decode-kw-name` Where - `kw-name`` is a string - `kw` is a keyword := :`ns`/`s`
(encode-kw-ns kw-ns)Returns kw-ns, modified to be reader-safe.
Derived s.t. when used as the namespace component of some   kw, kw will not choke
the reader. Inverse of decode-kw-name.
Where
kw is a keyword := :ns/sReturns `kw-ns`, modified to be reader-safe. Derived s.t. when used as the namespace component of some `kw`, `kw` will not choke the reader. Inverse of `decode-kw-name`. Where - `kw-ns`` is a string - `kw` is a keyword := :`ns`/`s`
(encode-uri-string s)Renders s in a form that can be parsed as a URI.
Renders `s` in a form that can be parsed as a URI.
(escape-slash s)Replaces a slash in s with a backslash-escaped slash.
Replaces a slash in `s` with a backslash-escaped slash.
(escape-utf-8 c)Returns a string for c, escaped as its hex equivalent.
Returns a string for `c`, escaped as its hex equivalent.
(escapes-re inverted-escapes-map)Returns a regex to recognize escape patterns in an encoded string per inverted-escapes-map.
Where
inverted-escapes-map := {escape-pattern original, ...}Returns a regex to recognize escape patterns in an encoded string per `inverted-escapes-map`.
Where
- `inverted-escapes-map` := {`escape-pattern` `original`, ...}
(generate-kwi-escapes)Side-effects: writes uri-escapes.edn and uri-escapes-inverted.edn. These are used to cache values used in clj/s to escape URIs Note: typically used once to populate the resources.
Side-effects: writes uri-escapes.edn and uri-escapes-inverted.edn. These are used to cache values used in clj/s to escape URIs Note: typically used once to populate the resources.
(generate-uri-escapes)Side-effects: writes uri-escapes.edn and uri-escapes-inverted.edn. These are used to cache values used in clj/s to escape URIs Note: typically used once to populate the resources.
Side-effects: writes uri-escapes.edn and uri-escapes-inverted.edn. These are used to cache values used in clj/s to escape URIs Note: typically used once to populate the resources.
(get-escapes char-test escape-fn)(get-escapes char-test escape-fn key-fn)Returns {test-breaker escaped, ...} for char-test and escape-fn.
test-breaker is a char that breaks char-testescaped is a string escaping cchar-test := fn [c] -> true if the char does not need escapingescape-fn := fn [c] -> escapedReturns {`test-breaker` `escaped`, ...} for `char-test` and `escape-fn`.
- Where
  - `test-breaker` is a char that breaks `char-test`
  - `escaped` is a string escaping `c`
  - `char-test` := fn [c] -> true if the char does not need escaping
  - `escape-fn` := fn [c] -> `escaped`
- NOTE: typically called once and stored as a static resource.
A fn [{escaped-char escape-str, ...}] -> {escape-str escaped-char-str, ...}.
A fn [{`escaped-char` `escape-str`, ...}] -> {`escape-str` `escaped-char-str`, ...}.
Maps escaped characters to the originals.
Maps escaped characters to the originals.
A regex to recognize when a string contains escapes.
A regex to recognize when a string contains escapes.
Escapes for characters forbidden a the end of a keyword.
Escapes for characters forbidden a the end of a keyword.
(kw-test c)True when c is problem-free in keywords.
Typically used in creataing edn files to inform encoding/decoding keywords
True when `c` is problem-free in keywords. Typically used in creataing edn files to inform encoding/decoding keywords
Matches a string preceded by a backslash escape.
Matches a string preceded by a backslash escape.
A map {c escape-str, ...} for characters that break a URI string.
A map {`c` `escape-str`, ...} for characters that break a URI string.
A map {escape-str char-str, ...} to decode escaped URI strings.
A map {`escape-str` `char-str`, ...} to decode escaped URI strings.
A regex to replace escape strings with the original escaped char.
A regex to replace escape strings with the original escaped char.
(uri-string? s)True iff s is a valid URI string.
True iff `s` is a valid URI string.
(uri-test c)True when c is problem-free in java URIs.
Typically used to create an edn file to inform encoding/decoding URI strings
True when `c` is problem-free in java URIs. Typically used to create an edn file to inform encoding/decoding URI strings
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 |