make documentation start page tell you when there's a redirecting cookie
If you have anything user-specific installed, the `raco setup` generates a user-specific documentation page. Visiting that page sets a cookie (actually, browser local storage, when supported) that redirects searches and "top" to the user-specific page. The main installation-specific page now tells you when a redirect is in place, and it gives you the option of forgetting it (which is handy if you've removed your user-specific documentation directory, for example).
This commit is contained in:
parent
8b019b5799
commit
0408e0f7c2
|
@ -0,0 +1,11 @@
|
|||
|
||||
.RootPathInfo {
|
||||
margin-top: 1em;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.RootPathAction {
|
||||
display: block;
|
||||
font-size: 80%;
|
||||
white-space: nowrap;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
AddOnLoad(function(){
|
||||
var u = GetCookie("PLT_Root."+racket_root_version, null);
|
||||
if (u) {
|
||||
var info = document.getElementById("rootPathInfo");
|
||||
info.style.display = "block";
|
||||
}
|
||||
})
|
||||
|
||||
function GoToRootPath() {
|
||||
return GotoPLTRoot(racket_root_version, "index.html");
|
||||
}
|
||||
|
||||
function DisableRootPath() {
|
||||
SetCookie("PLT_Root."+racket_root_version, "");
|
||||
|
||||
var info = document.getElementById("rootPathInfo");
|
||||
info.style.display = "none";
|
||||
|
||||
return false;
|
||||
}
|
|
@ -40,7 +40,9 @@
|
|||
|
||||
;; the second argument specifies installation/user specific, and if
|
||||
;; it's missing, then it's a page with a single version
|
||||
(define (main-page id [installation-specific? '?] #:force-racket-css? [force-racket-css? #f])
|
||||
(define (main-page id [installation-specific? '?]
|
||||
#:force-racket-css? [force-racket-css? #f]
|
||||
#:show-root-info? [show-root-info? #f])
|
||||
(define info (page-info id))
|
||||
(define title-string (car info))
|
||||
(define root (cadr info))
|
||||
|
@ -54,10 +56,15 @@
|
|||
(title #:style (make-style #f (list*
|
||||
'no-toc
|
||||
'toc-hidden
|
||||
(if (not force-racket-css?)
|
||||
null
|
||||
(list
|
||||
(make-css-addition (collection-file-path "racket.css" "scribble"))))))
|
||||
(append
|
||||
(if force-racket-css?
|
||||
(list (make-css-addition (collection-file-path "racket.css" "scribble")))
|
||||
null)
|
||||
(if (not show-root-info?)
|
||||
null
|
||||
(list
|
||||
(make-css-addition (collection-file-path "root-info.css" "scribblings/main/private"))
|
||||
(make-js-addition (collection-file-path "root-info.js" "scribblings/main/private")))))))
|
||||
title-string
|
||||
#;
|
||||
;; the "(installation)" part shouldn't be visible on the web, but
|
||||
|
@ -74,6 +81,9 @@
|
|||
(front-toc-items up-path)))
|
||||
(make-splice `(,page-title
|
||||
,@toc
|
||||
,@(if show-root-info?
|
||||
(list @script{var racket_root_version = "@(version)"@";"})
|
||||
'())
|
||||
,@(if user-doc?
|
||||
(list @script{SetPLTRoot("@(version)", "@up-path")@";"})
|
||||
'()))))
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#lang scribble/doc
|
||||
@(require "private/utils.rkt" "private/make-search.rkt")
|
||||
|
||||
@main-page['search #t
|
||||
;; "racket.css" needs to be installed for search results:
|
||||
#:force-racket-css? #t]
|
||||
@main-page['search #t]
|
||||
|
||||
@make-search[#f]
|
||||
|
|
|
@ -1,16 +1,28 @@
|
|||
#lang scribble/doc
|
||||
@(require scribble/manual "private/utils.rkt" "private/manuals.rkt")
|
||||
@(require scribble/manual
|
||||
scribble/core
|
||||
scribble/html-properties
|
||||
"private/utils.rkt"
|
||||
"private/manuals.rkt")
|
||||
|
||||
@main-page['start #t
|
||||
;; "racket.css" needs to be installed so it can be shared:
|
||||
#:force-racket-css? #t]
|
||||
@main-page['start #t #:show-root-info? #t]
|
||||
|
||||
@(define path-info-style (style "RootPathInfo" (list (attributes '((id . "rootPathInfo"))))))
|
||||
@(define go-style (style "RootPathAction" (list (attributes '((onclick . "return GoToRootPath();"))))))
|
||||
@(define disable-style (style "RootPathAction" (list (attributes '((onclick . "return DisableRootPath();"))))))
|
||||
|
||||
@not-on-the-web{
|
||||
@margin-note*{
|
||||
This is an installation-specific listing. Running @exec{raco docs}
|
||||
(or @exec{Racket Documentation} on Windows or Mac OS X)
|
||||
may open a different page with local and user-specific
|
||||
documentation, including documentation for installed packages.}}
|
||||
documentation, including documentation for installed packages.
|
||||
|
||||
@elem[#:style path-info-style]{Searching or following a
|
||||
``top'' link will use go to a different starting point that
|
||||
includes user-specific information.
|
||||
@hyperlink["#"]{@elem[#:style go-style]{[Go to user-specific start]}}
|
||||
@hyperlink["#"]{@elem[#:style disable-style]{[Forget user-specific start]}}}}}
|
||||
|
||||
@(make-start-page #f)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user