bkyk8rc3zvpnsf5inmcqq4n3k98cv6hj-my-site-hyper-literate-git.test.suzanne.soy-0.0.1

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 1bac8f005747ec6ceb07b3d610a247a5597cfa8c
parent b669a390ffdaf7fa7ff5687acf079e649b2f3a12
Author: Matthew Flatt <mflatt@racket-lang.org>
Date:   Tue, 11 Feb 2014 05:38:07 -0700

scribble/html: add 'index flag in `url-roots`

This flag can be used to make "file://..."-rendered pages easier
to inspect.

original commit: 2f469a06cd56c5be1ddab2a169428cd2099a2cbb

Diffstat:
Mpkgs/scribble-pkgs/scribble-doc/scribblings/scribble/html.scrbl | 10+++++++---
Mpkgs/scribble-pkgs/scribble-html-lib/scribble/html/resource.rkt | 7++++++-
2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/html.scrbl b/pkgs/scribble-pkgs/scribble-doc/scribblings/scribble/html.scrbl @@ -444,8 +444,9 @@ before @racket[renderer] is called.} @defparam[url-roots roots (or/c #f - (listof (or/c (list path-string? string?) - (list path-string? string? 'abs))))]{ + (listof (cons/c path-string? + (cons/c string? + (listof 'abs 'index)))))]{ A parameter that determines how resource paths are converted to URLs for reference. A @racket[#f] value is equivalent to an empty list. @@ -459,7 +460,10 @@ all paths are expected to be disjoint (e.g., no @racket["/foo"] and If an item in the parameter's list includes @racket['abs], then an absolute URL is produced for all references to files with the -corresponding prefix.} +corresponding prefix. If an item includes @racket['index], then an +refer to a directory path is converted to a reference to +@filepath{index.html}, otherwise a reference to @filepath{index.html} +is converted to a directory path.} @defproc[(resource? [v any/c]) boolean?]{ diff --git a/pkgs/scribble-pkgs/scribble-html-lib/scribble/html/resource.rkt b/pkgs/scribble-pkgs/scribble-html-lib/scribble/html/resource.rkt @@ -74,7 +74,12 @@ (and (pair? p) (equal? (car p) (car r)) (loop (cdr r) (cdr p))) (case mode - [(get-path) `(,(cadr root+url+flags) ,@p ,file*)] + [(get-path) `(,(cadr root+url+flags) + ,@p + ,(if (and (equal? file* "") + (memq 'index (cddr root+url+flags))) + default-file + file*))] [(get-abs-or-true) (if (memq 'abs (cddr root+url+flags)) `("" ,@p) #t)] [else (error 'relativize "internal error: ~e" mode)]))))