remove search box for Scribble HTML output unless requested; move some hardwired styles to CSS file

svn: r12029

original commit: 81dfc14cc643c3c44351fa0a47c501f664c5bc8f
This commit is contained in:
Matthew Flatt 2008-10-14 01:53:34 +00:00
parent 611fb883c7
commit 88e4b31afe
6 changed files with 75 additions and 36 deletions

View File

@ -200,10 +200,8 @@
[emptylabel "...search manuals..."]
[dimcolor "#888"])
`(input
([style ,(sa "width: 16em; margin: 0px; padding: 0px;"
" background-color: #eee; color: "dimcolor";"
" border: 1px solid #ddd;"
" text-align: center; vertical-align: middle;")]
([class "searchbox"]
[style ,(sa "color: "dimcolor";")]
[type "text"]
[value ,emptylabel]
[title "Enter a search string to search the manuals"]
@ -240,7 +238,8 @@
[style-file #f]
[style-extra-files null]
[script-path #f]
[script-file #f])
[script-file #f]
[search-box? #f])
(define/override (get-suffix) #".html")
@ -555,6 +554,12 @@
d ri))))))))
ps))))))))
(define/public (extract-version d)
(if (and (versioned-part? d)
(versioned-part-version d))
(versioned-part-version d)
(current-version)))
(define/public (render-one-part d ri fn number)
(parameterize ([current-output-file fn])
(let* ([style-file (or style-file scribble-css)]
@ -586,7 +591,8 @@
,@(render-toc-view d ri)
(div ([class "maincolumn"])
(div ([class "main"])
,@(render-version d ri)
,@(parameterize ([current-version (extract-version d)])
(render-version d ri))
,@(navigation d ri #t)
,@(render-part d ri)
,@(navigation d ri #f))))))))))
@ -617,6 +623,8 @@
(define/public (derive-filename d) "bad.html")
(define/public (include-navigation?) search-box?)
(define/private (navigation d ri top?)
(define parent (part-parent d ri))
(define-values (prev0 next0) (find-siblings d ri))
@ -679,7 +687,9 @@
`[onclick . ,(format "return GotoPLTRoot(\"~a\");" (version))]))
(define navleft
`(span ([class "navleft"])
,(if up-path search-box top-search-box)
,@(if search-box?
(list (if up-path search-box top-search-box))
null)
,@(render
sep-element
(and up-path (make-element top-link top-content))
@ -724,23 +734,27 @@
(if next (titled-url "forward" next) "nonavigation")
next-content)))))
(define navbar
`(div ([class "navset"]
[style ,(let ([v (if top? 'bottom 'top)])
(format "margin-~a: 2em; border-~a: ~a"
v v "2px solid #e0e0c0;"))])
`(div ([class ,(if top? "navsettop" "navsetbottom")])
,navleft ,navright nbsp)) ; need nbsp to make the navset bg visible
(list navbar))
(if (include-navigation?)
(list navbar)
null))
(define/override (render-one d ri fn)
(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))))
(let ([v (current-version)])
(if (equal? v "")
;; don't show empty version:
null
;; show version:
`((div ([class "versionbox"])
,@(render-content
(list (make-element "version"
(list "Version: " v)))
d
ri))))))
(define/override (render-part d ri)
(let ([number (collected-info-number (part-collected-info d ri))])
@ -1130,6 +1144,8 @@
(error "file name too long (need a tag):" fn))
fn))
(define/override (include-navigation?) #t)
(define/override (collect ds fns)
(super collect ds (map (lambda (fn) (build-path fn "index.html")) fns)))
@ -1170,14 +1186,11 @@
(list p))
(inherit render-table
render-paragraph)
render-paragraph
extract-version)
(define/override (render-part d ri)
(parameterize ([current-version
(if (and (versioned-part? d)
(versioned-part-version d))
(versioned-part-version d)
(current-version))])
(parameterize ([current-version (extract-version d)])
(let ([number (collected-info-number (part-collected-info d ri))])
(if (and (not (on-separate-page))
(or (= 1 (length number))

View File

@ -48,11 +48,11 @@
(flow-paragraphs (part-flow d)))])
(when m
(do-render-paragraph m d ri #t)))
(printf "\\titleAndVersion{")
(render-content (part-title-content d) d ri)
(printf "}{~a}\n"
(or (and (versioned-part? d) (versioned-part-version d))
(version))))
(let ([vers (or (and (versioned-part? d) (versioned-part-version d))
(version))])
(printf "\\titleAnd~aVersion{" (if (equal? vers "") "Empty" ""))
(render-content (part-title-content d) d ri)
(printf "}{~a}\n" vers)))
(render-part d ri)
(printf "\\postDoc\n\\end{document}\n")))

View File

@ -27,6 +27,10 @@
/* ---------------------------------------- */
h2 { /* per-page main title */
margin-top: 0;
}
h3, h4, h5, h6, h7, h8 {
margin-top: 1.75em;
margin-bottom: 0.5em;
@ -66,11 +70,21 @@ table td {
/* ---------------------------------------- */
/* Navigation */
.navset {
.navsettop, .navsetbottom {
background-color: #f0f0e0;
padding: 0.25em 0 0.25em 0;
}
.navsettop {
margin-bottom: 1.5em;
border-bottom: 2px solid #e0e0c0;
}
.navsetbottom {
margin-top: 2em;
border-top: 2px solid #e0e0c0;
}
.navleft {
margin-left: 1ex;
position: relative;
@ -87,6 +101,16 @@ table td {
color: #e0e0e0;
}
.searchbox {
width: 16em;
margin: 0px;
padding: 0px;
background-color: #eee;
border: 1px solid #ddd;
text-align: center;
vertical-align: middle;
}
/* ---------------------------------------- */
/* Version */

View File

@ -70,6 +70,7 @@
\newcommand{\smaller}[1]{{\footnotesize #1}}
\newcommand{\refpara}[1]{\marginpar{\footnotesize #1}}
\newcommand{\titleAndEmptyVersion}[2]{\title{#1}\maketitle}
\newcommand{\titleAndVersion}[2]{\title{#1\\{\normalsize Version #2}}\maketitle}
\newcommand{\sectionNewpage}{\newpage}

View File

@ -78,7 +78,8 @@ path, it is converted to a string using
@scheme[module-path-prefix->string].
The @scheme[vers] argument is propagated to the @scheme[title-decl]
structure.
structure. Use @scheme[""] as @scheme[vers] to suppress version
rendering in the output.
The section title is automatically indexed by
@scheme[decode-part]. For the index key, leading whitespace and a

View File

@ -314,12 +314,12 @@ during the @techlink{collect pass}, the number is not rendered.
Supplies a version number for this part and its sub-parts (except as
overridden). A @scheme[#f] version is the same as not supplying a
version.
specific version.
The version number may be used when rendering a document. At a
minimum, a version is rendered when it is attached to a part
representing the whole document. The default version for a document is
@scheme[(version)].}
The version number that is not @scheme[""] may be used when rendering
a document. At a minimum, a non-@scheme[""] version is rendered when
it is attached to a part representing the whole document. The default
version for a document is @scheme[(version)].}
@defstruct[flow ([paragraphs (listof flow-element?)])]{