Logic to handle all the various escpapes and en/decoding required for URIs and keywords
Logic to handle all the various escpapes and en/decoding required for URIs and keywords
A direct copy of (io/resource 'uri-escapes.edn')
A direct copy of (io/resource 'uri-escapes.edn')
(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 modified kw-name
, 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
/s
Returns modified `kw-name`, 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 modified kw-ns
, derived s.t. when used as the namespacecomponent of
some kw
, kw
will not choke the reader.
Inverse of decode-kw-name
Where
kw
is a keyword := :ns
/s
Returns modified `kw-ns`, derived s.t. when used as the namespacecomponent 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
(ensure-readable-keywords edn)
Returns edn'
, replacing keywords properly encoded for clj or cljs
Where
edn
is a string of edn
NOTE: this would typically be used to translate clj <-> cljsReturns `edn'`, replacing keywords properly encoded for clj or cljs Where - `edn` is a string of edn NOTE: this would typically be used to translate clj <-> cljs
(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-escpaes-map
Where
inverted-escapes-map
:= {escape-pattern
original
, ...}Returns a regex to recognize escape patterns in an encoded string per `inverted-escpaes-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
Where
test-breaker
is a char that breaks char-test
char-test
:= fn [c] -> true if the char does not need escapingescape-fn
:= fn [c] -> escaped
Returns {`test-breaker` `escaped`, ...} for `char-test` and `escape-fn` Where - `test-breaker` is a char that breaks `char-test` - `char-test` := fn [c] -> true if the char does not need escaping - `escape-fn` := fn [c] -> `escaped`
Maps escaped charaters to the originals
Maps escaped charaters 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
(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 is a website building & hosting documentation for Clojure/Script libraries
× close