commit d7f8b9b5461da7533b7294ff220998a3397fa46d
parent 2fb77f46e94058cec287d72c29082ccbfd7c71a5
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Wed, 17 Jul 2013 10:25:51 -0600
make site: add support for rendering PDF documentation
original commit: f90b678a7134b95448569449fa467d7f6c0b3636
Diffstat:
6 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/pkgs/distro-build/assemble-site.rkt b/pkgs/distro-build/assemble-site.rkt
@@ -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))
diff --git a/pkgs/distro-build/config.rkt b/pkgs/distro-build/config.rkt
@@ -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]))
diff --git a/pkgs/distro-build/doc.txt b/pkgs/distro-build/doc.txt
@@ -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
diff --git a/pkgs/distro-build/download-page.rkt b/pkgs/distro-build/download-page.rkt
@@ -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")])
diff --git a/pkgs/distro-build/install-for-docs.rkt b/pkgs/distro-build/install-for-docs.rkt
@@ -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)
diff --git a/pkgs/distro-build/manage-snapshots.rkt b/pkgs/distro-build/manage-snapshots.rkt
@@ -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)