parseURL
Splits a link into scheme, host, port, path, query, fragment and user.
Details #
parseURL(text) takes one argument and returns a record with scheme, host, port (a number, or nothing), path, query, fragment and user.
query is a record of names to values; a name repeated in the link keeps its last value. Parts that are missing are empty text. A bare example.com/path is read as https://example.com/path.
Parameters #
Takes 1 argument.
{{ parseURL(text) }}
Examples #
parseURL("https://example.com:8080/a/b?x=1&y=2#top").query.y→
2parseURL("example.com/docs").host→
example.comGotchas #
Text that isn't a link is an error:
parseURL() couldn't read 'hello world' as a link.