change path->main-collects-relative, and change output directory of start document

svn: r8301
This commit is contained in:
Matthew Flatt 2008-01-11 19:54:38 +00:00
parent ce04c9457b
commit 05434ec54d
9 changed files with 621 additions and 646 deletions

View File

@ -90,7 +90,7 @@
(lambda (op) (lambda (op)
(write (cons (version) (write (cons (version)
(append (map path->main-collects-relative deps) (append (map path->main-collects-relative deps)
(map (lambda (x) (path->main-collects-relative (cons 'ext x))) (map (lambda (x) (cons 'ext (path->main-collects-relative x)))
external-deps))) external-deps)))
op) op)
(newline op))))) (newline op)))))
@ -264,7 +264,12 @@
(when (> t path-zo-time) (when (> t path-zo-time)
(trace-printf "newer: ~a (~a > ~a)..." d t path-zo-time)) (trace-printf "newer: ~a (~a > ~a)..." d t path-zo-time))
(> t path-zo-time))) (> t path-zo-time)))
(map main-collects-relative->path (cdr deps))) (map (lambda (p)
(if (and (pair? p)
(eq? 'ext (car p)))
(cons 'ext (main-collects-relative->path (cdr p)))
(main-collects-relative->path p)))
(cdr deps)))
(compile-zo mode path)))))) (compile-zo mode path))))))
(let ((stamp (get-compiled-time mode path #t))) (let ((stamp (get-compiled-time mode path #t)))
(hash-table-put! up-to-date path stamp) (hash-table-put! up-to-date path stamp)

View File

@ -78,7 +78,11 @@
[r (and bs (path->main-collects-relative bs))]) [r (and bs (path->main-collects-relative bs))])
(and bs (and bs
(bytes->string/locale (if (and (pair? r) (eq? 'collects (car r))) (bytes->string/locale (if (and (pair? r) (eq? 'collects (car r)))
(bytes-append #"<collects>/" (cdr r)) (apply bytes-append
#"<collects>"
(map (lambda (s)
(bytes-append #"/" s))
(cdr r)))
bs))))) bs)))))
;; build-src-loc-string : syntax -> (union #f string) ;; build-src-loc-string : syntax -> (union #f string)

View File

@ -76,6 +76,8 @@
format-number format-number
quiet-table-of-contents) quiet-table-of-contents)
(init-field [css-path #f])
(define/override (get-suffix) #".html") (define/override (get-suffix) #".html")
;; ---------------------------------------- ;; ----------------------------------------
@ -133,6 +135,9 @@
(define/private (reveal-subparts? p) (define/private (reveal-subparts? p)
(part-style? p 'reveal)) (part-style? p 'reveal))
(define/public (toc-wrap table)
null)
(define/public (render-toc-view d ri) (define/public (render-toc-view d ri)
(let-values ([(top mine) (let-values ([(top mine)
(let loop ([d d][mine d]) (let loop ([d d][mine d])
@ -185,10 +190,11 @@
(class "tocviewlink")) (class "tocviewlink"))
,@(render-content (or (part-title-content top) '("???")) d ri))) ,@(render-content (or (part-title-content top) '("???")) d ri)))
(div nbsp) (div nbsp)
(table ,@(toc-wrap
`(table
((class "tocviewlist") ((class "tocviewlist")
(cellspacing "0")) (cellspacing "0"))
,@toc-content))))) ,@toc-content))))))
,@(render-onthispage-contents d ri top) ,@(render-onthispage-contents d ri top)
,@(apply append ,@(apply append
(map (lambda (t) (map (lambda (t)
@ -311,18 +317,31 @@
null)) null))
(link ((rel "stylesheet") (link ((rel "stylesheet")
(type "text/css") (type "text/css")
(href "scribble.css") (href ,(or css-path "scribble.css"))
(title "default")))) (title "default"))))
(body ,@(render-toc-view d ri) (body ,@(render-toc-view d ri)
(div ((class "maincolumn")) (div ((class "maincolumn"))
(div ((class "main")) ,@(render-part d ri)))))]) (div ((class "main"))
(install-file scribble-css) ,@(render-version d ri)
,@(render-part d ri)))))])
(unless css-path
(install-file scribble-css))
(printf "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n") (printf "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n")
(xml:write-xml/content (xml:xexpr->xml xpr))))) (xml:write-xml/content (xml:xexpr->xml xpr)))))
(define/override (render-one d ri fn) (define/override (render-one d ri fn)
(render-one-part d ri fn null)) (render-one-part d ri fn null))
(define/public (render-version d ri)
`((div ([class "versionbox"])
,@(render-content
(list
(make-element "version"
(list "Version: "
(current-version))))
d
ri))))
(define/override (render-part d ri) (define/override (render-part d ri)
(let ([number (collected-info-number (part-collected-info d ri))]) (let ([number (collected-info-number (part-collected-info d ri))])
`(,@(if (and (not (part-title-content d)) `(,@(if (and (not (part-title-content d))
@ -646,6 +665,9 @@
`((div ((class "tocsubtitle")) `((div ((class "tocsubtitle"))
"On this page:"))) "On this page:")))
(define/override (toc-wrap p)
(list p))
(define contents-content '("contents")) (define contents-content '("contents"))
(define index-content '("index")) (define index-content '("index"))
(define prev-content '(larr " prev")) (define prev-content '(larr " prev"))
@ -654,7 +676,11 @@
(define no-next-content next-content) (define no-next-content next-content)
(define sep-element (make-element #f '(nbsp nbsp))) (define sep-element (make-element #f '(nbsp nbsp)))
(inherit render-table) (inherit render-table
render-paragraph)
(define/override (render-version r i)
null)
(define/private (find-siblings d ri) (define/private (find-siblings d ri)
(let ([parent (collected-info-parent (part-collected-info d ri))]) (let ([parent (collected-info-parent (part-collected-info d ri))])
@ -705,24 +731,16 @@
(let ([d (car (last-pair subs))]) (let ([d (car (last-pair subs))])
(and (part-style? d 'index) (and (part-style? d 'index)
d)))))))]) d)))))))])
`(,@(render-table (make-table `((div ([class "navleft"])
'at-left ,@(render-content
(list (append
(cons
(make-flow
(list
(make-paragraph
(list (list
(make-element (make-element
(if parent (if parent
(make-target-url "index.html") (make-target-url "index.html")
"nonavigation") "nonavigation")
contents-content))))) contents-content))
(if index (if index
(list
(make-flow
(list
(make-paragraph
(list (list
'nbsp 'nbsp
(if (eq? d index) (if (eq? d index)
@ -732,16 +750,12 @@
(make-link-element (make-link-element
#f #f
index-content index-content
(car (part-tags index))))))))) (car (part-tags index)))))
null)))) null))
d ri) d
,@(render-table (make-table ri))
'at-right (div ([class "navright"])
(list ,@(render-content
(list
(make-flow
(list
(make-paragraph
(list (list
(make-element (make-element
(if parent (if parent
@ -764,9 +778,9 @@
(if next (if next
(make-target-url (derive-filename next)) (make-target-url (derive-filename next))
"nonavigation") "nonavigation")
next-content)))))))) next-content))
d d
ri))))) ri))))))
(define/override (render-part d ri) (define/override (render-part d ri)
(parameterize ([current-version (parameterize ([current-version
@ -796,20 +810,9 @@
[on-separate-page #f]) [on-separate-page #f])
(if sep? (if sep?
;; Navigation bars; ;; Navigation bars;
`(,@(navigation d ri) `(,@(super render-version d ri)
,@(navigation d ri)
(p nbsp) (p nbsp)
,@(render-table (make-table
"versionbox"
(list
(list
(make-flow
(list
(make-paragraph (list
(make-element "version"
(list "Version: "
(current-version))))))))))
d
ri)
,@(super render-part d ri) ,@(super render-part d ri)
(p nbsp) (p nbsp)
,@(navigation d ri) ,@(navigation d ri)

View File

@ -1,41 +1,49 @@
body { body {
color: black; color: black;
background-color: #ffffff; background-color: #ffffff;
} }
table td { table td {
padding-left: 0; padding-left: 0;
padding-right: 0; padding-right: 0;
} }
.maincolumn { .maincolumn {
font-family: monospace; font-family: monospace;
width: 43em; width: 43em;
margin-right: -40em; margin-right: -40em;
margin-left: 15em; margin-left: 15em;
} }
.main { .main {
font-family: serif; font-family: serif;
text-align: left; text-align: left;
} }
.versionbox { .navleft {
position: relative;
float: left;
}
.navright {
position: relative;
float: right;
}
.versionbox {
position: relative; position: relative;
float: right; float: right;
left: 3em; left: 3em;
top: -2em;
height: 0em; height: 0em;
width: 13em; width: 13em;
margin: 0em -13em 0em 0em; margin: 0em -13em 0em 0em;
} }
.version { .version {
font-family: sans-serif; font-family: sans-serif;
font-size: small;
}
} .refpara {
.refpara {
font-family: monospace; font-family: monospace;
position: relative; position: relative;
float: right; float: right;
@ -44,454 +52,380 @@
height: 0em; height: 0em;
width: 13em; width: 13em;
margin: 0em -13em 0em 0em; margin: 0em -13em 0em 0em;
} }
.refcolumn { .refcolumn {
background-color: #F5F5DC; background-color: #F5F5DC;
display: block; display: block;
position: relative; position: relative;
width: 13em; width: 13em;
font-size: 85%; font-size: 85%;
border: 0.5em solid #F5F5DC; border: 0.5em solid #F5F5DC;
} }
.refcontent { .refcontent {
font-family: serif; font-family: serif;
} }
.tocset { .tocset {
font-family: monospace; font-family: monospace;
position: relative; position: relative;
float: left; float: left;
width: 12.5em; width: 12.5em;
margin-right: 2em; margin-right: 2em;
} }
.tocview { .tocview {
font-family: serif; font-family: serif;
text-align: left; text-align: left;
background-color: #F5F5DC; background-color: #F5F5DC;
} }
.tocsub { .tocsub {
font-family: serif; font-family: serif;
margin-top: 1em; margin-top: 1em;
text-align: left; text-align: left;
background-color: #DCF5F5; background-color: #DCF5F5;
} }
.tocviewtitle { .tocviewtitle {
font-size: 80%; font-size: 80%;
font-weight: bold; font-weight: bold;
margin: 0.2em 0.2em 0.2em 0.2em; margin: 0.2em 0.2em 0.2em 0.2em;
} }
.tocviewlist { .tocviewlist {
margin: 0.2em 0.2em 0.2em 0.2em; margin: 0.2em 0.2em 0.2em 0.2em;
} }
.tocviewlist td { .tocviewlist td {
font-size: 80%; font-size: 80%;
vertical-align: top; vertical-align: top;
} }
.tocviewlink { .tocviewlink {
text-decoration: none; text-decoration: none;
} }
.tocsublist { .tocsublist {
margin: 0.2em 0.2em 0.2em 0.2em; margin: 0.2em 0.2em 0.2em 0.2em;
} }
.tocsublist td { .tocsublist td {
vertical-align: top; vertical-align: top;
padding-left: 1em; padding-left: 1em;
text-indent: -1em; text-indent: -1em;
} }
.tocsublinknumber { .tocsublinknumber {
font-size: 80%; font-size: 80%;
} }
.tocsublink { .tocsublink {
text-decoration: none; text-decoration: none;
} }
.tocsubseclink { .tocsubseclink {
font-size: 80%; font-size: 80%;
text-decoration: none; text-decoration: none;
} }
.tocsubtitle { .tocsubtitle {
font-size: 80%; font-size: 80%;
font-style: italic; font-style: italic;
margin: 0.2em 0.2em 0.2em 0.2em; margin: 0.2em 0.2em 0.2em 0.2em;
} }
.leftindent { .leftindent {
margin-left: 1em; margin-left: 1em;
margin-right: 0em; margin-right: 0em;
} }
.insetpara { .insetpara {
margin-left: 1em; margin-left: 1em;
margin-right: 1em; margin-right: 1em;
} }
.toclink { .toclink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
font-size: 85%; font-size: 85%;
} }
.toptoclink { .toptoclink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
font-weight: bold; font-weight: bold;
} }
.inherited { .inherited {
width: 100%; width: 100%;
margin-top: 1em; margin-top: 1em;
text-align: left; text-align: left;
background-color: #ECF5F5; background-color: #ECF5F5;
} }
.inherited td { .inherited td {
padding-left: 1em; padding-left: 1em;
text-indent: -0.8em; text-indent: -0.8em;
padding-right: 0.2em; padding-right: 0.2em;
} }
.inheritedlbl { .inheritedlbl {
font-style: italic; font-style: italic;
font-size: 85%; font-size: 85%;
} }
.indexlink { .indexlink {
text-decoration: none; text-decoration: none;
} }
.nobreak { .nobreak {
white-space: nowrap; white-space: nowrap;
} }
.stt { .stt {
font-family: monospace; font-family: monospace;
} }
.title { .title {
font-size: 200%; font-size: 200%;
font-weight: normal; font-weight: normal;
margin-top: 2.8em; margin-top: 2.8em;
text-align: center; text-align: center;
} }
.partheading { .partheading {
font-size: 100%; font-size: 100%;
} }
.chapterheading { .chapterheading {
font-size: 100%; font-size: 100%;
} }
.beginsection { .beginsection {
font-size: 110%; font-size: 110%;
} }
.tiny { pre {
font-size: 40%;
}
.scriptsize {
font-size: 60%;
}
.footnotesize {
font-size: 75%;
}
.small {
font-size: 90%;
}
.normalsize {
font-size: 100%;
}
.large {
font-size: 120%;
}
.largecap {
font-size: 150%;
}
.largeup {
font-size: 200%;
}
.huge {
font-size: 300%;
}
.hugecap {
font-size: 350%;
}
pre {
margin-left: 2em; margin-left: 2em;
} }
blockquote { blockquote {
margin-left: 2em; margin-left: 2em;
} }
ol { ol {
list-style-type: decimal; list-style-type: decimal;
} }
ol ol { ol ol {
list-style-type: lower-alpha; list-style-type: lower-alpha;
} }
ol ol ol { ol ol ol {
list-style-type: lower-roman; list-style-type: lower-roman;
} }
ol ol ol ol { ol ol ol ol {
list-style-type: upper-alpha; list-style-type: upper-alpha;
} }
i { i {
font-family: serif; font-family: serif;
} }
.boxed { .boxed {
width: 100%; width: 100%;
background-color: #E8E8FF; background-color: #E8E8FF;
} }
.together { .together {
width: 100%; width: 100%;
} }
.prototype td { .prototype td {
vertical-align: top; vertical-align: top;
} }
.longprototype td { .longprototype td {
vertical-align: bottom; vertical-align: bottom;
} }
.schemeblock td { .schemeblock td {
vertical-align: baseline; vertical-align: baseline;
} }
.argcontract td { .argcontract td {
vertical-align: top; vertical-align: top;
} }
.centered { .centered {
horiz-align: center; horiz-align: center;
} }
.verbatim em { .verbatim em {
font-family: serif; font-family: serif;
} }
.ghost { .ghost {
color: white; color: white;
} }
.scheme em { .scheme em {
color: black; color: black;
font-family: serif; font-family: serif;
} }
.highlighted { .highlighted {
background-color: #ddddff; background-color: #ddddff;
} }
.defmodule { .defmodule {
width: 100%; width: 100%;
background-color: #F5F5DC; background-color: #F5F5DC;
} }
.specgrammar { .specgrammar {
float: right; float: right;
} }
.hspace { .hspace {
font-family: monospace; font-family: monospace;
} }
.small { .inferencetop td {
font-size: 80%;
}
.inferencetop td {
border-bottom: 1px solid black; border-bottom: 1px solid black;
text-align: center; text-align: center;
} }
.inferencebottom td { .inferencebottom td {
text-align: center; text-align: center;
} }
.schemeinput { .schemeinput {
color: brown; color: brown;
background-color: #eeeeee; background-color: #eeeeee;
font-family: monospace; font-family: monospace;
} }
.schemeinputbg { .schemeinputbg {
background-color: #eeeeee; background-color: #eeeeee;
} }
.schemereader { .schemereader {
font-family: monospace; font-family: monospace;
} }
.schemeparen { .schemeparen {
color: #843c24; color: #843c24;
font-family: monospace; font-family: monospace;
} }
.schememeta { .schememeta {
color: #262680; color: #262680;
font-family: monospace; font-family: monospace;
} }
.schememod { .schememod {
color: black; color: black;
font-family: monospace; font-family: monospace;
} }
.schemeopt { .schemeopt {
color: black; color: black;
} }
.schemekeyword { .schemekeyword {
color: black; color: black;
font-weight: bold; font-weight: bold;
font-family: monospace; font-family: monospace;
} }
.schemeerror { .schemeerror {
color: red; color: red;
font-style: italic; font-style: italic;
} }
.schemevariable { .schemevariable {
color: #262680; color: #262680;
font-style: italic; font-style: italic;
font-family: monospace; font-family: monospace;
} }
.schemesymbol { .schemesymbol {
color: #262680; color: #262680;
font-family: monospace; font-family: monospace;
} }
.schemevaluelink { .schemevaluelink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
} }
.schememodlink { .schememodlink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
} }
.schemesyntaxlink { .schemesyntaxlink {
text-decoration: none; text-decoration: none;
color: black; color: black;
font-weight: bold; font-weight: bold;
} }
.badlink { .badlink {
text-decoration: underline; text-decoration: underline;
color: red; color: red;
} }
.plainlink { .plainlink {
text-decoration: none; text-decoration: none;
color: blue; color: blue;
} }
.techlink { .techlink {
text-decoration: none; text-decoration: none;
color: black; color: black;
} }
.techlink:hover {
.techlink:hover {
text-decoration: underline; text-decoration: underline;
color: blue; color: blue;
} }
.schemeresult { .schemeresult {
color: #0000af; color: #0000af;
font-family: monospace; font-family: monospace;
} }
.schemestdout { .schemestdout {
color: #960096; color: #960096;
font-family: monospace; font-family: monospace;
} }
.schemecomment { .schemecomment {
color: #c2741f; color: #c2741f;
font-family: monospace; font-family: monospace;
} }
.schemevalue { .schemevalue {
color: #228b22; color: #228b22;
font-family: monospace; font-family: monospace;
} }
.bibliography td { .bibliography td {
vertical-align: top; vertical-align: top;
} }
.imageleft { .imageleft {
float: left; float: left;
margin-right: 0.3em; margin-right: 0.3em;
} }
.nonavigation { .nonavigation {
color: #EEEEEE; color: #EEEEEE;
} }
.disable { .mywbr {
/* color: #e5e5e5; */
color: gray;
}
.smallcaps {
font-size: 75%;
}
.smallprint {
color: gray;
font-size: 75%;
text-align: right;
}
.footnoterule {
text-align: left;
width: 40%;
}
.colophon {
color: gray;
font-size: 80%;
font-style: italic;
text-align: right;
}
.colophon a {
color: gray;
}
.mywbr {
width: 0; width: 0;
font-size: 1px; font-size: 1px;
} }

View File

@ -1,4 +1,4 @@
(module info setup/infotab (module info setup/infotab
(define name "Scribblings: Start") (define name "Scribblings: Start")
(define scribblings '(("start.scrbl" (always-run)))) (define scribblings '(("start.scrbl" (main-doc-root always-run))))
(define doc-categories '(omit))) (define doc-categories '(omit)))

View File

@ -17,59 +17,58 @@
;; `path->main-collects-relative' misses some usages, as long as it ;; `path->main-collects-relative' misses some usages, as long as it
;; works when we prepare a distribution tree. Otherwise, things ;; works when we prepare a distribution tree. Otherwise, things
;; will continue to work fine and .dep files will just contain ;; will continue to work fine and .dep files will just contain
;; absolute path names. These functions work on .dep elements: ;; absolute path names.
;; either a pathname or a pair with a pathname in its cdr; the
;; `path->main-collects-relative' pathname will itself be a pair.
;; We need to compare paths to find when something is in the plt ;; We need to compare paths to find when something is in the plt
;; tree -- this does some basic "normalization" that should work ;; tree, so we explode the paths. This slower than the old way (by
;; fine: getting rid of `.' and `..', collapsing multiple ;; a factor of 2 or so), but it's simpler and more portable.
;; `/'s to one `/', and converting '/'s to '\'s under Windows. (define (explode-path* path)
(define (simplify-path* bytes) (explode-path (simplify-path (path->complete-path path))))
(path->bytes (normal-case-path (simplify-path (bytes->path bytes)))))
(define (explode-path orig-path)
(let loop ([path orig-path][rest null])
(let-values ([(base name dir?) (split-path path)])
(if (path? base)
(loop base (cons name rest))
(cons name rest)))))
(define main-collects-dir/ (define main-collects-dir/
(delay (let ([dir (find-main-dir)]) (delay (let ([dir (find-main-dir)])
(and dir (simplify-path* (path->bytes (path->directory-path dir))))))) (and dir (explode-path* dir)))))
(define (maybe-cdr-op fname f)
(lambda (x)
(cond [(and (pair? x) (not (eq? tag (car x))))
(cons (car x) (f (cdr x)))]
[else (f x)])))
;; path->main-collects-relative* : path-or-bytes -> datum-containing-bytes-or-path ;; path->main-collects-relative* : path-or-bytes -> datum-containing-bytes-or-path
(define (path->main-collects-relative* path) (define (path->main-relative* path)
(let* ([path (cond [(bytes? path) path] (let loop ([exploded (explode-path* (if (bytes? path)
[(path? path) (path->bytes path)] (bytes->path path)
[else (error 'path->main-collects-relative path))]
"expecting a byte-string, got ~e" path)])] [main-exploded (force main-collects-dir/)])
[path* (simplify-path* path)] (cond
[main-collects-dir/ (force main-collects-dir/)] [(null? main-exploded) (cons tag (map path-element->bytes exploded))]
[mcd-len (bytes-length main-collects-dir/)]) [(null? exploded) path]
(cond [(and path* [(equal? (normal-case-path (car exploded))
mcd-len (normal-case-path (car main-exploded)))
(> (bytes-length path*) mcd-len) (loop (cdr exploded) (cdr main-exploded))]
(equal? (subbytes path* 0 mcd-len)
main-collects-dir/))
(cons tag (subbytes path* mcd-len))]
[(equal? path* main-collects-dir/) (cons tag #"")]
[else path]))) [else path])))
;; main-collects-relative->path* : datum-containing-bytes-or-path -> path ;; main-collects-relative->path* : datum-containing-bytes-or-path -> path
(define (main-collects-relative->path* path) (define (main-relative->path* path)
(cond [(and (pair? path) (cond [(and (pair? path)
(eq? tag (car path)) (eq? tag (car path))
(bytes? (cdr path))) (or (bytes? (cdr path)) ; backward compatibility
(and (list? (cdr path))
(andmap bytes? (cdr path)))))
(let ([dir (or (find-main-dir) (let ([dir (or (find-main-dir)
;; No main "collects"/"doc"/whatever? Use original working directory: ;; No main "collects"/"doc"/whatever? Use original working directory:
(find-system-path 'orig-dir))]) (find-system-path 'orig-dir))])
(if (bytes? (cdr path))
;; backward compatibilty:
(if (equal? (cdr path) #"") (if (equal? (cdr path) #"")
dir dir
(build-path dir (bytes->path (cdr path)))))] (build-path dir (bytes->path (cdr path))))
[(bytes? path) (bytes->path path)] ;; Normal mode:
(apply build-path dir
(map bytes->path-element (cdr path)))))]
[else path])) [else path]))
(values (values path->main-relative*
(maybe-cdr-op to-rel-name path->main-collects-relative*) main-relative->path*)))
(maybe-cdr-op from-rel-name main-collects-relative->path*))))

View File

@ -16,7 +16,7 @@
(define verbose (make-parameter #t)) (define verbose (make-parameter #t))
(define-struct doc (src-dir src-file dest-dir flags)) (define-struct doc (src-dir src-file dest-dir flags under-main?))
(define-struct info (doc sci provides undef searches deps (define-struct info (doc sci provides undef searches deps
build? time out-time need-run? build? time out-time need-run?
need-in-write? need-out-write? need-in-write? need-out-write?
@ -38,6 +38,7 @@
(and (list? (cadr v)) (and (list? (cadr v))
(andmap (lambda (i) (andmap (lambda (i)
(member i '(main-doc (member i '(main-doc
main-doc-root
multi-page multi-page
always-run))) always-run)))
(cadr v)) (cadr v))
@ -46,7 +47,10 @@
(relative-path? (caddr v)))))))) (relative-path? (caddr v))))))))
s)) s))
(map (lambda (d) (map (lambda (d)
(let ([flags (if (pair? (cdr d)) (cadr d) null)]) (let* ([flags (if (pair? (cdr d)) (cadr d) null)]
[under-main? (and (not (memq 'main-doc-root flags))
(or (memq 'main-doc flags)
(pair? (path->main-collects-relative dir))))])
(make-doc dir (make-doc dir
(build-path dir (car d)) (build-path dir (car d))
(let ([name (if (and (pair? (cdr d)) (let ([name (if (and (pair? (cdr d))
@ -55,11 +59,13 @@
(cadr d) (cadr d)
(let-values ([(base name dir?) (split-path (car d))]) (let-values ([(base name dir?) (split-path (car d))])
(path-replace-suffix name #"")))]) (path-replace-suffix name #"")))])
(if (or (memq 'main-doc flags) (if (memq 'main-doc-root flags)
(pair? (path->main-collects-relative dir))) (find-doc-dir)
(if under-main?
(build-path (find-doc-dir) name) (build-path (find-doc-dir) name)
(build-path dir "doc" name))) (build-path dir "doc" name))))
flags))) flags
under-main?)))
s) s)
(begin (begin
(fprintf (current-error-port) (fprintf (current-error-port)
@ -174,7 +180,10 @@
[dest-dir (if (memq 'multi-page (doc-flags doc)) [dest-dir (if (memq 'multi-page (doc-flags doc))
(let-values ([(base name dir?) (split-path (doc-dest-dir doc))]) (let-values ([(base name dir?) (split-path (doc-dest-dir doc))])
base) base)
(doc-dest-dir doc))]))) (doc-dest-dir doc))]
[css-path (if (doc-under-main? doc)
"../scribble.css"
#f)])))
(define (pick-dest latex-dest doc) (define (pick-dest latex-dest doc)
(if latex-dest (if latex-dest
@ -269,7 +278,7 @@
(list-ref v-out 2) ; provides (list-ref v-out 2) ; provides
(list-ref v-in 1) ; undef (list-ref v-in 1) ; undef
(list-ref v-in 3) ; searches (list-ref v-in 3) ; searches
(map string->path (list-ref v-in 2)) ; deps, in case we don't need to build... (map rel->path (list-ref v-in 2)) ; deps, in case we don't need to build...
can-run? can-run?
my-time info-out-time my-time info-out-time
(and can-run? (memq 'always-run (doc-flags doc))) (and can-run? (memq 'always-run (doc-flags doc)))
@ -399,7 +408,7 @@
(list (list (info-vers info) (doc-flags doc)) (list (list (info-vers info) (doc-flags doc))
(info-undef info) (info-undef info)
(map (lambda (i) (map (lambda (i)
(path->string (doc-src-file (info-doc i)))) (path->rel (doc-src-file (info-doc i))))
(info-deps info)) (info-deps info))
(info-searches info)))))))))) (info-searches info))))))))))
@ -409,3 +418,15 @@
(define (write-in info) (define (write-in info)
(make-directory* (doc-dest-dir (info-doc info))) (make-directory* (doc-dest-dir (info-doc info)))
(write- info "in.sxref" (lambda (o i) i))) (write- info "in.sxref" (lambda (o i) i)))
(define (rel->path r)
(if (bytes? r)
(bytes->path r)
(main-collects-relative->path r)))
(define (path->rel r)
(let ([r (path->main-collects-relative r)])
(if (path? r)
(path->bytes r)
r)))

View File

@ -18,8 +18,6 @@
compiler/sig compiler/sig
launcher/launcher-sig launcher/launcher-sig
(prefix-in doc: "scribble.ss")
"unpack.ss" "unpack.ss"
"getinfo.ss" "getinfo.ss"
"dirs.ss" "dirs.ss"
@ -412,9 +410,11 @@
(with-input-from-file path read))]) (with-input-from-file path read))])
(when (and (pair? deps) (list? deps)) (when (and (pair? deps) (list? deps))
(for ([s (cdr deps)]) (for ([s (cdr deps)])
(unless (and (pair? s)
(eq? 'ext (car s)))
(let ([s (main-collects-relative->path s)]) (let ([s (main-collects-relative->path s)])
(when (path-string? s) (when (path-string? s)
(hash-table-put! dependencies s #t))))))) (hash-table-put! dependencies s #t))))))))
(delete-file path)) (delete-file path))
(define (delete-files-in-directory path printout dependencies) (define (delete-files-in-directory path printout dependencies)
@ -738,16 +738,23 @@
;; Docs ;; ;; Docs ;;
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (doc:verbose)
(parameterize ([current-namespace (namespace-anchor->empty-namespace anchor)])
(dynamic-require 'setup/scribble 'verbose)))
(define (doc:setup-scribblings)
(parameterize ([current-namespace (namespace-anchor->empty-namespace anchor)])
(dynamic-require 'setup/scribble 'setup-scribblings)))
(when (make-docs) (when (make-docs)
(setup-printf "Building documentation") (setup-printf "Building documentation")
(doc:verbose (verbose)) ((doc:verbose) (verbose))
(with-handlers ([exn:fail? (lambda (exn) (with-handlers ([exn:fail? (lambda (exn)
(setup-printf (setup-printf
"Docs failure: ~a" "Docs failure: ~a"
(if (exn? exn) (if (exn? exn)
(exn-message exn) (exn-message exn)
exn)))]) exn)))])
(doc:setup-scribblings ((doc:setup-scribblings)
(if no-specific-collections? #f (map cc-path ccs-to-compile)) (if no-specific-collections? #f (map cc-path ccs-to-compile))
#f))) #f)))
@ -789,8 +796,8 @@
void void
(lambda () (lambda ()
(make-directory tmp-dir) (make-directory tmp-dir)
(doc:verbose (verbose)) ((doc:verbose) (verbose))
(doc:setup-scribblings ((doc:setup-scribblings)
(if no-specific-collections? #f (map cc-path ccs-to-compile)) (if no-specific-collections? #f (map cc-path ccs-to-compile))
tmp-dir) tmp-dir)
(parameterize ([current-directory tmp-dir]) (parameterize ([current-directory tmp-dir])

View File

@ -18,10 +18,12 @@
(let-values ([(base name dir?) (split-path (car d))]) (let-values ([(base name dir?) (split-path (car d))])
(path-replace-suffix name #"")))]) (path-replace-suffix name #"")))])
(build-path (build-path
(if (memq 'main-doc-root flags)
(find-doc-dir)
(if (or (memq 'main-doc flags) (if (or (memq 'main-doc flags)
(pair? (path->main-collects-relative dir))) (pair? (path->main-collects-relative dir)))
(build-path (find-doc-dir) name) (build-path (find-doc-dir) name)
(build-path dir "compiled" "doc" name)) (build-path dir "compiled" "doc" name)))
"out.sxref")) "out.sxref"))
#f)) #f))
((get-info/full dir) 'scribblings))) ((get-info/full dir) 'scribblings)))