more scribble configurability and latex back-end improvements
svn: r9120 original commit: f5268bed2a0bb1a4d548bb1f073432047455ced8
This commit is contained in:
parent
f6600f1320
commit
ab02db1252
|
@ -189,7 +189,8 @@
|
|||
quiet-table-of-contents)
|
||||
|
||||
(init-field [css-path #f]
|
||||
[up-path #f])
|
||||
[up-path #f]
|
||||
[style-file #f])
|
||||
|
||||
(define/override (get-suffix) #".html")
|
||||
|
||||
|
@ -449,37 +450,41 @@
|
|||
|
||||
(define/public (render-one-part d ri fn number)
|
||||
(parameterize ([current-output-file fn])
|
||||
(let ([xpr `(html ()
|
||||
(head
|
||||
(meta ((http-equiv "content-type")
|
||||
(content "text-html; charset=utf-8")))
|
||||
,@(let ([c (part-title-content d)])
|
||||
(if c
|
||||
`((title ,@(format-number number '(nbsp))
|
||||
,(content->string c this d ri)))
|
||||
null))
|
||||
,(if (eq? 'inline css-path)
|
||||
`(style ([type "text/css"])
|
||||
"\n"
|
||||
,(with-input-from-file scribble-css
|
||||
(lambda ()
|
||||
;; note: file-size can be bigger that the
|
||||
;; string, but that's fine.
|
||||
(read-string (file-size scribble-css))))
|
||||
"\n")
|
||||
`(link ((rel "stylesheet")
|
||||
(type "text/css")
|
||||
(href ,(or css-path "scribble.css"))
|
||||
(title "default")))))
|
||||
(body ,@(render-toc-view d ri)
|
||||
(div ((class "maincolumn"))
|
||||
(div ((class "main"))
|
||||
,@(render-version d ri)
|
||||
,@(navigation d ri #f)
|
||||
,@(render-part d ri)
|
||||
,@(navigation d ri #t)))))])
|
||||
(let* ([style-file (or style-file scribble-css)]
|
||||
[xpr `(html ()
|
||||
(head
|
||||
(meta ((http-equiv "content-type")
|
||||
(content "text-html; charset=utf-8")))
|
||||
,@(let ([c (part-title-content d)])
|
||||
(if c
|
||||
`((title ,@(format-number number '(nbsp))
|
||||
,(content->string c this d ri)))
|
||||
null))
|
||||
,(if (eq? 'inline css-path)
|
||||
`(style ([type "text/css"])
|
||||
"\n"
|
||||
,(with-input-from-file style-file
|
||||
(lambda ()
|
||||
;; note: file-size can be bigger that the
|
||||
;; string, but that's fine.
|
||||
(read-string (file-size style-file))))
|
||||
"\n")
|
||||
`(link ((rel "stylesheet")
|
||||
(type "text/css")
|
||||
(href ,(or css-path
|
||||
(let-values ([(base name dir?)
|
||||
(split-path style-file)])
|
||||
(path->string name))))
|
||||
(title "default")))))
|
||||
(body ,@(render-toc-view d ri)
|
||||
(div ((class "maincolumn"))
|
||||
(div ((class "main"))
|
||||
,@(render-version d ri)
|
||||
,@(navigation d ri #f)
|
||||
,@(render-part d ri)
|
||||
,@(navigation d ri #t)))))])
|
||||
(unless css-path
|
||||
(install-file scribble-css))
|
||||
(install-file style-file))
|
||||
(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)))))
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
(define (render-mixin %)
|
||||
(class %
|
||||
(init-field [style-file #f])
|
||||
|
||||
(define/override (get-suffix) #".tex")
|
||||
|
||||
(inherit render-flow
|
||||
|
@ -26,20 +28,22 @@
|
|||
format-number)
|
||||
|
||||
(define/override (render-one d ri fn)
|
||||
(with-input-from-file scribble-tex
|
||||
(lambda ()
|
||||
(copy-port (current-input-port)
|
||||
(current-output-port))))
|
||||
(printf "\\begin{document}\n\\preDoc\n")
|
||||
(when (part-title-content d)
|
||||
(printf "\\titleAndVersion{")
|
||||
(render-content (part-title-content d) d ri)
|
||||
(printf "}{~a}\n"
|
||||
(or (and (versioned-part? d)
|
||||
(versioned-part-version d))
|
||||
(version))))
|
||||
(render-part d ri)
|
||||
(printf "\\postDoc\n\\end{document}\n"))
|
||||
(let ([style-file (or style-file
|
||||
scribble-tex)])
|
||||
(with-input-from-file style-file
|
||||
(lambda ()
|
||||
(copy-port (current-input-port)
|
||||
(current-output-port))))
|
||||
(printf "\\begin{document}\n\\preDoc\n")
|
||||
(when (part-title-content d)
|
||||
(printf "\\titleAndVersion{")
|
||||
(render-content (part-title-content d) d ri)
|
||||
(printf "}{~a}\n"
|
||||
(or (and (versioned-part? d)
|
||||
(versioned-part-version d))
|
||||
(version))))
|
||||
(render-part d ri)
|
||||
(printf "\\postDoc\n\\end{document}\n")))
|
||||
|
||||
(define/override (render-part d ri)
|
||||
(let ([number (collected-info-number (part-collected-info d ri))])
|
||||
|
@ -49,7 +53,7 @@
|
|||
(printf "\\twocolumn\n\\parskip=0pt\n\\addcontentsline{toc}{section}{Index}\n"))
|
||||
(printf "\\~a~a{"
|
||||
(case (length number)
|
||||
[(0 1) "newpage\n\n\\section"]
|
||||
[(0 1) "sectionNewpage\n\n\\section"]
|
||||
[(2) "subsection"]
|
||||
[(3) "subsubsection"]
|
||||
[else "subsubsection*"])
|
||||
|
@ -186,16 +190,16 @@
|
|||
(= 1 (length (car (table-flowss t)))))
|
||||
(let ([m (current-table-mode)])
|
||||
(and m
|
||||
(equal? "longtable" (car m))
|
||||
(equal? "supertabular" (car m))
|
||||
(= 1 (length (car (table-flowss (cadr m))))))))]
|
||||
[tableform (cond
|
||||
[index? "list"]
|
||||
[(and (not (current-table-mode))
|
||||
(not inline-table?))
|
||||
"longtable"]
|
||||
"supertabular"]
|
||||
[else "tabular"])]
|
||||
[opt (cond
|
||||
[(equal? tableform "longtable") "[l]"]
|
||||
[(equal? tableform "supertabular") "[l]"]
|
||||
[(equal? tableform "tabular") "[t]"]
|
||||
[else ""])]
|
||||
[flowss (if index?
|
||||
|
@ -216,9 +220,7 @@
|
|||
(if boxed?
|
||||
(format "{~a\\begin{picture}(1,0)\\put(0,0){\\line(1,0){1}}\\end{picture}}~a\n\\nopagebreak\n"
|
||||
"\\setlength{\\unitlength}{\\linewidth}"
|
||||
(if (equal? tableform "longtable")
|
||||
"\\vspace{-5ex}"
|
||||
"\n\n"))
|
||||
"\n\n")
|
||||
"")
|
||||
tableform
|
||||
opt
|
||||
|
@ -266,11 +268,11 @@
|
|||
(unless (null? (cdr flowss))
|
||||
(loop (cdr flowss) (cdr row-styles)))))
|
||||
(unless inline?
|
||||
(printf "\n\n\\end{~a}~a\n"
|
||||
tableform
|
||||
(if (equal? tableform "longtable")
|
||||
"\\vspace{-3ex}" ;; counteracts mysterious space added after longtable
|
||||
""))))))
|
||||
(printf "~a\n\n\\end{~a}\n"
|
||||
(if (equal? tableform "supertabular")
|
||||
"\n\\\\"
|
||||
"")
|
||||
tableform)))))
|
||||
null)
|
||||
|
||||
(define/override (render-itemization t part ri)
|
||||
|
|
|
@ -1880,7 +1880,7 @@
|
|||
(make-link-element #f
|
||||
content
|
||||
(or (find-scheme-tag p ri stx-id #f)
|
||||
(format "--UNDEFINED:~a--" (syntax-e stx-id))))))
|
||||
`(undef ,(format "--UNDEFINED:~a--" (syntax-e stx-id)))))))
|
||||
(lambda () content)
|
||||
(lambda () content))))
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
(make-parameter #f))
|
||||
(define current-info-input-files
|
||||
(make-parameter null))
|
||||
(define current-style-file
|
||||
(make-parameter #f))
|
||||
|
||||
(define (get-command-line-files argv)
|
||||
(command-line
|
||||
|
@ -48,6 +50,8 @@
|
|||
(current-dest-directory dir)]
|
||||
[("--dest-name") name "write output as <name>"
|
||||
(current-dest-name name)]
|
||||
[("--style") file "use given .css/.tex file"
|
||||
(current-style-file file)]
|
||||
[("--info-out") file "write format-specific link information to <file>"
|
||||
(current-info-output-file file)]]
|
||||
[multi
|
||||
|
@ -68,7 +72,8 @@
|
|||
(make-directory* dir))
|
||||
|
||||
(let ([renderer (new ((current-render-mixin) render%)
|
||||
[dest-dir dir])])
|
||||
[dest-dir dir]
|
||||
[style-file (current-style-file)])])
|
||||
(send renderer report-output!)
|
||||
(let* ([fns (map (lambda (fn)
|
||||
(let-values ([(base name dir?) (split-path fn)])
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
\usepackage{graphicx}
|
||||
\usepackage{hyperref}
|
||||
\renewcommand{\rmdefault}{ptm}
|
||||
\usepackage{longtable}
|
||||
\usepackage{supertabular}
|
||||
\usepackage[htt]{hyphenat}
|
||||
\usepackage[usenames,dvipsnames]{color}
|
||||
\hypersetup{bookmarks=true,bookmarksopen=true,bookmarksnumbered=true}
|
||||
|
@ -69,6 +69,8 @@
|
|||
|
||||
\newcommand{\titleAndVersion}[2]{\title{#1\\{\normalsize Version #2}}\maketitle}
|
||||
|
||||
\newcommand{\sectionNewpage}{\newpage}
|
||||
|
||||
\newcommand{\preDoc}{\sloppy}
|
||||
\newcommand{\postDoc}{}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
(define (render-mixin %)
|
||||
(class %
|
||||
(init [style-file #f])
|
||||
|
||||
(define/override (get-substitutions)
|
||||
'((#rx"---" "\U2014")
|
||||
(#rx"--" "\U2013")
|
||||
|
|
Loading…
Reference in New Issue
Block a user