Weave as rsT

1 view
Skip to first unread message

derwisch

unread,
Jun 5, 2008, 6:28:01 AM6/5/08
to leo-editor
There is one function I am consistently missing. Maybe it is about
time I scratch this itch myself.

Nonwithstanding Edwards arguments about the representation of a
literate program as a tree rather than as a text (or as a dictionary
rather than as a novel), sometimes I just need a documented set of
requirements, together with the code to implement them, printed out,
read by somebody else and signed.

As far as I could see, the weave commands only prepare a document for
further processing with for instance noweave. Lacking these tools at
my office PC, I would very much like to have a linearized document
that has all comments rendered as restructured text and all code
basically as is, wrapped in <code> tags, and processed according to
whatever CSS I see fit.

What do you think is the closest thing available in Leo to work from
there?

Edward K. Ream

unread,
Jun 5, 2008, 7:51:34 AM6/5/08
to leo-e...@googlegroups.com
On Thu, Jun 5, 2008 at 5:28 AM, derwisch <johannes...@med.uni-heidelberg.de> wrote:

...sometimes I just need a documented set of

requirements, together with the code to implement them, printed out,
read by somebody else and signed.

...I would very much like to have a linearized document

that has all comments rendered as restructured text and all code
basically as is, wrapped in <code> tags, and processed according to
whatever CSS I see fit.

What do you think is the closest thing available in Leo to work from
there?

This should be relatively easy to do in a script, the outline of which would be:

for p in c.currentPosition().self_and_subtree_iter():
  write(p)

The 'write' function is left as an exercise for the reader :-)  It would format @doc parts, etc.

For examples of similar write functions, see putBody in leoAtFile.py, and writeBody and writeHeadline in the rst3 plugin.

I would imagine an hour's work should give you something you can use.

Edward

derwisch

unread,
Jun 12, 2008, 8:26:24 AM6/12/08
to leo-editor
I was victimized by my own tendency to avoid the "read first, ask
questions later" principle.

On Jun 5, 12:28 pm, derwisch <johannes.hues...@med.uni-heidelberg.de>
wrote:
> There is one function I am consistently missing. Maybe it is about
> time I scratch this itch myself.
>
[...]

> Lacking these tools at
> my office PC, I would very much like to have a linearized document
> that has all comments rendered as restructured text and all code
> basically as is, wrapped in <code> tags, and processed according to
> whatever CSS I see fit.
>
> What do you think is the closest thing available in Leo to work from
> there?

After reading the docs of the rst plugin and a bit of playing I found
that the code-mode and show-doc-parts-as-paragraphs options make Leo
do almost exactly what I want.

Many thanks!

Edward K. Ream

unread,
Jun 12, 2008, 11:14:07 AM6/12/08
to leo-e...@googlegroups.com
On Thu, Jun 12, 2008 at 7:26 AM, derwisch <johannes...@med.uni-heidelberg.de> wrote:

After reading the docs of the rst plugin and a bit of playing I found
that the code-mode and show-doc-parts-as-paragraphs options make Leo
do almost exactly what I want.

Glad to hear it.  rst3 can do almost anything as it is now.  So much so that I never really am sure what it can do :-)

Edward
Reply all
Reply to author
Forward
0 new messages