move main URLs to site
definitions instead of built-in configuration
Also, change local mode to use absolute "file://" references across sites (makes "doc-site.js" plus "doc-site.css" work locally) and add "index.html" to paths a needed, but add a `-r` relative mode for the old behavior.
This commit is contained in:
parent
cec98c7cea
commit
aed4f6a063
|
@ -1,8 +1,6 @@
|
|||
Sources:
|
||||
========
|
||||
|
||||
* common: specific code for the racket web pages.
|
||||
|
||||
* www: actual content of main site.
|
||||
|
||||
* download: content of download site (only installer pages and such)
|
||||
|
@ -21,28 +19,21 @@ Sources:
|
|||
To build:
|
||||
=========
|
||||
|
||||
* Run any `index.rkt' to build a page and things that it references.
|
||||
* Run any "*.rkt" to build a page and things that it references.
|
||||
(Use `-h' as usual.)
|
||||
|
||||
* You can choose `-w' (the default) or `-l' for a web or local mode,
|
||||
respectively. The difference is that in local mode inter-site links
|
||||
are set up as relative links so you can see all sites from the
|
||||
resulting directories, and this is what you usually need to test
|
||||
things out. (You will still need to deal with an occasional
|
||||
addition of "index.html" which is not done when looking at file://
|
||||
URLs.)
|
||||
* You can choose `-w' (the default) for web mode, `-l' for local using
|
||||
"file://" references, or `-r` for' local mode using relative
|
||||
refernces. Normally, you'll want to use `-l' for testing, and then
|
||||
use `-w' for deployment.
|
||||
|
||||
* Use `-o <dir>' to specify a directory where the built contents is
|
||||
placed, otherwise the content will be placed in the current directory.
|
||||
(Use `-f' in scripts to avoid answering the question about deleting
|
||||
existing files.)
|
||||
placed, otherwise the content will be placed in the current
|
||||
directory. As a safety measure, the target directory must not
|
||||
overlap with any installed directory. (Use `-f' in scripts to avoid
|
||||
answering the question about deleting existing files.)
|
||||
|
||||
* If you're not running from a git repository, you will also need to set
|
||||
a $GIT_DIR environment variable otherwise the resulting build will not
|
||||
have release information for the various builds. (This doesn't matter
|
||||
if you're not working on download pages.)
|
||||
|
||||
* You can also include more files that hook additional contents with
|
||||
with `-e <some-file>'. These files are required dynamically, and they
|
||||
set things up to add more content building. The common example here
|
||||
is "web/all.rkt" in iplt.
|
||||
* Set the $GIT_DIR environment variable to point to the ".git"
|
||||
directory of a Racket repository, otherwise the resulting build will
|
||||
not have release information for the various builds. (This doesn't
|
||||
matter if you're not working on download pages.)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#lang racket/base
|
||||
|
||||
(require "index.rkt" "version.rkt" "old-index.rkt")
|
||||
(require "index.rkt" "version.rkt")
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#lang plt-web
|
||||
|
||||
(require "resources.rkt" "symlinks.rkt")
|
||||
|
||||
(provide old-index)
|
||||
(define old-index
|
||||
@page[#:site download-site
|
||||
#:link-title "Downloads" #:part-of 'download
|
||||
#:file "old-index.html"
|
||||
#:description
|
||||
@'{Download Racket, a modern dialect of Lisp/Scheme. @;
|
||||
Available for Windows, Mac, Linux, and other Unix platforms. @;
|
||||
Includes the DrRacket IDE.}]{
|
||||
@div[style: "float: right;"]{Download}
|
||||
Use these links to browse the download directories directly:
|
||||
@ul{@li{Current @a[href: `(,installers "/recent")]{installers}
|
||||
(or @a[href: installers]{all versions}).}
|
||||
@li{Current documentation in
|
||||
@a[href: `(,docs "/recent/html")]{HTML} and in
|
||||
@a[href: `(,docs "/recent/pdf")]{PDF}
|
||||
(or @a[href: docs]{all versions}).}
|
||||
@li{Binary @a[href: libs]{libraries} mainly for GRacket
|
||||
(installed during the build process).}}})
|
|
@ -2,4 +2,5 @@
|
|||
|
||||
(provide download-site)
|
||||
|
||||
(define download-site (site "download"))
|
||||
(define download-site (site "download"
|
||||
#:url "http://download.racket-lang.org/"))
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#lang plt-web
|
||||
|
||||
(define bugs-site (site "bugs"))
|
||||
(define bugs-site (site "bugs"
|
||||
#:url "http://bugs.racket-lang.org/"))
|
||||
|
||||
(define planet-bugs "http://planet.racket-lang.org/trac/newticket")
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#lang plt-web
|
||||
|
||||
(define drracket-site (site "drracket"))
|
||||
(define drracket-site (site "drracket"
|
||||
#:url "http://drracket.org/"))
|
||||
|
||||
;; This just shows an ascii logo and redirects to the main page. Thanks
|
||||
;; to Can Burak Cilingir for both the logo and the drracket.org domain
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
(provide mailing-lists-quick)
|
||||
|
||||
(define lists-site (site "lists"))
|
||||
(define lists-site (site "lists"
|
||||
#:url "http://lists.racket-lang.org/"))
|
||||
|
||||
(struct ML (name gmane-name google-name description))
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
(require (only-in "../www/resources.rkt" www-site)
|
||||
racket/port)
|
||||
|
||||
(define blog-site (site "stubs/blog"
|
||||
(define blog-site (site "stubs/blog"
|
||||
#:url "http://blog.racket-lang.org/"
|
||||
#:always-abs-url? #t
|
||||
#:share-from www-site))
|
||||
|
||||
(define racket-css
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
(require (only-in "../download/resources.rkt" download-site))
|
||||
|
||||
(define dirlist-site (site "stubs/dirlist"
|
||||
#:url "http://download.racket-lang.org/"
|
||||
#:always-abs-url? #t
|
||||
#:share-from download-site))
|
||||
|
||||
(define header+footer
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
(require (only-in "../www/resources.rkt" www-site))
|
||||
|
||||
(define docs-site (site "stubs/docs"
|
||||
#:url "http://docs.racket-lang.org/"
|
||||
#:always-abs-url? #t
|
||||
#:page-style? #f
|
||||
#:meta? #t
|
||||
#:share-from www-site))
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
(define git-site
|
||||
(site "stubs/git"
|
||||
#:url "http://git.racket-lang.org/"
|
||||
#:always-abs-url? #t
|
||||
#:robots (add-newlines (for/list ([d '(plt libs testing play)])
|
||||
@list{Disallow: /@|d|/}))))
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#lang plt-web
|
||||
|
||||
(define mailman-site (site "stubs/mailman"))
|
||||
(define mailman-site (site "stubs/mailman"
|
||||
#:url "http://lists.racket-lang.org/"
|
||||
#:always-abs-url? #t))
|
||||
|
||||
(define (MM . tag) @literal{<MM-@|tag|>})
|
||||
(define (MM/ . tag) @literal{</MM-@|tag|>})
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
(require (only-in "../www/resources.rkt" www-site))
|
||||
|
||||
(define pkgs-site (site "stubs/pkgs"
|
||||
#:url "http://pkgs.racket-lang.org/"
|
||||
#:always-abs-url? #t
|
||||
#:page-style? #f
|
||||
#:share-from www-site))
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#lang plt-web
|
||||
|
||||
(define planet-site (site "stubs/planet"))
|
||||
(define planet-site (site "stubs/planet"
|
||||
#:url "http://planet.racket-lang.org/"
|
||||
#:always-abs-url? #t))
|
||||
|
||||
(provide planet)
|
||||
(define planet
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
(require "git.rkt")
|
||||
|
||||
(define pre-site (site "stubs/pre"))
|
||||
(define pre-site (site "stubs/pre"
|
||||
#:url "http://pre.racket-lang.org/"
|
||||
#:always-abs-url? #t))
|
||||
|
||||
(define temporary-outdated-warning
|
||||
@div[style: "border: 1px dotted red; padding: 0ex 1ex"]{
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
(require (only-in "../www/resources.rkt" www-site))
|
||||
|
||||
(define wiki-site (site "stubs/wiki" #:share-from www-site))
|
||||
(define wiki-site (site "stubs/wiki"
|
||||
#:url "http://wiki.racket-lang.org/"
|
||||
#:always-abs-url? #t
|
||||
#:share-from www-site))
|
||||
|
||||
(define template
|
||||
(page #:site wiki-site
|
||||
|
|
|
@ -2,11 +2,25 @@
|
|||
|
||||
(require "resources.rkt"
|
||||
(prefix-in download: "../download/index.rkt")
|
||||
"../download/download-pages.rkt"
|
||||
racket/runtime-path)
|
||||
|
||||
(provide download)
|
||||
(define download download:index)
|
||||
|
||||
;; For old references that go to "www/download/", make a copy of
|
||||
;; the main download page:
|
||||
(define www-download-site (site "www/download"
|
||||
#:share-from www-site
|
||||
#:meta? #f))
|
||||
(void
|
||||
@page[#:site www-download-site
|
||||
#:file "index.html"
|
||||
#:title "Download" #:window-title "Download Racket"
|
||||
#:part-of 'download #:width 'full]{
|
||||
@(render-download-page)})
|
||||
|
||||
#|
|
||||
(define-runtime-path img-dir "img")
|
||||
(define images (list (copyfile #:site www-site (build-path img-dir "download.png"))
|
||||
(copyfile #:site www-site (build-path img-dir "download-dark.png"))))
|
||||
|
@ -40,3 +54,4 @@
|
|||
onmouseout: "set_download_image(0);"]{
|
||||
@img[id: "download_button" src: (car images) style: "border-width: 0;"
|
||||
alt: "Download Racket" title: "Download Racket"]}})
|
||||
|#
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
|
||||
(define www-site
|
||||
(site "www"
|
||||
#:url "http://racket-lang.org/"
|
||||
#:navigation
|
||||
(list
|
||||
@a[href: (resource "stubs/pkgs" #f)]{Packages}
|
||||
@a[href: (resource "stubs/docs" #f)]{Documentation}
|
||||
@a[href: (resource "stubs/blog" #f)]{Blog}
|
||||
@a[href: (resource "stubs/pkgs/" #f)]{Packages}
|
||||
@a[href: (resource "stubs/docs/" #f)]{Documentation}
|
||||
@a[href: (resource "stubs/blog/" #f)]{Blog}
|
||||
@navigation-button[@(a href: (resource "download/" #f) "Download")])))
|
||||
|
|
|
@ -35,6 +35,7 @@ relative directory is mapped to a destination URL via
|
|||
|
||||
@defproc[(site [dir path-string?]
|
||||
[#:url url (or/c string? #f) #f]
|
||||
[#:always-abs-url? always-abs-url? any/c #f]
|
||||
[#:share-from share-from (or/c site? #f) #f]
|
||||
[#:page-style? page-style? any/c #t]
|
||||
[#:meta? meta? any/c page-style?]
|
||||
|
@ -45,7 +46,9 @@ relative directory is mapped to a destination URL via
|
|||
|
||||
Creates a value that represents a site. If @racket[url] is not
|
||||
@racket[#f], then it will be registered to @racket[url-roots] for a
|
||||
build in web mode (as opposed to local mode).
|
||||
build in web mode (as opposed to local mode). If
|
||||
@racket[always-abs-url?] is true, the @racket[url] is registered with
|
||||
a @racket['abs] flag.
|
||||
|
||||
If @racket[share-from] is a site, then resources generated for the
|
||||
site (such as icons or CSS files) are used when as possible for the
|
||||
|
@ -209,7 +212,10 @@ that is introduced by @racketmodname[plt-web]:
|
|||
across top-level sites use absolute URLs. This mode is the
|
||||
default.}
|
||||
|
||||
@item{@Flag{l} or @DFlag{local} --- Build output in local mode, where
|
||||
@item{@Flag{l} or @DFlag{local} --- Build output in local mode using
|
||||
@filepath{file://} URLs between top-level sites.}
|
||||
|
||||
@item{@Flag{r} or @DFlag{relative} --- Build output in local mode, where
|
||||
all references use relative paths, exploiting the fact that
|
||||
sites are rendered in adjacent directories within the output
|
||||
directory. (You may need to deal with an occasional manual
|
||||
|
@ -219,8 +225,8 @@ that is introduced by @racketmodname[plt-web]:
|
|||
Writes output to subdirectories of @nonterm{dir}, which
|
||||
defaults to the current directory. All existing files and
|
||||
directories within @nonterm{dir} will be deleted. As a safety
|
||||
check, the destination directory must not be within an
|
||||
installed package.}
|
||||
check, the destination directory must overlap with any
|
||||
installed package directory.}
|
||||
|
||||
@item{@Flag{f} or @DFlag{force} --- Overwrite files in the destination
|
||||
directory.}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
#lang racket/base
|
||||
|
||||
(require racket/cmdline racket/runtime-path racket/file scribble/html
|
||||
pkg/path
|
||||
"config.rkt"
|
||||
pkg/path net/url
|
||||
"private/roots.rkt")
|
||||
|
||||
(define build-mode 'web)
|
||||
|
@ -12,13 +11,15 @@
|
|||
|
||||
(command-line
|
||||
#:once-any
|
||||
[("-l" "--local")
|
||||
"local mode: create content that is viewable in the build directory"
|
||||
" (all links are relative) "
|
||||
(set! build-mode 'local)]
|
||||
[("-w" "--web")
|
||||
"web mode: create content that is viewable via HTTP"
|
||||
(set! build-mode 'web)]
|
||||
[("-l" "--local")
|
||||
"local mode: create content that is viewable in the build directory"
|
||||
(set! build-mode 'local)]
|
||||
[("-r" "--relative")
|
||||
"local mode, but all links are relative"
|
||||
(set! build-mode 'relative)]
|
||||
#:once-each
|
||||
[("-o" "--output") dir
|
||||
"output directory"
|
||||
|
@ -34,8 +35,6 @@
|
|||
"extra file to render more content"
|
||||
(set! extra-files (cons extra extra-files))])
|
||||
|
||||
(unless build-mode (raise-user-error 'build "build mode not specified"))
|
||||
|
||||
(let ([cache (make-hash)])
|
||||
(define (check-dest p)
|
||||
(when (path->pkg p #:cache cache)
|
||||
|
@ -59,10 +58,15 @@
|
|||
(raise-user-error 'build "Aborting."))))
|
||||
|
||||
(printf "Building ~a content...\n" build-mode)
|
||||
(parameterize ([url-roots (if (eq? 'web build-mode)
|
||||
(append (extra-roots)
|
||||
sites)
|
||||
(url-roots))])
|
||||
(parameterize ([url-roots (case build-mode
|
||||
[(web) (registered-url-roots)]
|
||||
[(local) (map (lambda (s)
|
||||
(list* (car s)
|
||||
(url->string (path->url (build-path output-dir (car s))))
|
||||
(cons 'index
|
||||
(cddr s))))
|
||||
(registered-url-roots))]
|
||||
[else (url-roots)])])
|
||||
(for ([extra (in-list extra-files)])
|
||||
(if (file-exists? extra)
|
||||
(dynamic-require `(file ,extra) #f)
|
||||
|
|
|
@ -276,6 +276,7 @@
|
|||
(let ([site
|
||||
(lambda (dir
|
||||
#:url [url #f]
|
||||
#:always-abs-url? [abs-url? #f]
|
||||
#:robots [robots #t]
|
||||
#:htaccess [htaccess #t]
|
||||
#:navigation [navigation null]
|
||||
|
@ -283,8 +284,10 @@
|
|||
#:meta? [meta? page-style?]
|
||||
#:share-from [given-sharing-site #f])
|
||||
(when url
|
||||
(extra-roots (cons (list dir url)
|
||||
(extra-roots))))
|
||||
(registered-url-roots (cons (list* dir
|
||||
url
|
||||
(if abs-url? '(abs) null))
|
||||
(registered-url-roots))))
|
||||
(define sharing-site
|
||||
;; Can use given site only if it has enough relative to
|
||||
;; this one:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide extra-roots)
|
||||
(define extra-roots (make-parameter null))
|
||||
(provide registered-url-roots)
|
||||
(define registered-url-roots (make-parameter null))
|
||||
|
|
Loading…
Reference in New Issue
Block a user