On Sun, Dec 13, 2009 at 11:47 AM, Juaco <
joaqui...@gmx.de> wrote:
>
> On 11 Dez., 17:47, dhumphrey <
da...@dlkeh.net> wrote:
>
>> Incidentally, I never thought about using Leo to organize a pure Latex
>> project, so Leo has made me think in a new way.
>
> Although I somehow late to this discussion, I would like to say
> something as a simple user. Some weeks ago I tried to generate my
> first LaTeX documents. I had at the very beginning only a partial
> success. I received several useful answers from different persons
> participate in this group.
>
> One of the difficulties was how to "convince" Leo to write raw code, I
> wanted to write some equations and tables, so it was necessary to use
> symbols like \, { }, and so on, i. e., what is required by LaTeX. The
> problem was that all these symbols were "interpreted" wrongly and
> replaced by an unreadable code. The solution was to use the raw
> directive.
Thanks for these helpful comments.
I am beginning to think that Leo is quite close to being the ultimate
rST processor, with just a slight change in point of view (and
corresponding docs, of course :-) I'm thinking out loud here.
As I write this, it looks like there are two, no three, no four, no
five, no six, ways to fully integrate rST into Leo.
Part 1: Make @rst trees behave like full-fledged @<file> nodes.
Suppose we make @rst nodes behave like other kinds of @<file> nodes.
@rst trees would then have the following properties:
A. As with any @<file> node, saving a Leo outline will write the file
if any part of the outline is dirty. In effect, Leo automatically
performs the rst3 command in such situations.
B. Like an @nosent file (and present @rst trees), Leo will store the
data in the outline, not in the generated file.
B. The write_intermediate_file rst option might could be expanded so
that it would specify the full path of the intermediate file. This
option would have to appear in the root @rst node.
Continuing this line of thought, an @rst tree without a filename would
still be useful, provided it had an write_intermediate_file option
that specified an intermediate file: saving the outline would write
this file if the @rst tree were dirty.
Part 2: Add @rst capabilities to @<file> trees.
This is kinda a new thought. It may have been inspired by the recent
comments concerning Leo and literate programming. The question is:
can we have the rst3 command do something useful and interesting when
applied to an @<file> tree?
Just as with @rst trees, selecting any node within an @<file> tree
will cause the rst3 command to look up the tree looking for *either*
@rst nodes (as at present) *or* @<file> nodes (the new capability).
If the rst3 command finds an @<file> node, the rst3 command **must
not** write the file--Leo *already* writes the file as needed. But,
depending on @rst options, the rst3 command *could* write one or more
additional files, and these additional files could be considered to be
"weaves" of (all or parts of) the external file specified in the
@<file> node.
Part 3: tagged weaves in any kind of @<file> tree, include @rst trees.
Here is another idea inspired by "tags" like @design-notes that I
discussed earlier today. We could have the something like the
following rst options::
@ @rst-options
rst-tag-file <tag> <tag-file>
@c
This would search for all nodes with headline starting with @tag,
munge those nodes as usual as per the rst3 command, and then send the
output to tag-file. In effect, this "weaves" the outline
automatically into tag-file. Let us use the term **intermediate
file** to mean either the file specified by the (expanded)
write_intermediate_file option or one of these new tag-file files.
For further control, we could allow body text to contain
@ @rst-options
set-tag <tag>
which would be the same as starting the headline with @<tag>. This
scheme would allow a single outline to have arbitrarily many weaves:
one for each tag and corresponding tag file.
Part 4: @rst trees without a file name.
This idea builds on the expanded meaning of intermediate files. If the
@rst node specifies no file, there would be no "official" output file
at all, but saving the Leo outline would create various intermediate
files as side effects. Imo, this is very much like automatic weaving.
For the very first time, Leo could support both automatic tangling
and automatic weaving!
Part 5: Applying scripts to intermediate or woven files.
As long as we are processing an @rst tree (or an @<file> tree??) for
its side effects (intermediate files) we might as well allow an @rst
file to specify a post-processing script. This won't work for all
kinds of @<file> trees, but in an @rst tree we could add support for
@post-processing-script nodes that would contain a script to be run
after creating any kind of intermediate file.
Part 6: leading and trailing blank lines.
Whenever writing any kind of intermediate file, Leo will be in a
position to ensure a blank line before and after the body text of any
node. So the expanded definition of intermediate files instantly
creates a context in which this important detail can be handled.
Conclusions
1. We can considerably expand what can be done in @rst trees by
expanding the notion of an intermediate rst file to include tagged
weaves and named intermediate files.
2. We can scan for rst options within @<file> nodes. These options
could create both kinds of intermediate files too. This expanded
scanning could be very fast: Leo would do it only if the @<file> node
itself contained an rst doc part.
3. Tagged weaves provide a highly flexible way of simulating TLP's
weave operations. As usual, adding outline context significantly
generalizes the notion. Why settle for one weave? A single @rst or
@<file> node could have dozens.
These are just initial thoughts. There may be gotcha's that I haven't
considered. However, it does appear that Leo can do much better than
at present with what appears to me to be very minimal changes to Leo's
rst and file write code.
Your comments, please.
Edward