On Thu, 6 Oct 2011 06:51:08 -0700 (PDT)
Todd Mars <[email protected]> wrote:
> I would like to output @file trees with the headline as the top line
> of the body text that is written. (an option to do that)
> Or:
> I would like to be able to indent @rst <fn> output, each headline
> section is indented (using indented @others doesn't do it)
So if you use
@file mynotes.txt
and use indented @others - ah, I was trying to work out what was
missing there, the answer would be the headline text, @file output
doesn't include that, @rst output does, but rst is not indented.
So here's the script updated to put output in a file, I don't think
there's a built in method to do what you're trying to do.
Cheers -Terry
def export_text(p, level=0, lines=[]):
indent = ' '*3*level+'o '
lines.append(indent+p.h)
if p.b.strip():
indent =' '*3*level+' '
lines.append('\n'.join(indent+i for i in p.b.strip().split('\n')))
for child in p.children():
export_text(child, level+1, lines=lines)
lines=[]
for i in c.getSelectedPositions():
export_text(i, 0, lines)
lines.append('')
filename = g.app.gui.runSaveFileDialog('Save to file')
open(filename,'w').write('\n'.join(lines))
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.