On Fri, Aug 02, 2019 at 10:46:26AM -0400, Benjamin Yeung wrote:
> On Fri, Aug 2, 2019 at 7:25 AM Hendrik Boom <hend...@topoi.pooq.com> wrote:
> >
> > 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
> >
> > (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.
> 
> Sorry for both being late to this discussion for possibly bringing up
> something that you may already have attempted, but did you try
> wrapping your "author-only" sections and defining an identifier for
> it?  It might be a bit of a compromise of the two items you've
> referenced here, as it does need some extra code, but at least you
> don't need an external tool and it's a very modest amount of
> additional engineering.  I had in mind something like:
> 
> On Thu, Aug 1, 2019 at 7:25 AM Hendrik Boom <hend...@topoi.pooq.com> wrote:
> >
> > (1) Some of the @ commands I use are intended to cause conditional
> > inclusion of their contents, dependong on a command-line arameter (which
> > haven't yet implemented in scribble.  This is so I can keep my athor's
> > notes about the text in the text itself, read them while looking at
> > drafts, but have them removed for the final reader's copy.
> >
> > I've tested this by defining one of these operations (@snip) to delete
> > all its contents all of the time, and that works.  (Command line
> > dependence will come later).
> >
> > But it is not possible to snip out entire sections.  In particular,
> >    @snip{
> >       @include-section{"author-only-section.scrbl"}
> >    }
> > fails, complaining that there's a nested require.
> >
> > Is there some way around this?
> >
> 
> "Wrap" the "author-only-section.scrbl" material in a little bit of packaging:
> 
> #lang scribble/base
> @(provide author-only-section)
> 
> @(define author-only-section
>     @section{ @; Or a different structure/block as appropriate
> This is the content of the author-only-section.
> })

Would this mean that the author-only-section could not itself have 
other @include-sections within it, being nested within a define?  A 
minor flaw in my case, because I don't actually do that.  And I could 
use the same mechanism if I needed to.


> 
> ----------
> 
> Then in the file where it is conditionally included:
> 
> #lang scribble/base
> Pre-snip text.
> 
> @(require "author-only-section.scrbl")
> @snip{@author-only-section}
> 
> Post-snip text.
> 
> ----------
> 
> Of course, you can use a macro, as was alluded to above, to clean up
> the `require` boilerplate.  Does that do something close enough to
> what you want without adding too much bulk?

It's not being done often enough to warrant a macro.  It is being done 
often enough to warrant a mechanism.  I think this one will work.

-- 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/20190802162227.s6u2eshp6wm2ykdu%40topoi.pooq.com.

Reply via email to