Changeset 13215 in project


Ignore:
Timestamp:
02/08/09 15:54:41 (11 years ago)
Author:
sjamaan
Message:

Document reference resolution better, and add new predicates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/uri-generic

    r13112 r13215  
    4545==== Predicates and Accessors
    4646
    47 * <procedure>(uri? URI) => BOOL</procedure>
    4847* <procedure>(uri-authority URI) => URI-AUTH</procedure>
    4948* <procedure>(uri-scheme URI) => SYMBOL</procedure>
     
    7069functional way (ie, it creates a new copy with the modifications).
    7170
     71* <procedure>(uri? URI) => BOOL</procedure>
     72
     73Is the given object an URI-generic object?
     74
     75* <procedure>(relative-ref? URI) => BOOL</procedure>
     76
     77Is the given object a relative reference?  Relative references are
     78defined by RFC 3986 as URI references which are not URIs; they contain
     79no URI scheme and can be resolved against an absolute URI to obtain
     80a complete URI using {{uri-relative-to}}.
     81
     82* <procedure>(absolute-uri? URI) => BOOL</procedure>
     83
     84Is the given object an absolute URI?  Absolute URI is defined by
     85RFC 3986 as a non-relative URI reference without a fragment.  Absolute
     86URIs can be used as a base URI to resolve a relative-ref against, using
     87{{uri-relative-to}}.
    7288
    7389==== String and List Representations
     
    88104<procedure>(uri-relative-to URI URI) => URI</procedure>
    89105
    90 Constructs an absolute URI given a relative URI and a base URI (RFC 3986, Section 5.2.2)
     106Resolve the first URI as a reference relative to the second URI,
     107returning a new URI (RFC 3986, Section 5.2.2).
    91108
    92109<procedure>(uri-relative-from URI URI) => URI</procedure>
     
    94111Constructs a new, possibly relative, URI which represents the location
    95112of the first URI with respect to the second URI.
     113
     114<examples>
     115<example>
     116<init>(use uri-generic)</init>
     117<expr>(uri->string (uri-relative-to (uri-reference "../qux") (uri-reference "http://example.com/foo/bar/")))</expr>
     118<result>"http://example.com/foo/qux"</result>
     119</example>
     120<example>
     121<init>(use uri-generic)</init>
     122<expr>(uri->string (uri-relative-from (uri-reference "http://example.com/foo/qux") (uri-reference "http://example.com/foo/bar/")))</expr>
     123<result>"../qux"</result>
     124</example>
     125</examples>
    96126
    97127==== String encoding and decoding
     
    160190=== Version History
    161191
     192* trunk Add new predicates for absoluteness/relativeness. Fix absolute-uri so it raises a condition when passing in a non-absolute uri string, instead of returning a string with the error.
    162193* 2.0 Export char-sets, add char-set arg to uri-encode/uri-decode,
    163194       do not decode query args as x-www-form-urlencoded, change path
     
    188219
    189220
    190   Copyright 2008 Ivan Raikov, Peter Bex.
     221  Copyright 2008-2009 Ivan Raikov, Peter Bex.
    191222  All rights reserved.
    192223 
Note: See TracChangeset for help on using the changeset viewer.