Add an error message when the sandbox doesn't capture its output as a string.
original commit: 43d1c240a171943e214ac43055e6bdbfc5072f70
This commit is contained in:
parent
41b848edda
commit
09eb2cc7b7
|
@ -57,27 +57,26 @@
|
||||||
(make-element style (list s)))))
|
(make-element style (list s)))))
|
||||||
|
|
||||||
(define (format-output str style)
|
(define (format-output str style)
|
||||||
(if (string=? "" str)
|
(cond
|
||||||
null
|
[(not (string? str))
|
||||||
|
(error 'format-output "missing output, possibly from a sandbox ~a"
|
||||||
|
"without a `sandbox-output' configured to 'string")]
|
||||||
|
[(string=? "" str) null]
|
||||||
|
[else
|
||||||
(list
|
(list
|
||||||
(list
|
(list
|
||||||
(make-flow
|
(make-flow
|
||||||
(list
|
(list
|
||||||
(let ([s (regexp-split #rx"\n"
|
(let ([s (regexp-split #rx"\n" (regexp-replace #rx"\n$" str ""))])
|
||||||
(regexp-replace #rx"\n$"
|
|
||||||
str
|
|
||||||
""))])
|
|
||||||
(if (= 1 (length s))
|
(if (= 1 (length s))
|
||||||
(make-paragraph
|
(make-paragraph (list (literal-string style (car s))))
|
||||||
(list
|
|
||||||
(literal-string style (car s))))
|
|
||||||
(make-table
|
(make-table
|
||||||
#f
|
#f
|
||||||
(map (lambda (s)
|
(map (lambda (s)
|
||||||
(list (make-flow (list (make-paragraph
|
(list (make-flow
|
||||||
(list
|
(list (make-paragraph
|
||||||
(literal-string style s)))))))
|
(list (literal-string style s)))))))
|
||||||
s))))))))))
|
s))))))))]))
|
||||||
|
|
||||||
(define (format-output-stream in style)
|
(define (format-output-stream in style)
|
||||||
(define (add-string string-accum line-accum)
|
(define (add-string string-accum line-accum)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user