[racket] Embedded docs

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Thu Apr 7 12:22:55 EDT 2011

You need to enable @{...} syntax.

If you module currently starts

 #lang racket/base

change it to

 #lang at-exp racket/base

which mixes @{...} syntax support onto the `racket/base' language.

At Thu, 7 Apr 2011 15:05:36 +0100 (BST), Mark Carter wrote:
> OK, I cleared up some of my problems in a previous post. It seems I have to do
>    raco setup
> to rebuild the module and documentation.
> 
> There's a problem, though. I have:
> 
> (provide/doc 
>  (proc-doc/names
>   http-get
>   (-> string?
>       string?) ; the output
>   (string-url)
>   @{Say something meaningful about http-get.}))
> 
> but when I try to run the module, I get
>  proc-doc/names: bad syntax in: (proc-doc/names http-get (-> string? string?) 
> (string-url) @ (Say something meaningful about http-get.))
> 
> I have used an example in files/gif.rkt as a template, so I'm not sure what the 
> problem is, and don't know how to go about resolving it. Here's my complete rkt 
> file:
> 
> 
> (module maths racket
>   (provide http-get)
>   
>   
> #|
> (require (lib "url.ss" "net"))
> 
> (define (http-get url)
>   (let ((p 0) 
>         (line 0)) 
>     (set! p (get-impure-port (string->url url)))
>     (let loop ((result ""))
>       (set! line (read-line p))
>       (if (eof-object? line)
>           (set! line result)
>           (loop (string-append result line))))
>     (close-input-port p)
>     line))
> 
> 
> |#
> 
> ;;; simplification suggested by Sogaard 29-Jul-2007
> 
> ;(require (lib "port.ss")
> ;         (lib "url.ss" "net"))
> 
>   (require racket/port)
>   (require net/url)
>   (require scribble/srcdoc)
>   ;(require/doc scribble/manual)
> 
>   #|
>   (define (http-get-XXX url-as-string)
>     (let* ([out (open-output-string)]
>            [in  (get-pure-port (string->url url-as-string))])
>       (copy-port in out)
>       (close-input-port in)
>       (get-output-string out))) 
> |#
> ;;;(http-get "http://www.google.co.uk/") 
> 
> ;;; Use (http-get "http://www.markcarter.me.uk/") , not (http-get 
> "www.markcarter.me.uk") .
> ;;; (http-get "http://www.markcarter.me.uk/index.html")
> 
> (provide/doc 
>  (proc-doc/names
>   http-get
>   (-> string?
>       string?) ; the output
>   (string-url)
>   @{Say something meaningful about http-get.}))
> 
> (define (http-get url-as-string)
>   (port->string (get-pure-port (string->url url-as-string))))
>             
>   )
> 
> I know it's messy, but I'm just trying to get something to work at this stage.
> 
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users


Posted on the users mailing list.