[racket] Scribble + dynamically entering a file
Thank you guys!
I brought the modfile.rkt out to the directory where I am writing the scrbl
files and imported it as shown in one of the other scriblings
(reader-extractor I think), worked like a charm!
Cheers!
(I know I'm probably doing something stupid by bringing files out from
/usr/plt/... but what works works!)
On Wed, Sep 29, 2010 at 7:10 PM, Matthias Felleisen <matthias at ccs.neu.edu>wrote:
>
> On Sep 29, 2010, at 7:24 AM, Matthew Flatt wrote:
>
> > At Wed, 29 Sep 2010 14:40:17 +0530, Ishaan Singh wrote:
> >> I'm new here, but went through the documentation and couldn't find an
> answer
> >> to this so was wondering:
> >> If I want to write a scribble file and somehow 'include' a text file by
> just
> >> referencing the name of that text file, is it possible?
> >> I want to do this to set up an example and add scheme codes '.ss' but
> want
> >> to make it such that if i make changes to the scheme code in the .ss
> files,
> >> and then re-execute scribble --html, the updated code should be embedded
> in
> >> the generated html file.
> >
> > See "collects/scribblings/guide/modfile.rkt".
> >
> > The "modfile.rkt" module defines a `racketmodfile' form that is like
> > `racketmod', but `racketmodfile' takes the content to typeset from a
> > file.
> >
> > Something like that is probably what you want. In fact, let me know how
> > what you wanted differs, because I should add a suitably general form
> > of `racketmodfile' in the Scribble libraries.
>
> If you don't want it type set you may wish to write a function like this:
>
> (provide/contract
> [file-is
> ;; read count lines from file f and label it 'name' in the scribble
> document
> (-> natural-number/c (and/c string? file-exists?) string?
> nested-flow?)])
>
>
> (define (file-is count f name)
> (define prefix (map tt (append (take (read-lines f) count) '("..."))))
> (define newln* (add-between prefix nl))
> (centered
> (tabular (list (list "file name:" sp (italic name))))
> (tabular (list (list newln*)))))
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100930/30259945/attachment.html>