Dear Haris,
Replies interspersed.
> 1. You are correct Rob, I was misreading the spec, hadn’t realized the output
> part was optional. So is the proposed change on the schema level as simple as
> adding a question mark after the ConsoleInput in
> Console =
> element console {
> Component?,
> attribute prompt {text}?,
> attribute width {text}?,
> attribute margins {text}?,
> (
> ConsoleInput,
> ConsoleOutput?
> )+
> }
Dropping the question mark says that for every input there is a trailing output,
one-to-one, repeatedly. I think we want a mandatory {#input or #output} to lead
so the #console cannot be empty, or maybe a {#input-#output pair or a #output}
to lead. I think the latter reflects the original request.
> 2. I like the possibility of adding a “text utility” template for continuation,
> and I am imagining the continuation would be an attribute to #console? I’m not
> quite sure on where this goes in the files, I haven’t really messed around much
> with the XSLTs. Is this something that would somehow run on the PTX input
> regardless of target output? Or something that needs to be added to each target
> transformation?
Yes, I'd imagine a @continuation attribute, much like the @prompt attribute. A
"text processing" template to prepend the character would be recursive, with
parameters: remaining text, actual character, a flag saying the first line has
been skipped. If you would like to implement this, let me know when a Drop-In
session is convenient (Tuesday or Friday) and I can walk you through some of it.
> 3. On the #listing redesign front my particular use case would be for two or
> more #programs within the same #listing. One of the parts of my book is to
> discuss refactorings, and in those cases one would like to pair before-after
> versions of the code, and/or code from multiple files (e.g. a refactoring that
> moved a function from one file to another would have to show how both files have
> changed, but it’s still a cohesive unit). I can imagine WebApp examples that
> would contain in one listing code from multiple files. So having multiple
> #programs allowed would be very useful.
About 18 months ago, I told a meeting of the faithful that PreTeXt (the
language) was feeling pretty mature. So I wouldn't say we are doing a #listing
redesign. More of a tweak.
A #listing is a FIGURE-LIKE container to hold #program and #console so they are
more identifiable. #program and #console are atomic items in that they are not
built up from smaller pieces. In this case the container is meant to hold one
item. I've just conceded letting it hold two. I'd say a before-after refactor
is two listings, titled as such. Code from multiple files is several listings.
If you put code from many files into one listing, how are you going to delineate
them? Right now, at best you will get a small amount of vertical separation.
Nothing in braille. How are you going to reference these snippets, "The fifth
code hunk in Listing 8.32"?
#figure can hold #sidebyside, whose panels can be #listing. If the lines are
short, code and its refactor could be shown side-by-side.
Multiple files could be multiple #listing inside the "rows" of a #sbsgroup
(side-by-side group) inside a #figure. Maybe they get sub-numbered
automatically (Listing 8.23(e)) - if not, that might be a good enhancement, we
do it for #figure inside #sidebyside inside #figure. One caveat, too much of
this all packed together might stress the LaTeX conversion and its page-breaking.
Rob