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

>
>
> On Mon, Oct 1, 2018 at 10:15 AM Franz Kelnreiter <[email protected]>
> wrote:
>
> But how can I access `RstCommands.root.h` in a @btn script?
>>
>
> All scripts work the same, including @button scripts and @command scripts.
>
> Given a node p: p.isAnyAtFileNode() returns True if p is an @file, @auto,
> @clean, etc node.
>
> In that case, p.anyAtFileNodeName() is the contents actual file name in
> the headline.
>
> But that doesn't resolve the actual path.  g.fullPath(c, p) does that,
> taking account of @path directives and also default settings.  See the
> actual definition of g.fullPath for details.
>
> HTH.
>
> Edward
>

Thank you Edward. I finally figured out what I wanted :)
My solution is:

.. code::

  for n in p.self_and_parents():
    if n.h.startswith("@rst "):
        rstfn = n.h.strip()[5:]
        g.es("file to process: %s" % rstfn)

This always returns the file name of the currently active rst - root node.

--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