From 40f4783fa5f9f2ae972480e0cc0733b661ea99306066ab0c3a73a3d53cf1a554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Bj=C3=B6rnstam?= Date: Sat, 17 Oct 2026 12:39:22 +0200 Subject: [PATCH] std/url: URLs read, written, resolved and percent-encoded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The standard library chapter gets std/url after std/http: the quoted literal that encodes each value for its part, parse-url's strict reading, the round trip, url-resolve, the decoded parts and the encoders. modules/std/url.sz is the reference page, generated from (std url)'s docs. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-4-7) Co-Authored-By: eca-agent --- _03.Standard-library.sz | 5 +++++ modules/std/url.sz | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 modules/std/url.sz diff --git a/_03.Standard-library.sz b/_03.Standard-library.sz index 2703162..6408c0c 100644 --- a/_03.Standard-library.sz +++ b/_03.Standard-library.sz @@ -29,6 +29,11 @@ For more details, see @link["modules/std/rx.html"]{@code{(std rx)}}. The @code{std/http} module allows you to build and send HTTP requests. Sending a request three ways — blocking, suspending, or as an event — is the only thing that differs between the entry points. There is no C# in this module: @code{System.Net.Http} is reached with @code{import/extern}, and the response body is an ordinary @code{TextInputPort}. For more details, see @link["modules/std/http.html"]{@code{(std http)}}. +@subsection{std/url} + +URLs by RFC 3986. A URL is written as a quoted literal, as @code{(std run)} writes a pipeline: @code{(link '(url https "example.com" (path "users" ,name) (query (page 2) (tag ,tag)) (fragment "top")))}, or @code{'(path "users" ,id "edit")} for a path on this site. Each value is encoded for the part that it is in, so a @code{/} in a computed segment does not make a second segment, and a @code{&} in a computed value does not make a second parameter. The compiler checks the parts of a literal where it is written. @code{parse-url} reads a URL or a relative reference strictly, and refuses text that is not one with the column where it goes wrong. A @code{Url} keeps each part as it was written, so @code{url->string} gives back the same text. @code{url-resolve} reads a link where a page is. @code{url-segments} and @code{url-params} decode the path and the query, and there is one percent-encoder for each part of a URL. +For more details, see @link["modules/std/url.html"]{@code{(std url)}}. + @subsection{std/run} The @code{std/run} module provides a way to run external programs. A form is one thing to run, written as a quoted literal, like @code{'(cat "hej.txt")}. You can connect programs in a pipe with @code{'(pipe (cat "a") (wc -l))}, and redirect input and output to files. Redirections can nest, and you can even splice computed arguments or write stages in Bjolang. diff --git a/modules/std/url.sz b/modules/std/url.sz new file mode 100644 index 0000000..63ead3a --- /dev/null +++ b/modules/std/url.sz @@ -0,0 +1,3 @@ +(meta (title "(std url)")) + +@generate-docs[#:module "std url"]