On Mon, 1 Oct 2018 at 12:11, Edward K. Ream <[email protected]> wrote:

> On Sunday, September 30, 2018 at 4:44:45 PM UTC-5, frakel12 wrote:
>
> > is there a way to find out the name of the current intermediate file Leo
> is producing when invoking a @button script with
> c.k.simulateCommand('rst3') from any sub-node of an @rst node.
>
> The rst3 command may produce multiple results, so there is no unique
> answer.
>
> > In other words, how can I figure out the name of 'mydocument.tex' when
> compiling the node '@rst mydocument.tex' ??
>
> I presume you are talking about the full path to mydocument.tex, but I'm
> not sure I understand your question.
>
> Let's look at the code.  The top-level code is rst.rst3 command & helpers,
> in leoRst.py.  To find all @rst nodes, rst.processTopTree uses:
>
> roots = g.findRootsWithPredicate(self.c, p, predicate=predicate)
>
> For each root node in the roots list, rst.processTopTree calls:
>
> self.root = p.copy()
> self.processTree(p, ext=None, toString=False, justOneFile=justOneFile)
>
> So, within the rst code itself, self.root is the root @rst node.  The
> calculation of the output path occurs deep in the called code.  You could
> try to find and use that code, but that won't be pretty.
>
> Instead, your script could use g.findRootsWithPredicate (with a simpler
> predicate) to compute it's own list of @rst nodes, and call rst.processTree
> for each root.  That way you would be sure what @rst node is being
> processed, which in turn makes the path calculations easier.
>
> HTH.
>
> Edward
>

     Thank you Edward I guess it must be a simpler solution. Let me explain
      once again.
      I have for example the following structure:

            |-@rst myplan.tex
              |- myplan-node1
                    |- myplan-node2
            |-@rst mylist.tex
              |- mylist-node1
                    |- mylist-node2

      if I call `rst3` on the `mylist-node2` node Leo compiles a
      `mylist.tex.rst` file. I am generally not interested in the full path
      but only in the file name which always changes according to the node I
      am in. This name is located in `v.h` in one if `p.self_and_parents()`
nodes.

      Apparently it is stored in the root property of RstCommands-class
      as you pointed out.

      But how can I access `RstCommands.root.h` in a @btn script?

      When I do a g.es_print(p.h) I only get the headline of the current
      node whereas I need the head of the current rst root node...

     Sorry, I don't quite get it.

Thank you.
-franz

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to