a start on getting text rendering running automatically via 'raco setup'
This commit is contained in:
parent
2d8f41bfb9
commit
6b5cd10670
|
@ -67,7 +67,7 @@
|
|||
worker-count ; number of cores to use to create documentation
|
||||
program-name ; name of program that calls setup-scribblings
|
||||
only-dirs ; limits doc builds
|
||||
latex-dest ; if not #f, generate Latex output
|
||||
latex-dest ; #f => html, 'text => text, otherwise Latex output
|
||||
auto-start-doc? ; if #t, expands `only-dir' with [user-]start to
|
||||
; catch new docs
|
||||
make-user? ; are we making user stuff?
|
||||
|
@ -383,17 +383,8 @@
|
|||
(for ([i infos] #:when (info-need-in-write? i)) (write-in/info latex-dest i))))
|
||||
|
||||
(define (make-renderer latex-dest doc)
|
||||
(if latex-dest
|
||||
(new (latex:render-mixin render%)
|
||||
[dest-dir latex-dest]
|
||||
;; Use PLT manual style:
|
||||
[prefix-file (collection-file-path "manual-prefix.tex" "scribble")]
|
||||
[style-file (collection-file-path "manual-style.tex" "scribble")]
|
||||
;; All .tex files go to the same directory, so prefix
|
||||
;; generated/copied file names to keep them separate:
|
||||
[helper-file-prefix (let-values ([(base name dir?) (split-path
|
||||
(doc-dest-dir doc))])
|
||||
(path-element->string name))])
|
||||
(cond
|
||||
[(not latex-dest)
|
||||
(let* ([flags (doc-flags doc)]
|
||||
[multi? (memq 'multi-page flags)]
|
||||
[main? (doc-under-main? doc)]
|
||||
|
@ -421,17 +412,35 @@
|
|||
(if main?
|
||||
#t
|
||||
(build-path (find-user-doc-dir) "index.html")))]
|
||||
[search-box? #t]))))
|
||||
[search-box? #t]))]
|
||||
[(eq? latex-dest 'text) 'not-a-renderer]
|
||||
[(path? latex-dest)
|
||||
(new (latex:render-mixin render%)
|
||||
[dest-dir latex-dest]
|
||||
;; Use PLT manual style:
|
||||
[prefix-file (collection-file-path "manual-prefix.tex" "scribble")]
|
||||
[style-file (collection-file-path "manual-style.tex" "scribble")]
|
||||
;; All .tex files go to the same directory, so prefix
|
||||
;; generated/copied file names to keep them separate:
|
||||
[helper-file-prefix (let-values ([(base name dir?) (split-path
|
||||
(doc-dest-dir doc))])
|
||||
(path-element->string name))])]))
|
||||
|
||||
(define (pick-dest latex-dest doc)
|
||||
(cond [latex-dest
|
||||
(cond [(eq? latex-dest 'text) (build-path (doc-dest-dir doc) "doc.txt")]
|
||||
[latex-dest
|
||||
(let-values ([(base name dir?) (split-path (doc-src-file doc))])
|
||||
(build-path latex-dest (path-replace-suffix name #".tex")))]
|
||||
[else
|
||||
(cond
|
||||
[(memq 'multi-page (doc-flags doc)) (doc-dest-dir doc)]
|
||||
[else (build-path (doc-dest-dir doc) "index.html")]))
|
||||
[else (build-path (doc-dest-dir doc) "index.html")])]))
|
||||
|
||||
(define (sxref-path latex-dest doc file)
|
||||
(cond [latex-dest
|
||||
(cond [(eq? latex-dest 'text)
|
||||
;; can this be the same as the last case?
|
||||
(build-path (doc-dest-dir doc) "txt" file)]
|
||||
[latex-dest
|
||||
(let-values ([(base name dir?) (split-path (doc-src-file doc))])
|
||||
(build-path latex-dest (path-replace-suffix name (string-append "." file))))]
|
||||
[else (build-path (doc-dest-dir doc) file)]))
|
||||
|
@ -510,7 +519,7 @@
|
|||
(let* ([info-out-file (sxref-path latex-dest doc "out.sxref")]
|
||||
[info-in-file (sxref-path latex-dest doc "in.sxref")]
|
||||
[stamp-file (sxref-path latex-dest doc "stamp.sxref")]
|
||||
[out-file (build-path (doc-dest-dir doc) "index.html")]
|
||||
[out-file (build-path (doc-dest-dir doc) "index.html")] ;; this is suspicious: what if we are building .pdfs?
|
||||
[src-zo (let-values ([(base name dir?) (split-path (doc-src-file doc))])
|
||||
(build-path base "compiled" (path-add-suffix name ".zo")))]
|
||||
[renderer (make-renderer latex-dest doc)]
|
||||
|
@ -526,9 +535,10 @@
|
|||
[renderer-path (build-path (collection-path "scribble")
|
||||
"compiled"
|
||||
(path-add-suffix
|
||||
(if latex-dest
|
||||
"latex-render.rkt"
|
||||
"html-render.rkt")
|
||||
(cond
|
||||
[(eq? latex-dest 'text) "text-render.rkt"]
|
||||
[latex-dest "latex-render.rkt"]
|
||||
[else "html-render.rkt"])
|
||||
".zo"))]
|
||||
[css-path (collection-file-path "scribble.css" "scribble")]
|
||||
[aux-time (max (file-or-directory-modify-seconds/stamp
|
||||
|
@ -559,6 +569,7 @@
|
|||
;; it runs some documents without rendering them:
|
||||
(info-time . >= . src-time)))]
|
||||
[can-run? (and (or (not latex-dest)
|
||||
(eq? latex-dest 'text)
|
||||
(not (omit? (doc-category doc))))
|
||||
(or can-run?
|
||||
(and auto-main?
|
||||
|
@ -727,7 +738,8 @@
|
|||
|
||||
(define (build-again! latex-dest info with-record-error)
|
||||
(define (cleanup-dest-dir doc)
|
||||
(unless latex-dest
|
||||
(when (or (not latex-dest)
|
||||
(eq? latex-dest 'text))
|
||||
(let ([dir (doc-dest-dir doc)])
|
||||
(if (not (directory-exists? dir))
|
||||
(make-directory*/ignore-exists-exn dir)
|
||||
|
|
|
@ -991,8 +991,11 @@
|
|||
(with-handlers ([exn:fail?
|
||||
(lambda (exn)
|
||||
(setup-printf #f "docs failure: ~a" (exn->string exn)))])
|
||||
(doc:setup-scribblings #f (and (not (null? (archives)))
|
||||
(archive-implies-reindex)))))
|
||||
(define auto-start-doc?
|
||||
(and (not (null? (archives)))
|
||||
(archive-implies-reindex)))
|
||||
(doc:setup-scribblings #f auto-start-doc?)
|
||||
(doc:setup-scribblings 'text auto-start-doc?)))
|
||||
|
||||
(define (doc-pdf-dest-step)
|
||||
(setup-printf #f "--- building PDF documentation (via pdflatex) ---")
|
||||
|
|
Loading…
Reference in New Issue
Block a user