make site: add support for rendering PDF documentation
This commit is contained in:
parent
bf19a20de0
commit
f90b678a71
|
@ -15,6 +15,7 @@
|
||||||
(define pkgs-dir (build-path "pkgs"))
|
(define pkgs-dir (build-path "pkgs"))
|
||||||
(define catalog-dir (build-path "catalog"))
|
(define catalog-dir (build-path "catalog"))
|
||||||
(define doc-dir (build-path "doc"))
|
(define doc-dir (build-path "doc"))
|
||||||
|
(define pdf-doc-dir (build-path "pdf-doc"))
|
||||||
(define log-dir (build-path "log"))
|
(define log-dir (build-path "log"))
|
||||||
|
|
||||||
(define-values (config-file config-mode)
|
(define-values (config-file config-mode)
|
||||||
|
@ -100,6 +101,9 @@
|
||||||
(define doc-path (build-path docs-dir doc-dir))
|
(define doc-path (build-path docs-dir doc-dir))
|
||||||
(when (directory-exists? doc-path)
|
(when (directory-exists? doc-path)
|
||||||
(copy doc-dir docs-dir))
|
(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
|
(make-download-page (build-path build-dir
|
||||||
installers-dir
|
installers-dir
|
||||||
|
@ -107,6 +111,8 @@
|
||||||
#:installers-url "installers/"
|
#:installers-url "installers/"
|
||||||
#:docs-url (and (directory-exists? doc-path)
|
#:docs-url (and (directory-exists? doc-path)
|
||||||
"doc/index.html")
|
"doc/index.html")
|
||||||
|
#:pdf-docs-url (and (directory-exists? doc-path)
|
||||||
|
"pdf-doc/")
|
||||||
#:dest (build-path dest-dir
|
#:dest (build-path dest-dir
|
||||||
"index.html")
|
"index.html")
|
||||||
#:git-clone (current-directory))
|
#:git-clone (current-directory))
|
||||||
|
|
|
@ -137,6 +137,7 @@
|
||||||
[(#:clean?) (boolean? val)]
|
[(#:clean?) (boolean? val)]
|
||||||
[(#:pull?) (boolean? val)]
|
[(#:pull?) (boolean? val)]
|
||||||
[(#:site-dest) (path-string? val)]
|
[(#:site-dest) (path-string? val)]
|
||||||
|
[(#:pdf-doc?) (boolean? val)]
|
||||||
[(#:max-snapshots) (real? val)]
|
[(#:max-snapshots) (real? val)]
|
||||||
[else 'bad-keyword]))
|
[else 'bad-keyword]))
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ installer) as recorded in the "table.rktd" file.
|
||||||
|
|
||||||
To use the `site' makefile target, the configuration file must at
|
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
|
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
|
target, then `#:site-dest' will need to be specified, normally as a
|
||||||
path that ends with the value produced by `(current-stamp)'.
|
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
|
by the `site' and `snapshot-site' makefile targets; the default is
|
||||||
"build/site"
|
"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
|
#:max-snapshots <number> --- number of snapshots to keep, used by
|
||||||
the `snapshot-site' makefile target
|
the `snapshot-site' makefile target
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#:dest [dest "index.html"]
|
#:dest [dest "index.html"]
|
||||||
#:installers-url [installers-url "./"]
|
#:installers-url [installers-url "./"]
|
||||||
#:docs-url [docs-url #f]
|
#:docs-url [docs-url #f]
|
||||||
|
#:pdf-docs-url [pdf-docs-url #f]
|
||||||
#:title [title "Racket Downloads"]
|
#:title [title "Racket Downloads"]
|
||||||
#:git-clone [git-clone #f]
|
#:git-clone [git-clone #f]
|
||||||
#:post-content [post-content null])
|
#:post-content [post-content null])
|
||||||
|
@ -95,7 +96,13 @@
|
||||||
inst)
|
inst)
|
||||||
sha1)))))))
|
sha1)))))))
|
||||||
,@(if docs-url
|
,@(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)
|
null)
|
||||||
,@(if git-clone
|
,@(if git-clone
|
||||||
(let ([git (find-executable-path "git")])
|
(let ([git (find-executable-path "git")])
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
racket/string
|
racket/string
|
||||||
racket/system
|
racket/system
|
||||||
compiler/find-exe
|
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)
|
(define-values (dir config-file config-mode default-pkgs catalogs)
|
||||||
(command-line
|
(command-line
|
||||||
|
@ -12,10 +13,10 @@
|
||||||
(dir config-file config-mode default-pkgs . catalog)
|
(dir config-file config-mode default-pkgs . catalog)
|
||||||
(values 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
|
(define pkgs
|
||||||
(or (hash-ref (extract-options config-file config-mode)
|
(or (hash-ref config '#:pkgs #f)
|
||||||
'#:pkgs
|
|
||||||
#f)
|
|
||||||
(string-split default-pkgs)))
|
(string-split default-pkgs)))
|
||||||
|
|
||||||
(define (build-path/s . a)
|
(define (build-path/s . a)
|
||||||
|
@ -43,6 +44,7 @@
|
||||||
(write ht o)
|
(write ht o)
|
||||||
(newline o)))
|
(newline o)))
|
||||||
|
|
||||||
|
(display-time)
|
||||||
(printf "Running `raco pkg install' for packages:\n")
|
(printf "Running `raco pkg install' for packages:\n")
|
||||||
(for ([pkg (in-list pkgs)])
|
(for ([pkg (in-list pkgs)])
|
||||||
(printf " ~a\n" pkg))
|
(printf " ~a\n" pkg))
|
||||||
|
@ -53,3 +55,12 @@
|
||||||
pkgs)
|
pkgs)
|
||||||
(error "install failed"))
|
(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)
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
#:installers-url "current/installers/"
|
#:installers-url "current/installers/"
|
||||||
#:docs-url (and (directory-exists? (build-path site-dir "doc"))
|
#:docs-url (and (directory-exists? (build-path site-dir "doc"))
|
||||||
"current/doc/index.html")
|
"current/doc/index.html")
|
||||||
|
#:pdf-docs-url (and (directory-exists? (build-path site-dir "pdf-doc"))
|
||||||
|
"current/pdf-doc/")
|
||||||
#:dest (build-path snapshots-dir
|
#:dest (build-path snapshots-dir
|
||||||
"index.html")
|
"index.html")
|
||||||
#:git-clone (current-directory)
|
#:git-clone (current-directory)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user