add env script
[bpt/guile.git] / module / slib / uri.txi
1 @code{(require 'uri)}
2
3 @noindent Implements @dfn{Uniform Resource Identifiers} (URI) as
4 @cindex Uniform Resource Identifiers
5 described in RFC 2396.
6
7
8 @defun make-uri
9
10
11 @defunx make-uri fragment
12
13 @defunx make-uri query fragment
14
15 @defunx make-uri path query fragment
16
17 @defunx make-uri authority path query fragment
18
19 @defunx make-uri scheme authority path query fragment
20
21 Returns a Uniform Resource Identifier string from component arguments.
22 @end defun
23
24 @defun html:anchor name
25 Returns a string which defines this location in the (HTML) file
26 as @var{name}. The hypertext @samp{<A HREF="#@var{name}">} will link to this point.
27
28 @example
29 (html:anchor "(section 7)")
30 @result{}
31 "<A NAME=\"(section%207)\"></A>"
32 @end example
33 @end defun
34
35 @defun html:link uri highlighted
36 Returns a string which links the @var{highlighted} text to @var{uri}.
37
38 @example
39 (html:link (make-uri "(section 7)") "section 7")
40 @result{}
41 "<A HREF=\"#(section%207)\">section 7</A>"
42 @end example
43 @end defun
44
45 @defun html:base uri
46 Returns a string specifying the @dfn{base} @var{uri} of a document, for
47 @cindex base
48 inclusion in the HEAD of the document (@pxref{HTML, head}).
49 @end defun
50
51 @defun html:isindex prompt
52 Returns a string specifying the search @var{prompt} of a document, for
53 inclusion in the HEAD of the document (@pxref{HTML, head}).
54 @end defun
55
56 @defun uri->tree uri-reference base-tree @dots{}
57 Returns a list of 5 elements corresponding to the parts
58 (@var{scheme} @var{authority} @var{path} @var{query} @var{fragment})
59 of string @var{uri-reference}. Elements corresponding to absent parts are #f.
60
61 The @var{path} is a list of strings. If the first string is empty,
62 then the path is absolute; otherwise relative.
63
64 If the @var{authority} component is a
65 @dfn{Server-based Naming Authority}, then it is a list of the
66 @cindex Server-based Naming Authority
67 @var{userinfo}, @var{host}, and @var{port} strings (or #f). For other
68 types of @var{authority} components the @var{authority} will be a
69 string.
70
71 @example
72 (uri->tree "http://www.ics.uci.edu/pub/ietf/uri/#Related")
73 @result{}
74 (http "www.ics.uci.edu" ("" "pub" "ietf" "uri" "") #f "Related")
75 @end example
76 @end defun
77
78 @noindent @code{uric:} prefixes indicate procedures dealing with
79 URI-components.
80
81
82 @defun uric:encode uri-component allows
83 Returns a copy of the string @var{uri-component} in which all @dfn{unsafe} octets
84 @cindex unsafe
85 (as defined in RFC 2396) have been @samp{%} @dfn{escaped}.
86 @cindex escaped
87 @code{uric:decode} decodes strings encoded by @code{uric:encode}.
88 @end defun
89
90 @defun uric:decode uri-component
91 Returns a copy of the string @var{uri-component} in which each @samp{%} escaped
92 characters in @var{uri-component} is replaced with the character it encodes. This
93 routine is useful for showing URI contents on error pages.
94 @end defun