Re: [racket-users] Scribble: is there a way to inject content from another file without creating a section?

46 views
Skip to first unread message

Matthew Flatt

unread,
Mar 2, 2019, 3:31:36 PM3/2/19
to Eric Haney, Racket Users
A `#lang scribble/base` module just defines and provides `doc` as an
instance of `part`, and `include-section` imports and returns that
`doc`. That is,

@include-section["x.scrbl"]

is equivalent to

@(require (rename-in "x.scrbl" [doc x:doc]))
@x:doc

You could instead extract the part's flow instead of using the whole
part, like this:

@(require (rename-in "x.scrbl" [doc x:doc])
scribble/core)
@(part-blocks x:doc)


At Sat, 2 Mar 2019 10:48:54 -0800 (PST), Eric Haney wrote:
> Scribble's include-section is great for splitting the document source into
> multiple files. I'm looking for a way to inject content from another file
> without making a numbered section.
>
> The motivation for this is to create problem sets for my math classes in a
> way that I could keep each question with its context (diagrams, space to
> leave an answer, etc) in an individual scribble file and then compose them
> together in the main file.
>
> I guess I either want (a) some way to supress the automatic indexing and
> linking that scribble does when using include-section or (b) some other way
> of automatically fetching the content from another file like 'include-part'
> or 'include-flow'---is there such a thing?
>
> Here's what I have in mind:
>
> #lang scribble/base
>
> @title{Problem Set 1}
>
> @section{Graphing}
>
> Directions...
>
> @itemlist[
>
> @item{@include-flow["path-to-graphing-question1"]}
>
> @item{@include-flow["path-to-graphing-question2"]}
>
> @item{@include-flow["path-to-graphing-question3"]}
>
>
> @section{Short Response}
>
> Directions...
>
> @include-flow["path-to-short-response-question"]
>
>
>
> Thanks!
>
>
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Eric Haney

unread,
Mar 7, 2019, 5:31:33 PM3/7/19
to Racket Users
This works exactly like I had hoped, thanks! Now I'm going to see whether I can figure out how to make a macro that works like include-section which will automate the importing and renaming.
Reply all
Reply to author
Forward
0 new messages