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:
|
Sources:
|
||||||
========
|
========
|
||||||
|
|
||||||
* common: specific code for the racket web pages.
|
|
||||||
|
|
||||||
* www: actual content of main site.
|
* www: actual content of main site.
|
||||||
|
|
||||||
* download: content of download site (only installer pages and such)
|
* download: content of download site (only installer pages and such)
|
||||||
|
@ -21,28 +19,21 @@ Sources:
|
||||||
To build:
|
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.)
|
(Use `-h' as usual.)
|
||||||
|
|
||||||
* You can choose `-w' (the default) or `-l' for a web or local mode,
|
* You can choose `-w' (the default) for web mode, `-l' for local using
|
||||||
respectively. The difference is that in local mode inter-site links
|
"file://" references, or `-r` for' local mode using relative
|
||||||
are set up as relative links so you can see all sites from the
|
refernces. Normally, you'll want to use `-l' for testing, and then
|
||||||
resulting directories, and this is what you usually need to test
|
use `-w' for deployment.
|
||||||
things out. (You will still need to deal with an occasional
|
|
||||||
addition of "index.html" which is not done when looking at file://
|
|
||||||
URLs.)
|
|
||||||
|
|
||||||
* Use `-o <dir>' to specify a directory where the built contents is
|
* Use `-o <dir>' to specify a directory where the built contents is
|
||||||
placed, otherwise the content will be placed in the current directory.
|
placed, otherwise the content will be placed in the current
|
||||||
(Use `-f' in scripts to avoid answering the question about deleting
|
directory. As a safety measure, the target directory must not
|
||||||
existing files.)
|
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
|
* Set the $GIT_DIR environment variable to point to the ".git"
|
||||||
a $GIT_DIR environment variable otherwise the resulting build will not
|
directory of a Racket repository, otherwise the resulting build will
|
||||||
have release information for the various builds. (This doesn't matter
|
not have release information for the various builds. (This doesn't
|
||||||
if you're not working on download pages.)
|
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.
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#lang racket/base
|
#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)
|
(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
|
#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")
|
(define planet-bugs "http://planet.racket-lang.org/trac/newticket")
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#lang plt-web
|
#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
|
;; 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
|
;; to Can Burak Cilingir for both the logo and the drracket.org domain
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
(provide mailing-lists-quick)
|
(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))
|
(struct ML (name gmane-name google-name description))
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
(require (only-in "../www/resources.rkt" www-site)
|
(require (only-in "../www/resources.rkt" www-site)
|
||||||
racket/port)
|
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))
|
#:share-from www-site))
|
||||||
|
|
||||||
(define racket-css
|
(define racket-css
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
(require (only-in "../download/resources.rkt" download-site))
|
(require (only-in "../download/resources.rkt" download-site))
|
||||||
|
|
||||||
(define dirlist-site (site "stubs/dirlist"
|
(define dirlist-site (site "stubs/dirlist"
|
||||||
|
#:url "http://download.racket-lang.org/"
|
||||||
|
#:always-abs-url? #t
|
||||||
#:share-from download-site))
|
#:share-from download-site))
|
||||||
|
|
||||||
(define header+footer
|
(define header+footer
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
(require (only-in "../www/resources.rkt" www-site))
|
(require (only-in "../www/resources.rkt" www-site))
|
||||||
|
|
||||||
(define docs-site (site "stubs/docs"
|
(define docs-site (site "stubs/docs"
|
||||||
|
#:url "http://docs.racket-lang.org/"
|
||||||
|
#:always-abs-url? #t
|
||||||
#:page-style? #f
|
#:page-style? #f
|
||||||
#:meta? #t
|
#:meta? #t
|
||||||
#:share-from www-site))
|
#:share-from www-site))
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
(define git-site
|
(define git-site
|
||||||
(site "stubs/git"
|
(site "stubs/git"
|
||||||
|
#:url "http://git.racket-lang.org/"
|
||||||
|
#:always-abs-url? #t
|
||||||
#:robots (add-newlines (for/list ([d '(plt libs testing play)])
|
#:robots (add-newlines (for/list ([d '(plt libs testing play)])
|
||||||
@list{Disallow: /@|d|/}))))
|
@list{Disallow: /@|d|/}))))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#lang plt-web
|
#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|>})
|
||||||
(define (MM/ . tag) @literal{</MM-@|tag|>})
|
(define (MM/ . tag) @literal{</MM-@|tag|>})
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
(require (only-in "../www/resources.rkt" www-site))
|
(require (only-in "../www/resources.rkt" www-site))
|
||||||
|
|
||||||
(define pkgs-site (site "stubs/pkgs"
|
(define pkgs-site (site "stubs/pkgs"
|
||||||
|
#:url "http://pkgs.racket-lang.org/"
|
||||||
|
#:always-abs-url? #t
|
||||||
#:page-style? #f
|
#:page-style? #f
|
||||||
#:share-from www-site))
|
#:share-from www-site))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#lang plt-web
|
#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)
|
(provide planet)
|
||||||
(define planet
|
(define planet
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
(require "git.rkt")
|
(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
|
(define temporary-outdated-warning
|
||||||
@div[style: "border: 1px dotted red; padding: 0ex 1ex"]{
|
@div[style: "border: 1px dotted red; padding: 0ex 1ex"]{
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
(require (only-in "../www/resources.rkt" www-site))
|
(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
|
(define template
|
||||||
(page #:site wiki-site
|
(page #:site wiki-site
|
||||||
|
|
|
@ -2,11 +2,25 @@
|
||||||
|
|
||||||
(require "resources.rkt"
|
(require "resources.rkt"
|
||||||
(prefix-in download: "../download/index.rkt")
|
(prefix-in download: "../download/index.rkt")
|
||||||
|
"../download/download-pages.rkt"
|
||||||
racket/runtime-path)
|
racket/runtime-path)
|
||||||
|
|
||||||
(provide download)
|
(provide download)
|
||||||
(define download download:index)
|
(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-runtime-path img-dir "img")
|
||||||
(define images (list (copyfile #:site www-site (build-path img-dir "download.png"))
|
(define images (list (copyfile #:site www-site (build-path img-dir "download.png"))
|
||||||
(copyfile #:site www-site (build-path img-dir "download-dark.png"))))
|
(copyfile #:site www-site (build-path img-dir "download-dark.png"))))
|
||||||
|
@ -40,3 +54,4 @@
|
||||||
onmouseout: "set_download_image(0);"]{
|
onmouseout: "set_download_image(0);"]{
|
||||||
@img[id: "download_button" src: (car images) style: "border-width: 0;"
|
@img[id: "download_button" src: (car images) style: "border-width: 0;"
|
||||||
alt: "Download Racket" title: "Download Racket"]}})
|
alt: "Download Racket" title: "Download Racket"]}})
|
||||||
|
|#
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
(define www-site
|
(define www-site
|
||||||
(site "www"
|
(site "www"
|
||||||
|
#:url "http://racket-lang.org/"
|
||||||
#:navigation
|
#:navigation
|
||||||
(list
|
(list
|
||||||
@a[href: (resource "stubs/pkgs" #f)]{Packages}
|
@a[href: (resource "stubs/pkgs/" #f)]{Packages}
|
||||||
@a[href: (resource "stubs/docs" #f)]{Documentation}
|
@a[href: (resource "stubs/docs/" #f)]{Documentation}
|
||||||
@a[href: (resource "stubs/blog" #f)]{Blog}
|
@a[href: (resource "stubs/blog/" #f)]{Blog}
|
||||||
@navigation-button[@(a href: (resource "download/" #f) "Download")])))
|
@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?]
|
@defproc[(site [dir path-string?]
|
||||||
[#:url url (or/c string? #f) #f]
|
[#: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]
|
[#:share-from share-from (or/c site? #f) #f]
|
||||||
[#:page-style? page-style? any/c #t]
|
[#:page-style? page-style? any/c #t]
|
||||||
[#:meta? meta? any/c page-style?]
|
[#: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
|
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
|
@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
|
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
|
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
|
across top-level sites use absolute URLs. This mode is the
|
||||||
default.}
|
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
|
all references use relative paths, exploiting the fact that
|
||||||
sites are rendered in adjacent directories within the output
|
sites are rendered in adjacent directories within the output
|
||||||
directory. (You may need to deal with an occasional manual
|
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
|
Writes output to subdirectories of @nonterm{dir}, which
|
||||||
defaults to the current directory. All existing files and
|
defaults to the current directory. All existing files and
|
||||||
directories within @nonterm{dir} will be deleted. As a safety
|
directories within @nonterm{dir} will be deleted. As a safety
|
||||||
check, the destination directory must not be within an
|
check, the destination directory must overlap with any
|
||||||
installed package.}
|
installed package directory.}
|
||||||
|
|
||||||
@item{@Flag{f} or @DFlag{force} --- Overwrite files in the destination
|
@item{@Flag{f} or @DFlag{force} --- Overwrite files in the destination
|
||||||
directory.}
|
directory.}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require racket/cmdline racket/runtime-path racket/file scribble/html
|
(require racket/cmdline racket/runtime-path racket/file scribble/html
|
||||||
pkg/path
|
pkg/path net/url
|
||||||
"config.rkt"
|
|
||||||
"private/roots.rkt")
|
"private/roots.rkt")
|
||||||
|
|
||||||
(define build-mode 'web)
|
(define build-mode 'web)
|
||||||
|
@ -12,13 +11,15 @@
|
||||||
|
|
||||||
(command-line
|
(command-line
|
||||||
#:once-any
|
#: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")
|
[("-w" "--web")
|
||||||
"web mode: create content that is viewable via HTTP"
|
"web mode: create content that is viewable via HTTP"
|
||||||
(set! build-mode 'web)]
|
(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
|
#:once-each
|
||||||
[("-o" "--output") dir
|
[("-o" "--output") dir
|
||||||
"output directory"
|
"output directory"
|
||||||
|
@ -34,8 +35,6 @@
|
||||||
"extra file to render more content"
|
"extra file to render more content"
|
||||||
(set! extra-files (cons extra extra-files))])
|
(set! extra-files (cons extra extra-files))])
|
||||||
|
|
||||||
(unless build-mode (raise-user-error 'build "build mode not specified"))
|
|
||||||
|
|
||||||
(let ([cache (make-hash)])
|
(let ([cache (make-hash)])
|
||||||
(define (check-dest p)
|
(define (check-dest p)
|
||||||
(when (path->pkg p #:cache cache)
|
(when (path->pkg p #:cache cache)
|
||||||
|
@ -59,10 +58,15 @@
|
||||||
(raise-user-error 'build "Aborting."))))
|
(raise-user-error 'build "Aborting."))))
|
||||||
|
|
||||||
(printf "Building ~a content...\n" build-mode)
|
(printf "Building ~a content...\n" build-mode)
|
||||||
(parameterize ([url-roots (if (eq? 'web build-mode)
|
(parameterize ([url-roots (case build-mode
|
||||||
(append (extra-roots)
|
[(web) (registered-url-roots)]
|
||||||
sites)
|
[(local) (map (lambda (s)
|
||||||
(url-roots))])
|
(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)])
|
(for ([extra (in-list extra-files)])
|
||||||
(if (file-exists? extra)
|
(if (file-exists? extra)
|
||||||
(dynamic-require `(file ,extra) #f)
|
(dynamic-require `(file ,extra) #f)
|
||||||
|
|
|
@ -276,6 +276,7 @@
|
||||||
(let ([site
|
(let ([site
|
||||||
(lambda (dir
|
(lambda (dir
|
||||||
#:url [url #f]
|
#:url [url #f]
|
||||||
|
#:always-abs-url? [abs-url? #f]
|
||||||
#:robots [robots #t]
|
#:robots [robots #t]
|
||||||
#:htaccess [htaccess #t]
|
#:htaccess [htaccess #t]
|
||||||
#:navigation [navigation null]
|
#:navigation [navigation null]
|
||||||
|
@ -283,8 +284,10 @@
|
||||||
#:meta? [meta? page-style?]
|
#:meta? [meta? page-style?]
|
||||||
#:share-from [given-sharing-site #f])
|
#:share-from [given-sharing-site #f])
|
||||||
(when url
|
(when url
|
||||||
(extra-roots (cons (list dir url)
|
(registered-url-roots (cons (list* dir
|
||||||
(extra-roots))))
|
url
|
||||||
|
(if abs-url? '(abs) null))
|
||||||
|
(registered-url-roots))))
|
||||||
(define sharing-site
|
(define sharing-site
|
||||||
;; Can use given site only if it has enough relative to
|
;; Can use given site only if it has enough relative to
|
||||||
;; this one:
|
;; this one:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(provide extra-roots)
|
(provide registered-url-roots)
|
||||||
(define extra-roots (make-parameter null))
|
(define registered-url-roots (make-parameter null))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user