[racket] Getting started with Scribble
I'm still curious to get scribble/lp working, but I've figured out an
immediate solution to my question. I was able to get the behavior I want
with just a simple macro:
@(define-syntax-rule (code l)
(begin
@schemeblock[l]
l))
Below is a sample of its use to get the behavior I want where you can hit
run and have your code execute, or hit the scribble-html button to have it
scribbled. If others like this idea as much as I, maybe this macro would
be something worth including in scribble/manual?
One thing I still haven't figured out is how to get a comment (introduced
with a semicolon) that is in the code block to show up in the scribbled
output. (In the example below, the comment ";; the zero test" doesn't show
up in the scribble output).
------- Example -----
#lang scribble/manual
@(define-syntax-rule (code l)
(begin
@schemeblock[l]
l))
@title{This is the title of my document}
Welcome to my test of the scribble system. Above, I gave the document a
title. Here is some introductory text.
@section{Factorial}
I'm going to define the factorial function.
@code[
(define (factorial n)
(cond
[(zero? n) 1] ;; The zero test
[else (* n (factorial (sub1 n)))]))
]
@section{Conclusion}
To turn this file into pretty HTML, just push the Scribble HTML button in
the upper-right corner.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120317/9c2c4770/attachment.html>