9 Paths
Although you may use these definitions in your frog.rkt , they are more likely to be used by third-party Body enhancers.
(require frog/paths) | package: frog |
(This module is automatically required for you by the frog/config language used in frog.rkt.)
These definitions represent locations of certain local directories and
files —
parameter
(top) → (or/c #f absolute-path?)
(top path) → void? path : (or/c #f absolute-path?)
procedure
procedure
procedure
procedure
procedure
procedure
procedure
procedure
procedure
procedure
procedure
procedure
(abs->rel/www path) → string?
path : absolute-path?
For example if top is "/project/blog" and current-output-dir is "../build", then given "/project/build/css" this should return "/css". Same result if on Windows and top is "c:\project\blog" and current-output-dir is "..\build".
> (require frog/paths frog/params)
> (parameterize ([top "/projects/blog"] [current-output-dir "."]) (abs->rel/www (string->path "/projects/blog/css"))) "/css"
> (parameterize ([top "/projects/blog"] [current-output-dir "../build"]) (abs->rel/www (string->path "/projects/build/css"))) "/css"
procedure
(abs->rel/src path) → path-string?
path : absolute-path?
procedure
(abs->rel/top path) → path-string?
path : absolute-path?
procedure
(canonical-uri uri-path) → string?
uri-path : string?
> (require frog/paths frog/params) > (canonical-uri "relative/λ/path") "relative/%3F/path"
> (parameterize ([current-uri-prefix #f]) (canonical-uri "/absolute/λ/path")) "/absolute/%3F/path"
> (parameterize ([current-uri-prefix "/prefix"]) (canonical-uri "/absolute/λ/path")) "/prefix/absolute/%3F/path"
> (require frog/paths frog/params)
> (parameterize ([current-scheme/host "https://www.example.com"]) (full-uri "/absolute/path/to/file.html")) "https://www.example.com/absolute/path/to/file.html"
The string is Unicode normalized to NFC form using string-normalize-nfc
Consecutive characters that are neither char-alphabetic? nor char-numeric? are replaced by hyphens.
The string is Unicode normalized to NFD form using string-normalize-nfd