[racket] Problems using Sandbox and Scribble
Hi.
I want to evaluate some scribble things (in a sandbox) and then
combine them with other scribble things I already have lying around.
But I'm running into a problem.
If I, for example, make a nicely formatted (racket) code block in a
sandbox, and then put it in a (para) outside of that sandbox, the
world explodes. Here is a minimal example:
#lang racket
(require racket/sandbox
scribble/manual)
(define safe-eval
(make-evaluator 'racket/base #:requires '(scribble/manual scribble/racket)))
(pretty-print (racket foo)) ; Gives one output
(pretty-print (safe-eval '(racket foo))) ; Gives a slightly DIFFERENT output
(para (racket foo)) ; Finishes happily
(para (safe-eval '(racket foo))) ; Error
; end
This is the error I get:
para: contract violation
expected: pre-content?
given: (cached-element (style "RktSym" (list 'tt-chars (css-addition
'(collects #"scribble" #"racket.css")) (tex-addition '(collects
#"scribble" #"racket.tex")))) "foo" (vector (style "RktSym" (list
'tt-chars (css-addition '(collects #"scribble" #"racket...
in: an element of
the rest argument of
(->*
()
(#:style (or/c style? string? symbol? #f))
#:rest
(listof pre-content?)
paragraph?)
contract from:
<pkgs>/scribble-lib/scribble/base.rkt
blaming: anonymous-module
(assuming the contract is correct)
at: <pkgs>/scribble-lib/scribble/base.rkt:337.2
What is going on? Why does the same piece of code have two different
results depending on where it's executing? And most importantly, is
there a way for me to get this to work the way I /want/?
- Lucas Paul