Changeset 36924 in project


Ignore:
Timestamp:
11/25/18 13:30:33 (3 weeks ago)
Author:
sjamaan
Message:

uri-generic: Do not start relative uris with ./; that's completely unnecessary and generates "ugly" links that are longer than required

Location:
release/5/uri-generic/branches/relative-paths
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/uri-generic/branches/relative-paths/tests/run.scm

    r36877 r36924  
    1 ;;(load "../uri-generic.scm")
     1(load "../uri-generic.scm")
    22(import uri-generic (chicken format) (chicken string) srfi-1 test)
    33
     
    1111    ("http://ex/x/y/z" "http://ex/x/r" "../r")
    1212
    13     ("http://ex/x/y"  "http://ex/x/q/r" "./q/r")
    14     ("http://ex/x/y"  "http://ex/x/q/r#s" "./q/r#s")
    15     ("http://ex/x/y"  "http://ex/x/q/r#s/t" "./q/r#s/t")
     13    ("http://ex/x/y"  "http://ex/x/q/r" "q/r")
     14    ("http://ex/x/y"  "http://ex/x/q/r#s" "q/r#s")
     15    ("http://ex/x/y"  "http://ex/x/q/r#s/t" "q/r#s/t")
    1616    ("http://ex/x/y"  "ftp://ex/x/q/r" "ftp://ex/x/q/r")
    1717    ("http://ex/x/y"  "http://ex/x/y"   "y")
    1818    ("http://ex/x/y/" "http://ex/x/y/"  ".")
    1919    ("http://ex/x/y/pdq" "http://ex/x/y/pdq" "pdq")
    20     ("http://ex/x/y/" "http://ex/x/y/z/" "./z/")
     20    ("http://ex/x/y/" "http://ex/x/y/z/" "z/")
    2121    ("file:/swap/test/animal.rdf" "file:/swap/test/animal.rdf#Animal" "animal.rdf#Animal")
    2222    ("file:/e/x/y/z" "file:/e/x/abc" "../abc")
     
    2424    ("file:/ex/x/y/z" "file:/ex/x/r" "../r")
    2525    ("file:/ex/x/y/z" "file:/r" "../../../r")
    26     ("file:/ex/x/y" "file:/ex/x/q/r" "./q/r")
    27     ("file:/ex/x/y" "file:/ex/x/q/r#s" "./q/r#s")
    28     ("file:/ex/x/y" "file:/ex/x/q/r#" "./q/r#")
    29     ("file:/ex/x/y" "file:/ex/x/q/r#s/t" "./q/r#s/t")
     26    ("file:/ex/x/y" "file:/ex/x/q/r" "q/r")
     27    ("file:/ex/x/y" "file:/ex/x/q/r#s" "q/r#s")
     28    ("file:/ex/x/y" "file:/ex/x/q/r#" "q/r#")
     29    ("file:/ex/x/y" "file:/ex/x/q/r#s/t" "q/r#s/t")
    3030    ("file:/ex/x/y" "ftp://ex/x/q/r" "ftp://ex/x/q/r")
    3131    ("file:/ex/x/y" "file:/ex/x/y" "y")
    3232    ("file:/ex/x/y/" "file:/ex/x/y/" ".")
    3333    ("file:/ex/x/y/pdq" "file:/ex/x/y/pdq" "pdq")
    34     ("file:/ex/x/y/" "file:/ex/x/y/z/" "./z/")
     34    ("file:/ex/x/y/" "file:/ex/x/y/z/" "z/")
    3535    ("file:/devel/WWW/2000/10/swap/test/reluri-1.n3" "file://meetings.example.com/cal#m1"
    3636     "//meetings.example.com/cal#m1")
     
    4040    ("file:/some/dir/foo" "file:/some/dir/#" ".#")
    4141    ;; From Graham Klyne Thu 20 Feb 2003 18:08:17 +0000
    42     ("http://example/x/y%2Fz"  "http://example/x/abc"     "./abc")
     42    ("http://example/x/y%2Fz"  "http://example/x/abc"     "abc")
    4343    ("http://example/x/y/z"    "http://example/x%2Fabc"   "../../x%2Fabc")
    4444    ("http://example/x/y%2Fz"  "http://example/x%2Fabc"   "../x%2Fabc")
    45     ("http://example/x%2Fy/z"  "http://example/x%2Fy/abc" "./abc")
     45    ("http://example/x%2Fy/z"  "http://example/x%2Fy/abc" "abc")
    4646    ;; Ryan Lee
    4747    ("http://example/x/abc.efg" "http://example/x/" ".")
     
    146146(define reverse-extra-cases
    147147  `((,base ,base "d;p")
    148     (,base "http://a/b/c/e" "./e")
     148    (,base "http://a/b/c/e" "e")
    149149    (,base "http://a/b/c/" ".")
    150150    (,base "http://a/b/e" "../e")
  • release/5/uri-generic/branches/relative-paths/uri-generic.scm

    r36877 r36924  
    12281228         ;; Construct a relative path segment
    12291229         ((('/ . sa1) ('/ . sb1))
    1230           (make-rel-path (rel-path-from1 sa1 sb1)))
     1230          (rel-path-from1 sa1 sb1))
    12311231         (else (uri-error 'rel-path-from "Both URI paths must be absolute" pabs base))))
    1232 
    1233 (define (make-rel-path x)
    1234   (match x
    1235     ((or ('/ . rst) ("." . rst) (".." . rst)) x)
    1236     (("") (list "."))
    1237     (else (cons "." x))))
    12381232
    12391233;;  rel-path-from1 strips off trailing names from the supplied paths,
     
    12451239      (match rp
    12461240        (() (cond ((string=? na nb) (list))
     1241                  ((string=? na "") (list "."))
    12471242                  (else (list na))))
    12481243        ((rp1 ... (or ".." "."))
Note: See TracChangeset for help on using the changeset viewer.