[racket] feeding input to Scribble and source location info

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun Aug 28 02:46:18 EDT 2011

Question about different ways of feeding input to Scribble, and whether 
Scribble insists on reading input from files itself for some purposes....

I want to write some code that takes a source document that's not in 
Scribble language, and produces a document that can be used with the 
Scribble tools.

This would be for the documentation for a PLaneT package, and perhaps 
for other purposes as well.

Ideally, I would like errors that Scribble tools report point to 
locations in the *source* document, which is not in Scribble format.

The most likely feasible way I can think of to preserve source location 
info for Scribble would be for my program to produce syntax objects and 
then call the appropriate Scribble code.

If that would be the way to do it, then I am wondering whether that 
works with how Scribble is used in PLaneT packages.

There is some flexibility here: If generating syntax objects fed 
directly to Scribble tools would be the way to get source location info 
in Scribble error messages, but that does not work with how Scribble is 
used for PLaneT packages, then there could be two modes of my program: 
one mode that feeds the syntax objects to Scribble tools for development 
purposes, and one mode that writes the syntax objects out as sexps 
without location info to a ".scrbl" file with "#lang scribble/doc" and 
whatnot prepended for use in distributing PLaneT packages.

Oh, another option to get rid of the two modes: write out a file that 
specifies a custom reader (coming from a PLaneT package), and that 
reader can read syntax objects and return those rather than making 
syntax objects from reading text.

-- 
http://www.neilvandyke.org/


Posted on the users mailing list.