From d5e244a068b98d087a69ff62a727ce2e43d89d86 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 2 Feb 2015 21:28:45 +0100 Subject: [PATCH] Fix `#:redirect-main`/`--redirect-main` for only main installation The intent was for the redirection to apply only to links to documentation in the main installation, but it also affected other paths. --- scribble-lib/scribble/html-render.rkt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scribble-lib/scribble/html-render.rkt b/scribble-lib/scribble/html-render.rkt index 978c5f88..c97c28ec 100644 --- a/scribble-lib/scribble/html-render.rkt +++ b/scribble-lib/scribble/html-render.rkt @@ -1336,10 +1336,15 @@ `((a ([href ,(cond [(and ext-id external-root-url - (let ([rel (find-relative-path - (find-doc-dir) - (relative->path (dest-path dest)))]) - (and (relative-path? rel) + (let* ([ref-path (relative->path (dest-path dest))] + [rel (if (relative-path? ref-path) + #f + (find-relative-path + (find-doc-dir) + ref-path))]) + (and rel + (relative-path? rel) + (not (memq 'up (explode-path rel))) rel))) => (lambda (rel) (url->string*