commit 60a055158adb7659683af1de310bf6b8d32de19a
parent 97d55239bd9720a5af000b1ba586643bf7d3f980
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Sat, 26 May 2007 00:50:37 +0000
start work on guide section on data; add support for styled paragraphs; fix interactions and state
svn: r6328
original commit: 5cd9016cc182447307ba4eafc7bde513647cb637
Diffstat:
5 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/collects/scribble/decode.ss b/collects/scribble/decode.ss
@@ -115,7 +115,7 @@
(part-start-tag s)
(part-start-title s)
(add1 part-depth))]
- [part (decode-part l tag title part-depth)])
+ [part (decode-flow* l tag style title part-depth)])
(make-styled-part (part-tag part)
(part-title-content part)
(part-collected-info part)
diff --git a/collects/scribble/eval.ss b/collects/scribble/eval.ss
@@ -121,9 +121,20 @@
(parameterize ([current-output-port o])
(with-handlers ([exn? (lambda (e)
(exn-message e))])
- (cons (do-plain-eval s #t)
+ (cons (let ([v (do-plain-eval s #t)])
+ (copy-value v))
(get-output-string o)))))]))
+ ;; Since we evaluate everything in an interaction before we typeset,
+ ;; copy each value to avoid side-effects.
+ (define (copy-value v)
+ (cond
+ [(string? v) (string-copy v)]
+ [(bytes? v) (bytes-copy v)]
+ [(pair? v) (cons (copy-value (car v))
+ (copy-value (cdr v)))]
+ [else v]))
+
(define (strip-comments s)
(cond
[(and (pair? s)
diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss
@@ -127,7 +127,10 @@
(render-flow* p part ht #t))
(define/override (render-paragraph p part ht)
- `((p ,@(super render-paragraph p part ht))))
+ `((p ,@(if (styled-paragraph? p)
+ `(((class ,(styled-paragraph-style p))))
+ null)
+ ,@(super render-paragraph p part ht))))
(define/override (render-element e part ht)
(cond
diff --git a/collects/scribble/scribble.css b/collects/scribble/scribble.css
@@ -9,6 +9,22 @@
margin-right: auto;
}
+ .refpara {
+ display: block;
+ position: relative;
+ left: 37em;
+ top: -1em;
+ height: 0em;
+ }
+
+ .refcontent {
+ background-color: beige;
+ display: block;
+ position: relative;
+ width: 10em;
+ font-size: 85%;
+ }
+
h1,h2,h3,h4,h5,h6 {
margin-top: .5em;
}
diff --git a/collects/scribble/struct.ss b/collects/scribble/struct.ss
@@ -60,6 +60,7 @@
[(unnumbered-part part) ()]
[flow ([paragraphs (listof flow-element?)])]
[paragraph ([content list?])]
+ [(styled-paragraph paragraph) ([style any/c])]
[table ([style any/c]
[flowss (listof (listof flow?))])]
[delayed-flow-element ([render (any/c part? any/c . -> . flow-element?)])]