make site: add support for rendering PDF documentation

original commit: f90b678a7134b95448569449fa467d7f6c0b3636
This commit is contained in:
Matthew Flatt 2013-07-17 10:25:51 -06:00
parent 2fb77f46e9
commit d7f8b9b546
6 changed files with 36 additions and 6 deletions

View File

@ -15,6 +15,7 @@
(define pkgs-dir (build-path "pkgs"))
(define catalog-dir (build-path "catalog"))
(define doc-dir (build-path "doc"))
(define pdf-doc-dir (build-path "pdf-doc"))
(define log-dir (build-path "log"))
(define-values (config-file config-mode)
@ -100,6 +101,9 @@
(define doc-path (build-path docs-dir doc-dir))
(when (directory-exists? doc-path)
(copy doc-dir docs-dir))
(define pdf-doc-path (build-path build-dir pdf-doc-dir))
(when (directory-exists? pdf-doc-path)
(copy pdf-doc-dir))
(make-download-page (build-path build-dir
installers-dir
@ -107,6 +111,8 @@
#:installers-url "installers/"
#:docs-url (and (directory-exists? doc-path)
"doc/index.html")
#:pdf-docs-url (and (directory-exists? doc-path)
"pdf-doc/")
#:dest (build-path dest-dir
"index.html")
#:git-clone (current-directory))

View File

@ -137,6 +137,7 @@
[(#:clean?) (boolean? val)]
[(#:pull?) (boolean? val)]
[(#:site-dest) (path-string? val)]
[(#:pdf-doc?) (boolean? val)]
[(#:max-snapshots) (real? val)]
[else 'bad-keyword]))

View File

@ -65,7 +65,7 @@ installer) as recorded in the "table.rktd" file.
To use the `site' makefile target, the configuration file must at
least provide a `#:dist-base-url' value, which is a URL at which the
site will be made available. To use the `snapshot-sire' makefile
site will be made available. To use the `snapshot-site' makefile
target, then `#:site-dest' will need to be specified, normally as a
path that ends with the value produced by `(current-stamp)'.
@ -198,6 +198,9 @@ Site-configuration keywords (where <string*> means no spaces, etc.):
by the `site' and `snapshot-site' makefile targets; the default is
"build/site"
#:pdf-doc? <boolean> --- whether to build PDF documentation when
assembling a site; the default is #f
#:max-snapshots <number> --- number of snapshots to keep, used by
the `snapshot-site' makefile target

View File

@ -38,6 +38,7 @@
#:dest [dest "index.html"]
#:installers-url [installers-url "./"]
#:docs-url [docs-url #f]
#:pdf-docs-url [pdf-docs-url #f]
#:title [title "Racket Downloads"]
#:git-clone [git-clone #f]
#:post-content [post-content null])
@ -95,7 +96,13 @@
inst)
sha1)))))))
,@(if docs-url
`((p (a ((href ,docs-url)) "Documentation")))
`((p (a ((href ,docs-url)) "Documentation")
,@(if pdf-docs-url
`(nbsp
nbsp
(span ([class "detail"])
(a ((href ,pdf-docs-url)) "[also available as PDF]")))
null)))
null)
,@(if git-clone
(let ([git (find-executable-path "git")])

View File

@ -4,7 +4,8 @@
racket/string
racket/system
compiler/find-exe
(only-in "config.rkt" extract-options))
(only-in "config.rkt" extract-options)
"display-time.rkt")
(define-values (dir config-file config-mode default-pkgs catalogs)
(command-line
@ -12,10 +13,10 @@
(dir config-file config-mode default-pkgs . catalog)
(values dir config-file config-mode default-pkgs catalog)))
(define config (extract-options config-file config-mode))
(define pkgs
(or (hash-ref (extract-options config-file config-mode)
'#:pkgs
#f)
(or (hash-ref config '#:pkgs #f)
(string-split default-pkgs)))
(define (build-path/s . a)
@ -43,6 +44,7 @@
(write ht o)
(newline o)))
(display-time)
(printf "Running `raco pkg install' for packages:\n")
(for ([pkg (in-list pkgs)])
(printf " ~a\n" pkg))
@ -53,3 +55,12 @@
pkgs)
(error "install failed"))
(when (hash-ref config '#:pdf-doc? #f)
(display-time)
(printf "Running `raco setup' PDF documentation:\n")
(unless (system* (find-exe)
"-G" "build/docs/etc" "-l-"
"raco" "setup" "--doc-pdf" "build/pdf-doc")
(error "PDF failed")))
(display-time)

View File

@ -57,6 +57,8 @@
#:installers-url "current/installers/"
#:docs-url (and (directory-exists? (build-path site-dir "doc"))
"current/doc/index.html")
#:pdf-docs-url (and (directory-exists? (build-path site-dir "pdf-doc"))
"current/pdf-doc/")
#:dest (build-path snapshots-dir
"index.html")
#:git-clone (current-directory)