On Thu, Aug 01, 2019 at 05:58:03PM -0500, Robby Findler wrote: > On Thu, Aug 1, 2019 at 12:54 PM Hendrik Boom <hend...@topoi.pooq.com> wrote: > > At present, @include-section invokes require. Does it need to? Does > > it actually export identifiers to the invoking scribble file? Or is > > this just a convenient way of getting it to process the #lang line and > > treat the included file with scribble (or, I suppose, other) syntax and > > semantics? > > Each #lang scribble/base (or other scribble languages) program turns > into a module that exports `doc`. @include-section[] uses that fact to > do its work. I think changing this aspect of scribble is not likely to > work well but if you wanted some other way (that wasn't section-based) > to break up your book then you could probably build it. Alternatively, > going with the flow would entail deciding to break up files only based > on the sectioning structure (roughly). :)
So I see two ways forward on the snipped include front: (1) Write a preprocessor along the lines of the C presprocessor, but a lot simpler, that handles the include-section[]s by actually copying them into the preprocessed copy of everything. or (2) Separate the snipped sections by separating them into a separate document. Thus the main document would no longer contain those sections in any form whatsoever. or (3) Invent a completely new include mechanism. One that explicitly calls the scribble reader on the included file and then returns a resulting list of items as its contribution to the main text. Some subtlety would be required here. The first approach has the disadvantage that the line numbers in scribble error messages would no longer be correct. Is there anything like C's #line directive to set line numbers? It has the advantage that the paragraph-formatting could be changed at the same time, replacing spaces at the beginning of the line with and extra newline. But it really goes against the grain to apply an external preprocessor to a language as flexible as Racket. The second is probably the simplest workaround. The third would likely require more knowledge of scribble internals than I have, but it might otherwise be easy to implement. -- hendrik -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20190802112544.5pralwfyxzkg37yb%40topoi.pooq.com.