[plt-scheme] Including example code from a file in Scribble

From: Noel Welsh (noelwelsh at gmail.com)
Date: Tue Aug 7 11:20:47 EDT 2007

Thanks!  Note that Scribble barfs if every section (as included with
@include-section) doesn't contain a @title.  I don't know if this is
deliberate but it took me ages to work what was going wrong.

Here's the error message:

Welcome to MzScheme v370.6 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
 [Output to /home/pg/nhw/shared/zero-to-hero/zero-to-hero/index.html]
car: expects argument of type <pair>; given #f

 === context ===
render-toc-view method in ...ibble/html-render.ss:27:4
render-one-part method in ...ibble/html-render.ss:27:4
/data/private/nhw/lib/plt/collects/scribble/run.ss:65:2: build-docs

And here's my build script:

(module build mzscheme

  (require (lib  "run.ss" "scribble")
           (file "zero-to-hero.scrbl"))

      ([current-render-mixin multi-html:render-mixin]
       [current-dest-directory (current-directory)]
       [current-info-output-file "info-html.data"])
    (build-docs (list doc)
                (list "zero-to-hero")))



On 8/5/07, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Sun, 5 Aug 2007 15:57:16 +0100, "Noel Welsh" wrote:
> >                (with-input-from-file file-name
> >                  (lambda ()
> >                    (port->list
> >                     (lambda (p) (read-syntax file-name p))
> >                     (current-input-port))))])
> Add
>  (port-count-lines! (current-input-port))
> before the `port->list' call.
> Having to explicitly turn on line counting is common source of
> confusion, but I don't have a good idea on how to avoid it, mainly
> because PLT Scheme doesn't distinguish text ports from binary ports.
> Matthew

Posted on the users mailing list.