> The "Advanced features" section is not ready for prime time. I'll be
> working on it today.
I guess @auto-rst should not be an "advanced feature", as it's
conceptually (and in practice) simpler than rst3.
--
Ville M. Vainio @@ Forum Nokia
Thanks for this reminder. Actually, it doesn't really belong in
Chapter 14 at all. It probably belongs in Chapter 4.
Edward
> As the introduction to the advanced topics makes clear, all
> these complexities arise from the desire to create documents
> automatically from computer source code.
When I awoke this morning, I started wondering whether "overloading"
markup in nodes (headlines, doc parts) might eliminate the need for
all the code-mode options, which would in turn eliminate the need for
code mode.
I'll be playing around with these ideas here. Now is the time to do
so, while the "horrors" are fresh in my mind.
The basic ideas:
All modes would treat docs "specially, but uniformly". This would not
be a big deal for rst mode: one could disable this using \@. In other
words, only '@', not '\@' would start a doc part as far as the rst3
command is concerned.
So the question is, how should the rst3 command treat doc parts in *all* modes?
This is not a big deal for rst mode, because **users don't typically
use doc parts in rst mode**, and the \@ convention (or more likely,
literal blocks) allows anything, including what looks like a doc part,
to be represented in rst mode.
Thus, the question becomes, what's the most useful way to treat doc
parts in code mode? Whatever we decide will become the *universal*
way of treating doc parts, even in rst mode. That is, we could
eliminate modal operation entirely!
Now we have some real choices. Here are the code-mode options.
number_code_lines
show_leo_directives
show_markup_doc_parts
show_options_doc_parts
show_doc_parts_as_paragraphs
show_options_nodes
Let's consider the usual case of formatting an outline containing
source code. Typically, the user
will put the desired defaults at or near the root of the tree using @
@rst-options. This option doc part
will be invisible to the rst3 command if show_options_doc_parts is
False. It's unlikely that *code* documentation
is ever going to want to show an @ @rst-options node, and in that
event, the docs could "simulate" the @ @rst-options using an @
@rst-markup node!
The only complication is the interaction between
show_doc_parts_as_paragraphs, show_markup_doc_parts and
show_options_doc parts, but I think such interactions will be rare
enough to be handled by embedded @ @rst-options and/or @ @rst-markup.
Let's step back a moment and ask some questions.
- Does the show_doc_parts_as_paragraphs option handle most common
situations when formatting code?
Yes, I think it does.
- Are @ @rst-options and @ @rst-markup to handle almost any
contingency when formatting code?
Yes, I think so.
4. Will eliminating code mode inconvenience rst mode (especially
newbies) in any significant way?
No, I don't think so.
1. Is there, in fact, *any* need for code mode?
I think not. We can eliminate code mode **provided** that
1. The tutorial tells newbies that the rst3 command treats doc parts
specially and
2. The rst3 command does, in fact, treat doc parts uniformly in all situations.
In short, I think a major simplification may be possible. But before
reaching a firm conclusion, I'll look at the code for the rst3 command
to see if there might be code-level gotchas. I suspect not. Instead,
I expect to be able to clean up the code significantly. We shall
see...
Edward
P.S. I remember reading that the original Unix developers sometimes
fixed bugs because they simply could not bear to document them :-)
Revising the rst3 docs may have been a similar situation...
P.P.S. I haven't discussed headlines here. This might be a
mini-gotcha. I have no idea whether code mode treats headlines in a
special way. If it does, I could always create another option that
would, in effect, distinguish
between the two ways of handling headlines without actually
re-creating code mode itself.
EKR
EKR
Thanks for these. I'll make the corrections asap.
Edward