On Thu, Dec 8, 2016 at 6:26 AM, Martin Monperrus <[email protected]
> wrote:
> Thanks for your answer.
>
> doc = new LeoDoc("foo.tex")
>
> This means that foo.tex already exists, has content, and I want to load it
> with Leo's API, before manipulating the nodes I'm interested in.
>
You can simple use an @edit node to bring in the all text in a single node.
To do this programmatically, here is tested code:
fn = 'path to your file'
with open(fn) as f:
p = c.lastTopLevel().insertAfter()
p.h = g.shortFileName(fn)
p.b = g.toUnicode(f.read())
c.redraw()
But that just gives you flat text.
To create an outline, with 'foo.tex' as its root, you would follow the
general template of one of Leo's importers. Feel free to file an
enhancement request. This assumes that the .tex file defines some kind of
logical structure...
Edward
--
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.