On Thu, Aug 01, 2019 at 07:41:46AM -0400, Benjamin Lerner wrote:
> On 8/1/19 7:25 AM, Hendrik Boom wrote:
> 
> > Well, my novel draft made it through Scribble, but not intact.
> > 
> > 
> > (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?
> 
> You need to define @snip as a macro, rather than as a function, so that it
> can eliminate the syntax that does the require:
> 
> |(define-syntax (ship stx) (syntax-case stx () [(snip . forms) (if (getenv
> "SHOW-SNIP") #'(begin . forms) #'(begin))])) |
> 
> Use this with bracket arguments, as in |@snip[@include-section{blah}]|

That looks plausible.  Except that when the snipped text is shown, it 
should be in a different colour so as to identify it as snipped text.  
Even if i were to modify the macro to include a colour specification 
(and I don't know enough about macros or scribblt to accomplish this 
myself), I'd just end up with the colour specification wrapping the 
include-section command.  This probably woudn't work for the same 
reasons as the original snip function.

I think I'm going to have to snip section text within the section 
(which will still leave a number for an empty section) or find another 
mechanism for including sections.

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?

-- hendrik

> 
> > (2) When I use include-section from the main file, the actual text in
> > the main file appears first, and the included files are all saved up ane
> > emitted after the text in the main file.  I expected the sections to be
> > included where the include-section command was instead of being saved to
> > the end.
> > 
> > Is there some way to force immediate rather than deferred inclusion?
> > Text that is intended to frame a section, before and after, no
> > longer does.  The only way around this seems to be to put the after-text
> > into the section itself, which is *not* the structure I want.
> 
> How are you invoking scribble? If you’re using the |-html| argument (rather
> than |-htmls|) or |-pdf|, I think it should be producing a single file in
> the manner you expect, /unless/ you have sectioning commands in the included
> file, in which case I’m not sure what it does.

Just
    scribble whole.scrbl
where whole.scrbl is the file that @include-section's all the others.

>From what you say, scribble is indeed supposed to work the way I 
thought it would work.  So there's something peculiar about my 
input.

I'll try and make a simpler case that gives the same symptoms to see 
what happens.

> 
> > Of course one ot the uses I have for this is for author-only text that
> > talks bout problems with the section, rather than being contained in
> > teh section itself.  But I can imagine it being useful in text intended
> > for the reader as well.
> > 
> > Wrapping text around sections makes a real difference if each section is
> > compiled to its own HTML page.
> > 
> > (3) This one isn't a real problem, but is an annoyance, since I can
> > instead make major changes to the source files and make them work.
> > 
> > When the scribble source file is already formatted in the style normally
> > used in English books, with a few spaces (in my case 5) starting every
> > paragraph and no blank line separating them, the division into
> > paragraphs is completely ignored and everything is run together into one
> > paragraph.  Is this actually intended?  Yes, I agree it seems to be
> > according to spec, because there aren't any blank lines between
> > paragraphs, just intentation on the first line, but is this actually
> > useful for any purpose?
> 
> Since the majority of uses of Scribble seem to have been formatted-for-web
> technical documentation, where the formatting is non-indented paragraphs
> separated by blank lines, and since Racket’s syntax isn’t typically
> whitespace sensitive, I think this probably just made sense at the time, but
> you’d have to ask Matthew for more info there…

It probably *could* be done, because the indentation information does 
seem to be tucked away somehere in the results from the scribble 
reader, but it would require a lot of knowledge of scribble internals.

It may be easier to write a one-time  indentation-to-blank line 
converter and use it on the entire set of source files.  I'd be sorry 
to have to work from a source file format that's visaully significantly 
different from the intended web page or pdf.

Similar issue with a page of bullet points written in markdown style.
Very readable, but incompatible with scribble's mechanisms.  And 
scribble' version is signeficantly less readable.

-- 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/20190801175404.wpddgltvo6zl7upj%40topoi.pooq.com.

Reply via email to